QStyleHints: Add menuSelectionWraps
This lifts QStyle::SH_Menu_SelectionWrap to Qt GUI so it can also be honored from Qt Quick Controls. Change-Id: I78eb2dd9fe6ad9329d40f7962bf7ad5f07dd4685 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
9afc899a30
commit
acb8252d0a
@ -122,6 +122,11 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
\value ContextMenuOnMouseRelease (bool) Whether the context menu should be shown on mouse release.
|
||||
|
||||
\value MenuSelectionWraps (bool) Determines whether menu selection wraps. That is, whether key navigation moves
|
||||
the selection to the first menu item again after the last menu item has been
|
||||
reached, and vice versa.
|
||||
This enum value was added in Qt 6.10.
|
||||
|
||||
\value TouchDoubleTapDistance (int) The maximum distance in logical pixels which a touchpoint can travel
|
||||
between taps in order for the tap sequence to be handled as a double tap.
|
||||
The default value is double the MouseDoubleClickDistance, or 10 logical pixels
|
||||
@ -684,6 +689,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
|
||||
return true;
|
||||
case PreferFileIconFromTheme:
|
||||
return false;
|
||||
case MenuSelectionWraps:
|
||||
return true;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
|
@ -99,6 +99,7 @@ public:
|
||||
UnderlineShortcut,
|
||||
ShowIconsInMenus,
|
||||
PreferFileIconFromTheme,
|
||||
MenuSelectionWraps,
|
||||
};
|
||||
Q_ENUM(ThemeHint)
|
||||
|
||||
|
@ -476,6 +476,20 @@ void QStyleHints::setContextMenuTrigger(Qt::ContextMenuTrigger contextMenuTrigge
|
||||
emit contextMenuTriggerChanged(contextMenuTrigger);
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QStyleHints::menuSelectionWraps
|
||||
\since 6.10
|
||||
\brief menu selection wraps around.
|
||||
|
||||
Returns \c true if menu selection wraps. That is, whether key navigation moves
|
||||
the selection to the first menu item again after the last menu item has been
|
||||
reached, and vice versa.
|
||||
*/
|
||||
bool QStyleHints::menuSelectionWraps() const
|
||||
{
|
||||
return themeableHint(QPlatformTheme::MenuSelectionWraps).toBool();
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QStyleHints::passwordMaskDelay
|
||||
\brief the time, in milliseconds, a typed letter is displayed unshrouded
|
||||
|
@ -56,6 +56,7 @@ class Q_GUI_EXPORT QStyleHints : public QObject
|
||||
Q_PROPERTY(int touchDoubleTapDistance READ touchDoubleTapDistance STORED false CONSTANT FINAL)
|
||||
Q_PROPERTY(Qt::ColorScheme colorScheme READ colorScheme WRITE setColorScheme
|
||||
RESET unsetColorScheme NOTIFY colorSchemeChanged FINAL)
|
||||
Q_PROPERTY(bool menuSelectionWraps READ menuSelectionWraps STORED false CONSTANT FINAL REVISION(6, 10))
|
||||
|
||||
public:
|
||||
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
|
||||
@ -84,6 +85,7 @@ public:
|
||||
void setShowShortcutsInContextMenus(bool showShortcutsInContextMenus);
|
||||
Qt::ContextMenuTrigger contextMenuTrigger() const;
|
||||
void setContextMenuTrigger(Qt::ContextMenuTrigger contextMenuTrigger);
|
||||
bool menuSelectionWraps() const;
|
||||
int passwordMaskDelay() const;
|
||||
QChar passwordMaskCharacter() const;
|
||||
qreal fontSmoothingGamma() const;
|
||||
|
@ -466,6 +466,8 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
|
||||
return 1.0 / NSEvent.keyRepeatInterval;
|
||||
case QPlatformTheme::ShowIconsInMenus:
|
||||
return false;
|
||||
case QPlatformTheme::MenuSelectionWraps:
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2526,9 +2526,6 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
|
||||
case SH_DialogButtonBox_ButtonsHaveIcons:
|
||||
ret = 0;
|
||||
break;
|
||||
case SH_Menu_SelectionWrap:
|
||||
ret = false;
|
||||
break;
|
||||
case SH_Menu_KeyboardSearch:
|
||||
ret = true;
|
||||
break;
|
||||
|
@ -5192,9 +5192,12 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
|
||||
ret = 75;
|
||||
break;
|
||||
|
||||
case SH_Menu_SelectionWrap:
|
||||
ret = true;
|
||||
case SH_Menu_SelectionWrap: {
|
||||
const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme();
|
||||
ret = theme ? theme->themeHint(QPlatformTheme::MenuSelectionWraps).toInt()
|
||||
: QPlatformTheme::defaultThemeHint(QPlatformTheme::MenuSelectionWraps).toInt();
|
||||
break;
|
||||
}
|
||||
|
||||
case SH_Menu_FillScreenWithScroll:
|
||||
ret = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user