summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qtabbar.cpp
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ulattil@nokia.com>2009-10-27 09:56:39 (GMT)
committerPrasanth Ullattil <prasanth.ulattil@nokia.com>2009-10-27 09:56:39 (GMT)
commit3bc088fad760bd50eec05b323a056641247a9a59 (patch)
tree7e8ea3eba5d282891a013c6a14c3ac19aa650427 /src/gui/widgets/qtabbar.cpp
parent5393f71b9ac66395258713d1703e5c7f23aba206 (diff)
downloadQt-3bc088fad760bd50eec05b323a056641247a9a59.zip
Qt-3bc088fad760bd50eec05b323a056641247a9a59.tar.gz
Qt-3bc088fad760bd50eec05b323a056641247a9a59.tar.bz2
QTabbar is not behaving (painting) like native ones on Mac.
When a tab is clicked and mouse is moved outside that tab, it should be drawn as normal (not in sunken state). Reviewed-by: MortenS
Diffstat (limited to 'src/gui/widgets/qtabbar.cpp')
-rw-r--r--src/gui/widgets/qtabbar.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 6c9761c..4dffbdc 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -1694,6 +1694,9 @@ void QTabBar::mousePressEvent(QMouseEvent *event)
d->moveTabFinished(d->pressedIndex);
d->pressedIndex = d->indexAtPos(event->pos());
+#ifdef Q_WS_MAC
+ d->previousPressedIndex = d->pressedIndex;
+#endif
if (d->validIndex(d->pressedIndex)) {
QStyleOptionTabBarBaseV2 optTabBase;
optTabBase.init(this);
@@ -1774,6 +1777,17 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event)
update();
}
+#ifdef Q_WS_MAC
+ } else if (!d->documentMode && event->buttons() == Qt::LeftButton && d->previousPressedIndex != -1) {
+ int newPressedIndex = d->indexAtPos(event->pos());
+ if (d->pressedIndex == -1 && d->previousPressedIndex == newPressedIndex) {
+ d->pressedIndex = d->previousPressedIndex;
+ update(tabRect(d->pressedIndex));
+ } else if(d->pressedIndex != newPressedIndex) {
+ d->pressedIndex = -1;
+ update(tabRect(d->previousPressedIndex));
+ }
+#endif
}
if (event->buttons() != Qt::LeftButton) {
@@ -1865,7 +1879,9 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event)
event->ignore();
return;
}
-
+#ifdef Q_WS_MAC
+ d->previousPressedIndex = -1;
+#endif
if (d->movable && d->dragInProgress && d->validIndex(d->pressedIndex)) {
int length = d->tabList[d->pressedIndex].dragOffset;
int width = verticalTabs(d->shape)