summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-05-03 15:31:26 +0300
committerSami Merila <sami.merila@nokia.com>2010-05-03 15:31:26 +0300
commitfb2c7c62030f1e2bf314fc30b9786de611563116 (patch)
tree4e861e9ebc78715c5f9b6dcf9381e1bd8bc71ed4 /src/gui/widgets
parentb3ff31825d9c3e9d139565024d424eb03299b5f5 (diff)
downloadqt4-tools-fb2c7c62030f1e2bf314fc30b9786de611563116.tar.gz
QS60Style: QTabWidget Usability issue with capacitive screens
Normally Qt uses scrollbuttons together at right (for LeftToRight UI) side of the horizontal QTabBar; for vertical tab bar, scrollbuttons are displayed below/above the widget. Using QTabBar's scroll buttons with touch device that has capacitive screen, is somewhat hard as the touch area for either of the scroll buttons is somewhat smallish. So user is experiencing frequent wrong taps. Making the touch area larger, would make the tabbar tab shape area smaller, so it isn't a very good solution. Therefore, when QS60Style is in use, QTabWidget draws the scrollbuttons on either side of the QTabBar. Task-number: QT-3104 Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qtabbar.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 22e825561b..de1e3adaed 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -67,6 +67,10 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
+#ifndef QT_NO_STYLE_S60
+#include "qs60style.h"
+#endif
+
QT_BEGIN_NAMESPACE
inline static bool verticalTabs(QTabBar::Shape shape)
@@ -478,6 +482,9 @@ void QTabBarPrivate::layoutTabs()
if (useScrollButtons && tabList.count() && last > available) {
int extra = extraWidth();
+#ifndef QT_NO_STYLE_S60
+ QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style());
+#endif
if (!vertTabs) {
Qt::LayoutDirection ld = q->layoutDirection();
QRect arrows = QStyle::visualRect(ld, q->rect(),
@@ -485,25 +492,57 @@ void QTabBarPrivate::layoutTabs()
int buttonOverlap = q->style()->pixelMetric(QStyle::PM_TabBar_ScrollButtonOverlap, 0, q);
if (ld == Qt::LeftToRight) {
+// In S60style, tab scroll buttons are layoutted separately, on the sides of the tabbar.
+#ifndef QT_NO_STYLE_S60
+ if (s60Style) {
+ rightB->setGeometry(arrows.left() + extra / 2, arrows.top(), extra / 2, arrows.height());
+ leftB->setGeometry(0, arrows.top(), extra / 2, arrows.height());
+ } else {
+#endif
leftB->setGeometry(arrows.left(), arrows.top(), extra/2, arrows.height());
rightB->setGeometry(arrows.right() - extra/2 + buttonOverlap, arrows.top(),
extra/2, arrows.height());
+#ifndef QT_NO_STYLE_S60
+ }
+#endif
leftB->setArrowType(Qt::LeftArrow);
rightB->setArrowType(Qt::RightArrow);
} else {
+#ifndef QT_NO_STYLE_S60
+ if (s60Style) {
+ rightB->setGeometry(arrows.left() + extra / 2, arrows.top(), extra / 2, arrows.height());
+ leftB->setGeometry(0, arrows.top(), extra / 2, arrows.height());
+ } else {
+#endif
rightB->setGeometry(arrows.left(), arrows.top(), extra/2, arrows.height());
leftB->setGeometry(arrows.right() - extra/2 + buttonOverlap, arrows.top(),
extra/2, arrows.height());
+#ifndef QT_NO_STYLE_S60
+ }
+#endif
rightB->setArrowType(Qt::LeftArrow);
leftB->setArrowType(Qt::RightArrow);
}
} else {
+#ifndef QT_NO_STYLE_S60
+ if (s60Style) {
+ QRect arrows = QRect(0, 0, size.width(), available );
+ leftB->setGeometry(arrows.left(), arrows.top(), arrows.width(), extra / 2);
+ leftB->setArrowType(Qt::UpArrow);
+ rightB->setGeometry(arrows.left(), arrows.bottom() - extra / 2 + 1,
+ arrows.width(), extra / 2);
+ rightB->setArrowType(Qt::DownArrow);
+ } else {
+#endif
QRect arrows = QRect(0, available - extra, size.width(), extra );
leftB->setGeometry(arrows.left(), arrows.top(), arrows.width(), extra/2);
leftB->setArrowType(Qt::UpArrow);
rightB->setGeometry(arrows.left(), arrows.bottom() - extra/2 + 1,
arrows.width(), extra/2);
rightB->setArrowType(Qt::DownArrow);
+#ifndef QT_NO_STYLE_S60
+ }
+#endif
}
leftB->setEnabled(scrollOffset > 0);
rightB->setEnabled(last - scrollOffset >= available - extra);