diff options
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 19 | ||||
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 5 | ||||
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 33 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 26 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.h | 6 | ||||
-rw-r--r-- | src/widgets/styles/qstyleoption.cpp | 3 | ||||
-rw-r--r-- | src/widgets/styles/qstyleoption.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 11 |
8 files changed, 98 insertions, 7 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 8579308820..815b10c921 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4923,6 +4923,25 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = true; break; + case SH_Menu_SubMenuUniDirection: + ret = false; + break; + case SH_Menu_SubMenuUniDirectionFailCount: + ret = 1; + break; + case SH_Menu_SubMenuSloppySelectOtherActions: + ret = true; + break; + case SH_Menu_SubMenuSloppyCloseTimeout: + ret = 1000; + break; + case SH_Menu_SubMenuResetWhenReenteringParent: + ret = false; + break; + case SH_Menu_SubMenuDontStartSloppyOnLeave: + ret = false; + break; + case SH_ProgressDialog_TextLabelAlignment: ret = Qt::AlignCenter; break; diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index c1d6d879a8..ef3795c9a1 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1537,7 +1537,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio bool ignoreCheckMark = false; int checkcol = qMax(menuItem->maxIconWidth, 20); - if (qobject_cast<const QComboBox*>(widget)) + if (qobject_cast<const QComboBox*>(widget) || + (option->styleObject && option->styleObject->property("_q_isComboBoxPopupItem").toBool())) ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate if (!ignoreCheckMark) { @@ -1606,7 +1607,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio QRect pmr(0, 0, pixw, pixh); pmr.moveCenter(vCheckRect.center()); painter->setPen(menuItem->palette.text().color()); - if (checkable && checked) { + if (!ignoreCheckMark && checkable && checked) { QStyleOption opt = *option; if (act) { QColor activeColor = mergedColors(option->palette.background().color(), diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index d909e13f9a..fb0bafa66d 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2819,6 +2819,19 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_Menu_SubMenuPopupDelay: ret = 100; break; + case SH_Menu_SubMenuUniDirection: + ret = true; + break; + case SH_Menu_SubMenuSloppySelectOtherActions: + ret = false; + break; + case SH_Menu_SubMenuResetWhenReenteringParent: + ret = true; + break; + case SH_Menu_SubMenuDontStartSloppyOnLeave: + ret = true; + break; + case SH_ScrollBar_LeftClickAbsolutePosition: { NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; bool result = [defaults boolForKey:@"AppleScrollerPagingBehavior"]; @@ -3065,8 +3078,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w break; case SH_ScrollBar_Transient: if ((qobject_cast<const QScrollBar *>(w) && w->parent() && - qobject_cast<QAbstractScrollArea*>(w->parent()->parent())) || - (opt && QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ScrollBar))) { + qobject_cast<QAbstractScrollArea*>(w->parent()->parent())) +#ifndef QT_NO_ACCESSIBILITY + || (opt && QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ScrollBar)) +#endif + ) { ret = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 if (ret) @@ -3712,6 +3728,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { QStyleOptionToolButton myTb = *tb; myTb.state &= ~State_AutoRaise; +#ifndef QT_NO_ACCESSIBILITY if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) { QRect cr = tb->rect; int shiftX = 0; @@ -3808,6 +3825,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } else { QCommonStyle::drawControl(ce, &myTb, p, w); } +#else + Q_UNUSED(tb) +#endif } break; case CE_ToolBoxTabShape: @@ -5970,7 +5990,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex case CC_ToolButton: if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { - +#ifndef QT_NO_ACCESSIBILITY if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) { if (tb->subControls & SC_ToolButtonMenu) { QStyleOption arrowOpt(0); @@ -6107,6 +6127,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex label.rect = buttonRect.adjusted(fw, fw, -fw, -fw); proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget); } +#endif } break; case CC_Dial: @@ -6586,7 +6607,11 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op break; case CC_ToolButton: ret = QCommonStyle::subControlRect(cc, opt, sc, widget); - if (sc == SC_ToolButtonMenu && !QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) { + if (sc == SC_ToolButtonMenu +#ifndef QT_NO_ACCESSIBILITY + && !QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar) +#endif + ) { ret.adjust(-1, 0, 0, 0); } break; diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 6cf61a691e..7c4d239894 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -1707,6 +1707,32 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, other items of the menu. This is supported on most modern desktop platforms. + \value SH_Menu_SubMenuUniDirection Since Qt 5.5. If the cursor has + to move towards the submenu (like it is on OS X), or if the + cursor can move in any direction as long as it reaches the + submenu before the sloppy timeout. + + \value SH_Menu_SubMenuUniDirectionFailCount Since Qt 5.5. When + SH_Menu_SubMenuUniDirection is defined this enum defines the + number of failed mouse moves before the sloppy submenu is + discarded. This can be used to control the "strictness" of the + uni direction algorithm. + + \value SH_Menu_SubMenuSloppySelectOtherActions Since Qt 5.5. Should + other action items be selected when the mouse moves towards a + sloppy submenu. + + \value SH_Menu_SubMenuSloppyCloseTimeout Since Qt 5.5. The timeout + used to close sloppy submenus. + + \value SH_Menu_SubMenuResetWhenReenteringParent Since Qt 5.5. When + entering parent from child submenu, should the sloppy state be + reset, effectively closing the child and making the current + submenu active. + + \value SH_Menu_SubMenuDontStartSloppyOnLeave Since Qt 5.5. Do not + start sloppy timers when the mouse leaves a sub-menu. + \value SH_ScrollView_FrameOnlyAroundContents Whether scrollviews draw their frame only around contents (like Motif), or around contents, scroll bars and corner widgets (like Windows). diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h index 681f3e0468..12ada3f6e4 100644 --- a/src/widgets/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -701,6 +701,12 @@ public: SH_ComboBox_UseNativePopup, SH_LineEdit_PasswordMaskDelay, SH_TabBar_ChangeCurrentDelay, + SH_Menu_SubMenuUniDirection, + SH_Menu_SubMenuUniDirectionFailCount, + SH_Menu_SubMenuSloppySelectOtherActions, + SH_Menu_SubMenuSloppyCloseTimeout, + SH_Menu_SubMenuResetWhenReenteringParent, + SH_Menu_SubMenuDontStartSloppyOnLeave, // Add new style hint values here SH_CustomBase = 0xf0000000 diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 1d98a56063..027e36387a 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -1626,6 +1626,9 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version) \brief the progress bar's orientation (horizontal or vertical); the default orentation is Qt::Horizontal + \deprecated + Use the QStyle::State_Horizontal flag instead (in the the QStyleOption::state member). + \sa QProgressBar::orientation */ diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h index a475f485df..4b55cf3faf 100644 --- a/src/widgets/styles/qstyleoption.h +++ b/src/widgets/styles/qstyleoption.h @@ -317,7 +317,7 @@ public: QString text; Qt::Alignment textAlignment; bool textVisible; - Qt::Orientation orientation; + Qt::Orientation orientation; // ### Qt 6: remove bool invertedAppearance; bool bottomToTop; diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 708014a6df..3619c3ff29 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -586,6 +586,17 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid break; } #endif // Q_OS_WIN && !Q_OS_WINRT + case SH_Menu_SubMenuSloppyCloseTimeout: + case SH_Menu_SubMenuPopupDelay: { +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) + DWORD delay; + if (SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0)) + ret = delay; + else +#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT + ret = 400; + break; + } #ifndef QT_NO_RUBBERBAND case SH_RubberBand_Mask: if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) { |