-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) Add support for call changing note's name by double clicking on a …
…note's tab;
- Loading branch information
Showing
6 changed files
with
67 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,32 @@ | ||
#include <QMouseEvent> | ||
#include "ztabwidget.h" | ||
#include "ztabbar.h" | ||
|
||
ZTabWidget::ZTabWidget(QWidget *parent) : | ||
QTabWidget(parent) | ||
{ | ||
setTabBar(new ZTabBar(this)); | ||
tabBar = new ZTabBar(this); | ||
// Control double-click on tab bar through an event filter. | ||
tabBar->installEventFilter(this); | ||
setTabBar(tabBar); | ||
} | ||
|
||
// Method is based on code from class MyTabWidget of project https://gitorious.org/qmpq. | ||
bool ZTabWidget::eventFilter(QObject *obj, QEvent *event) | ||
{ | ||
if (event->type() == QEvent::MouseButtonDblClick) { | ||
QMouseEvent * mouseEvent = static_cast<QMouseEvent *>(event); | ||
int tabIndex; | ||
tabIndex = tabBar->tabAt(mouseEvent->pos()); | ||
if (tabIndex == -1) | ||
// Chosen no a tab. | ||
emit tabBarDoubleClickedOnEmptySpace(); | ||
else | ||
// Chosen a tab | ||
emit tabBarDoubleClickedOnTab(tabIndex); | ||
return true; | ||
} else { | ||
// standard event processing | ||
return QTabWidget::eventFilter(obj, event); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters