Add further theme hints to QPlatformTheme.
- Add hints for QDialog/QDialogButtonBox. - Add hint for available popup-menu area. - Add keyboard scheme hint replacing QGuiApplicationPrivate::currentKeyPlatform() Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Task-number: QTBUG-24204 Task-number: QTBUG-24315 Change-Id: I6653786b0dcb49a6fc264d3b9891dbfee502bd3e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
parent
53bb87d1d2
commit
541949aed2
@ -833,7 +833,7 @@ Qt::KeyboardModifiers QKeyEvent::modifiers() const
|
|||||||
bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const
|
bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const
|
||||||
{
|
{
|
||||||
uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference
|
uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference
|
||||||
uint platform = QGuiApplicationPrivate::currentKeyPlatform();
|
const uint platform = QKeySequencePrivate::currentKeyPlatforms();
|
||||||
|
|
||||||
|
|
||||||
uint N = QKeySequencePrivate::numberOfKeyBindings;
|
uint N = QKeySequencePrivate::numberOfKeyBindings;
|
||||||
|
@ -1911,27 +1911,6 @@ QInputPanel *QGuiApplication::inputPanel() const
|
|||||||
return inputMethod();
|
return inputMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns the current platform used by keyBindings
|
|
||||||
uint QGuiApplicationPrivate::currentKeyPlatform()
|
|
||||||
{
|
|
||||||
uint platform = KB_Win;
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
platform = KB_Mac;
|
|
||||||
#elif defined Q_WS_X11 // ## TODO: detect these
|
|
||||||
platform = KB_X11;
|
|
||||||
#if 0
|
|
||||||
if (X11->desktopEnvironment == DE_KDE)
|
|
||||||
platform |= KB_KDE;
|
|
||||||
if (X11->desktopEnvironment == DE_GNOME)
|
|
||||||
platform |= KB_Gnome;
|
|
||||||
if (X11->desktopEnvironment == DE_CDE)
|
|
||||||
platform |= KB_CDE;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
return platform;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\since 4.5
|
\since 4.5
|
||||||
\fn void QGuiApplication::fontDatabaseChanged()
|
\fn void QGuiApplication::fontDatabaseChanged()
|
||||||
|
@ -89,19 +89,6 @@ public:
|
|||||||
static QPlatformTheme *platformTheme()
|
static QPlatformTheme *platformTheme()
|
||||||
{ return platform_theme; }
|
{ return platform_theme; }
|
||||||
|
|
||||||
|
|
||||||
enum KeyPlatform {
|
|
||||||
KB_Win = 1,
|
|
||||||
KB_Mac = 2,
|
|
||||||
KB_X11 = 4,
|
|
||||||
KB_KDE = 8,
|
|
||||||
KB_Gnome = 16,
|
|
||||||
KB_CDE = 32,
|
|
||||||
KB_All = 0xffff
|
|
||||||
};
|
|
||||||
|
|
||||||
static uint currentKeyPlatform();
|
|
||||||
|
|
||||||
static QAbstractEventDispatcher *qt_qpa_core_dispatcher()
|
static QAbstractEventDispatcher *qt_qpa_core_dispatcher()
|
||||||
{ return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; }
|
{ return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; }
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include "qkeysequence.h"
|
#include "qkeysequence.h"
|
||||||
#include "qkeysequence_p.h"
|
#include "qkeysequence_p.h"
|
||||||
|
#include "qplatformtheme_qpa.h"
|
||||||
#include "private/qguiapplication_p.h"
|
#include "private/qguiapplication_p.h"
|
||||||
|
|
||||||
#ifndef QT_NO_SHORTCUT
|
#ifndef QT_NO_SHORTCUT
|
||||||
@ -640,153 +641,163 @@ static const struct {
|
|||||||
//Table of key bindings. It must be sorted on key sequence.
|
//Table of key bindings. It must be sorted on key sequence.
|
||||||
//A priority of 1 indicates that this is the primary key binding when multiple are defined.
|
//A priority of 1 indicates that this is the primary key binding when multiple are defined.
|
||||||
|
|
||||||
|
enum KeyPlatform {
|
||||||
|
KB_Win = (1 << QPlatformTheme::WindowsKeyboardScheme),
|
||||||
|
KB_Mac = (1 << QPlatformTheme::MacKeyboardScheme),
|
||||||
|
KB_X11 = (1 << QPlatformTheme::X11KeyboardScheme),
|
||||||
|
KB_KDE = (1 << QPlatformTheme::KdeKeyboardScheme),
|
||||||
|
KB_Gnome = (1 << QPlatformTheme::GnomeKeyboardScheme),
|
||||||
|
KB_CDE = (1 << QPlatformTheme::CdeKeyboardScheme),
|
||||||
|
KB_All = 0xffff
|
||||||
|
};
|
||||||
|
|
||||||
const QKeyBinding QKeySequencePrivate::keyBindings[] = {
|
const QKeyBinding QKeySequencePrivate::keyBindings[] = {
|
||||||
// StandardKey Priority Key Sequence Platforms
|
// StandardKey Priority Key Sequence Platforms
|
||||||
{QKeySequence::Back, 0, Qt::Key_Backspace, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::Back, 0, Qt::Key_Backspace, KB_Win},
|
||||||
{QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, KB_All},
|
||||||
{QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, KB_All},
|
||||||
{QKeySequence::Delete, 1, Qt::Key_Delete, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Delete, 1, Qt::Key_Delete, KB_All},
|
||||||
{QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, KB_Win | KB_X11},
|
||||||
{QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, KB_Mac},
|
||||||
{QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, KB_Win | KB_X11},
|
||||||
{QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, KB_Mac},
|
||||||
{QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, KB_All},
|
||||||
{QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, KB_All},
|
||||||
{QKeySequence::MoveToNextChar, 0, Qt::Key_Right, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::MoveToNextChar, 0, Qt::Key_Right, KB_All},
|
||||||
{QKeySequence::MoveToNextLine, 0, Qt::Key_Down, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::MoveToNextLine, 0, Qt::Key_Down, KB_All},
|
||||||
{QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, KB_All},
|
||||||
{QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, KB_All},
|
||||||
{QKeySequence::HelpContents, 0, Qt::Key_F1, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::HelpContents, 0, Qt::Key_F1, KB_Win | KB_X11},
|
||||||
{QKeySequence::FindNext, 0, Qt::Key_F3, QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::FindNext, 0, Qt::Key_F3, KB_X11},
|
||||||
{QKeySequence::FindNext, 1, Qt::Key_F3, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::FindNext, 1, Qt::Key_F3, KB_Win},
|
||||||
{QKeySequence::Refresh, 0, Qt::Key_F5, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::Refresh, 0, Qt::Key_F5, KB_Win | KB_X11},
|
||||||
{QKeySequence::Undo, 0, Qt::Key_F14, QGuiApplicationPrivate::KB_X11}, //Undo on sun keyboards
|
{QKeySequence::Undo, 0, Qt::Key_F14, KB_X11}, //Undo on sun keyboards
|
||||||
{QKeySequence::Copy, 0, Qt::Key_F16, QGuiApplicationPrivate::KB_X11}, //Copy on sun keyboards
|
{QKeySequence::Copy, 0, Qt::Key_F16, KB_X11}, //Copy on sun keyboards
|
||||||
{QKeySequence::Paste, 0, Qt::Key_F18, QGuiApplicationPrivate::KB_X11}, //Paste on sun keyboards
|
{QKeySequence::Paste, 0, Qt::Key_F18, KB_X11}, //Paste on sun keyboards
|
||||||
{QKeySequence::Cut, 0, Qt::Key_F20, QGuiApplicationPrivate::KB_X11}, //Cut on sun keyboards
|
{QKeySequence::Cut, 0, Qt::Key_F20, KB_X11}, //Cut on sun keyboards
|
||||||
{QKeySequence::PreviousChild, 0, Qt::Key_Back, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::PreviousChild, 0, Qt::Key_Back, KB_All},
|
||||||
{QKeySequence::NextChild, 0, Qt::Key_Forward, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::NextChild, 0, Qt::Key_Forward, KB_All},
|
||||||
{QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, KB_Win},
|
||||||
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, KB_All},
|
||||||
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, KB_All},
|
||||||
{QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, KB_Win | KB_X11},
|
||||||
{QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, //## Check if this should work on mac
|
{QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, KB_Win | KB_X11}, //## Check if this should work on mac
|
||||||
{QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11},
|
||||||
{QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, KB_Mac},
|
||||||
{QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11},
|
||||||
{QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, KB_Mac},
|
||||||
{QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, KB_All},
|
||||||
{QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, KB_All},
|
||||||
{QKeySequence::SelectNextChar, 0, Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::SelectNextChar, 0, Qt::SHIFT | Qt::Key_Right, KB_All},
|
||||||
{QKeySequence::SelectNextLine, 0, Qt::SHIFT | Qt::Key_Down, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::SelectNextLine, 0, Qt::SHIFT | Qt::Key_Down, KB_All},
|
||||||
{QKeySequence::SelectPreviousPage, 0, Qt::SHIFT | Qt::Key_PageUp, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::SelectPreviousPage, 0, Qt::SHIFT | Qt::Key_PageUp, KB_All},
|
||||||
{QKeySequence::SelectNextPage, 0, Qt::SHIFT | Qt::Key_PageDown, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::SelectNextPage, 0, Qt::SHIFT | Qt::Key_PageDown, KB_All},
|
||||||
{QKeySequence::WhatsThis, 1, Qt::SHIFT | Qt::Key_F1, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::WhatsThis, 1, Qt::SHIFT | Qt::Key_F1, KB_All},
|
||||||
{QKeySequence::FindPrevious, 0, Qt::SHIFT | Qt::Key_F3, QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::FindPrevious, 0, Qt::SHIFT | Qt::Key_F3, KB_X11},
|
||||||
{QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, KB_Win},
|
||||||
{QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, KB_All},
|
||||||
{QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, QGuiApplicationPrivate::KB_KDE},
|
{QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, KB_KDE},
|
||||||
{QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, KB_Mac},
|
||||||
{QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, KB_All},
|
||||||
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, QGuiApplicationPrivate::KB_KDE},
|
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, KB_KDE},
|
||||||
{QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, KB_Mac},
|
||||||
{QKeySequence::SelectAll, 1, Qt::CTRL | Qt::Key_A, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::SelectAll, 1, Qt::CTRL | Qt::Key_A, KB_All},
|
||||||
{QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, KB_All},
|
||||||
{QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, KB_All},
|
||||||
{QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, QGuiApplicationPrivate::KB_X11}, //emacs (line edit only)
|
{QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, KB_X11}, //emacs (line edit only)
|
||||||
{QKeySequence::Find, 0, Qt::CTRL | Qt::Key_F, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Find, 0, Qt::CTRL | Qt::Key_F, KB_All},
|
||||||
{QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, KB_Gnome | KB_Mac},
|
||||||
{QKeySequence::FindNext, 0, Qt::CTRL | Qt::Key_G, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::FindNext, 0, Qt::CTRL | Qt::Key_G, KB_Win},
|
||||||
{QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, KB_Win},
|
||||||
{QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, QGuiApplicationPrivate::KB_Gnome},
|
{QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, KB_Gnome},
|
||||||
{QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, KB_All},
|
||||||
{QKeySequence::DeleteEndOfLine, 0, Qt::CTRL | Qt::Key_K, QGuiApplicationPrivate::KB_X11}, //emacs (line edit only)
|
{QKeySequence::DeleteEndOfLine, 0, Qt::CTRL | Qt::Key_K, KB_X11}, //emacs (line edit only)
|
||||||
{QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, KB_All},
|
||||||
{QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, KB_All},
|
||||||
{QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, KB_All},
|
||||||
{QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_KDE | QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, KB_Gnome | KB_KDE | KB_Mac},
|
||||||
{QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, KB_Gnome | KB_Mac},
|
||||||
{QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, QGuiApplicationPrivate::KB_KDE},
|
{QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, KB_KDE},
|
||||||
{QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, KB_All},
|
||||||
{QKeySequence::AddTab, 0, Qt::CTRL | Qt::Key_T, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::AddTab, 0, Qt::CTRL | Qt::Key_T, KB_All},
|
||||||
{QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, KB_All},
|
||||||
{QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, KB_All},
|
||||||
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, KB_Win | KB_X11},
|
||||||
{QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, KB_Mac},
|
||||||
{QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, KB_All},
|
||||||
{QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, KB_Win},
|
||||||
{QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, QGuiApplicationPrivate::KB_All},
|
{QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, KB_All},
|
||||||
{QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, KB_Mac},
|
||||||
{QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, KB_Mac},
|
||||||
{QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::Key_BraceLeft, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::Key_BraceLeft, KB_Mac},
|
||||||
{QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_BraceRight, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_BraceRight, KB_Mac},
|
||||||
{QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, KB_Win | KB_X11},
|
||||||
{QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Tab, QGuiApplicationPrivate::KB_Mac}, //different priority from above
|
{QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Tab, KB_Mac}, //different priority from above
|
||||||
{QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, KB_X11 | KB_Win},
|
||||||
{QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, KB_X11 | KB_Win},
|
||||||
{QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, KB_X11 | KB_Win},
|
||||||
{QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, KB_Win | KB_X11},
|
||||||
{QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, KB_Win | KB_X11},
|
||||||
{QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, KB_Mac},
|
||||||
{QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, KB_Win | KB_X11},
|
||||||
{QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac },
|
{QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, KB_Mac },
|
||||||
{QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, KB_Mac},
|
||||||
{QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, KB_Mac},
|
||||||
{QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac },
|
{QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, KB_Mac },
|
||||||
{QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, KB_Win | KB_X11},
|
||||||
{QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, KB_Mac},
|
||||||
{QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, KB_Win},
|
||||||
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, KB_Mac},
|
||||||
{QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, KB_Win},
|
||||||
{QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Gnome | KB_Mac},
|
||||||
{QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Win},
|
||||||
{QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, QGuiApplicationPrivate::KB_KDE},
|
{QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, KB_KDE},
|
||||||
{QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, KB_Gnome | KB_Mac},
|
||||||
{QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, KB_Win | KB_X11},
|
||||||
{QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, KB_Mac},
|
||||||
{QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, KB_Win | KB_X11},
|
||||||
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QGuiApplicationPrivate::KB_Mac },//different priority from above
|
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, KB_Mac },//different priority from above
|
||||||
{QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, KB_X11},
|
||||||
{QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11},
|
||||||
{QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11},
|
||||||
{QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, KB_Win | KB_X11},
|
||||||
{QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac },
|
{QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, KB_Mac },
|
||||||
{QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, KB_Mac},
|
||||||
{QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Win | KB_X11},
|
||||||
{QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac },
|
{QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Mac },
|
||||||
{QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, KB_Mac},
|
||||||
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, KB_Win},
|
||||||
{QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, KB_Win},
|
||||||
{QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, KB_Mac},
|
||||||
{QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, KB_Mac},
|
||||||
{QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, KB_Win | KB_X11},
|
||||||
{QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, KB_Mac},
|
||||||
{QKeySequence::MoveToStartOfBlock, 0, Qt::ALT | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac}, //mac only
|
{QKeySequence::MoveToStartOfBlock, 0, Qt::ALT | Qt::Key_Up, KB_Mac}, //mac only
|
||||||
{QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, KB_Mac},
|
||||||
{QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
|
{QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, KB_Win | KB_X11},
|
||||||
{QKeySequence::MoveToEndOfBlock, 0, Qt::ALT | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac}, //mac only
|
{QKeySequence::MoveToEndOfBlock, 0, Qt::ALT | Qt::Key_Down, KB_Mac}, //mac only
|
||||||
{QKeySequence::MoveToPreviousPage, 0, Qt::ALT | Qt::Key_PageUp, QGuiApplicationPrivate::KB_Mac },
|
{QKeySequence::MoveToPreviousPage, 0, Qt::ALT | Qt::Key_PageUp, KB_Mac },
|
||||||
{QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, QGuiApplicationPrivate::KB_Mac },
|
{QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, KB_Mac },
|
||||||
{QKeySequence::Redo, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Backspace,QGuiApplicationPrivate::KB_Win},
|
{QKeySequence::Redo, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Backspace,KB_Win},
|
||||||
{QKeySequence::SelectPreviousWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::SelectPreviousWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Left, KB_Mac},
|
||||||
{QKeySequence::SelectStartOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac}, //mac only
|
{QKeySequence::SelectStartOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Up, KB_Mac}, //mac only
|
||||||
{QKeySequence::SelectNextWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::SelectNextWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Right, KB_Mac},
|
||||||
{QKeySequence::SelectEndOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac}, //mac only
|
{QKeySequence::SelectEndOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Down, KB_Mac}, //mac only
|
||||||
{QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, KB_Mac},
|
||||||
{QKeySequence::Delete, 0, Qt::META | Qt::Key_D, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::Delete, 0, Qt::META | Qt::Key_D, KB_Mac},
|
||||||
{QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, KB_Mac},
|
||||||
{QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, KB_Mac},
|
||||||
{QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Enter, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Enter, KB_Mac},
|
||||||
{QKeySequence::MoveToStartOfLine, 0, Qt::META | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToStartOfLine, 0, Qt::META | Qt::Key_Left, KB_Mac},
|
||||||
{QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_Up, KB_Mac},
|
||||||
{QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, KB_Mac},
|
||||||
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, KB_Mac},
|
||||||
{QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, KB_Mac},
|
||||||
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, KB_Mac},
|
||||||
{QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, KB_Mac},
|
||||||
{QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, KB_Mac},
|
||||||
{QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
|
{QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, KB_Mac},
|
||||||
{QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac}
|
{QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac}
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate::keyBindings)/(sizeof(QKeyBinding));
|
const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate::keyBindings)/(sizeof(QKeyBinding));
|
||||||
@ -991,7 +1002,7 @@ static inline int maybeSwapShortcut(int shortcut)
|
|||||||
*/
|
*/
|
||||||
QList<QKeySequence> QKeySequence::keyBindings(StandardKey key)
|
QList<QKeySequence> QKeySequence::keyBindings(StandardKey key)
|
||||||
{
|
{
|
||||||
uint platform = QGuiApplicationPrivate::currentKeyPlatform();
|
const uint platform = QKeySequencePrivate::currentKeyPlatforms();
|
||||||
QList <QKeySequence> list;
|
QList <QKeySequence> list;
|
||||||
for (uint i = 0; i < QKeySequencePrivate::numberOfKeyBindings ; ++i) {
|
for (uint i = 0; i < QKeySequencePrivate::numberOfKeyBindings ; ++i) {
|
||||||
QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i];
|
QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i];
|
||||||
@ -1330,6 +1341,19 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned QKeySequencePrivate::currentKeyPlatforms()
|
||||||
|
{
|
||||||
|
int keyboardScheme = QPlatformTheme::WindowsKeyboardScheme;
|
||||||
|
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
||||||
|
keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
|
||||||
|
unsigned result = 1u << keyboardScheme;
|
||||||
|
if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
|
||||||
|
|| keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
|
||||||
|
|| keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
|
||||||
|
result |= KB_X11;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Creates a shortcut string for \a key. For example,
|
Creates a shortcut string for \a key. For example,
|
||||||
Qt::CTRL+Qt::Key_O gives "Ctrl+O". The strings, "Ctrl", "Shift", etc. are
|
Qt::CTRL+Qt::Key_O gives "Ctrl+O". The strings, "Ctrl", "Shift", etc. are
|
||||||
|
@ -88,6 +88,7 @@ public:
|
|||||||
static const QKeyBinding keyBindings[];
|
static const QKeyBinding keyBindings[];
|
||||||
static const uint numberOfKeyBindings;
|
static const uint numberOfKeyBindings;
|
||||||
|
|
||||||
|
static unsigned currentKeyPlatforms();
|
||||||
};
|
};
|
||||||
#endif // QT_NO_SHORTCUT
|
#endif // QT_NO_SHORTCUT
|
||||||
|
|
||||||
|
@ -84,6 +84,20 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
\value StyleNames (QStringList) A list of preferred style names.
|
\value StyleNames (QStringList) A list of preferred style names.
|
||||||
|
|
||||||
|
\value WindowAutoPlacement (bool) A boolean value indicating whether Windows
|
||||||
|
(particularly dialogs) are placed by the system
|
||||||
|
(see _NET_WM_FULL_PLACEMENT in X11).
|
||||||
|
|
||||||
|
\value DialogButtonBoxLayout (int) An integer representing a
|
||||||
|
QDialogButtonBox::ButtonLayout value.
|
||||||
|
|
||||||
|
\value DialogButtonBoxButtonsHaveIcons (bool) A boolean value indicating whether
|
||||||
|
the buttons of a QDialogButtonBox should have icons.
|
||||||
|
|
||||||
|
\value UseFullScreenForPopupMenu (bool) Pop menus can cover the full screen including task bar.
|
||||||
|
|
||||||
|
\value KeyboardScheme (int) An integer value (enum KeyboardSchemes) specifying the
|
||||||
|
keyboard scheme.
|
||||||
|
|
||||||
\sa themeHint(), QStyle::pixelMetric()
|
\sa themeHint(), QStyle::pixelMetric()
|
||||||
*/
|
*/
|
||||||
@ -121,6 +135,14 @@ const QPalette *QPlatformTheme::palette(Palette type) const
|
|||||||
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
|
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
|
||||||
{
|
{
|
||||||
switch (hint) {
|
switch (hint) {
|
||||||
|
case QPlatformTheme::UseFullScreenForPopupMenu:
|
||||||
|
return QVariant(false);
|
||||||
|
case QPlatformTheme::WindowAutoPlacement:
|
||||||
|
return QVariant(false);
|
||||||
|
case QPlatformTheme::DialogButtonBoxLayout:
|
||||||
|
return QVariant(int(0));
|
||||||
|
case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
|
||||||
|
return QVariant(false);
|
||||||
case QPlatformTheme::ItemViewActivateItemOnSingleClick:
|
case QPlatformTheme::ItemViewActivateItemOnSingleClick:
|
||||||
return QVariant(false);
|
return QVariant(false);
|
||||||
case QPlatformTheme::ToolButtonStyle:
|
case QPlatformTheme::ToolButtonStyle:
|
||||||
@ -140,6 +162,8 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const
|
|||||||
return QVariant(false);
|
return QVariant(false);
|
||||||
case MaximumScrollBarDragDistance:
|
case MaximumScrollBarDragDistance:
|
||||||
return QVariant(-1);
|
return QVariant(-1);
|
||||||
|
case KeyboardScheme:
|
||||||
|
return QVariant(int(WindowsKeyboardScheme));
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,12 @@ public:
|
|||||||
SystemIconThemeName,
|
SystemIconThemeName,
|
||||||
SystemIconFallbackThemeName,
|
SystemIconFallbackThemeName,
|
||||||
IconThemeSearchPaths,
|
IconThemeSearchPaths,
|
||||||
StyleNames
|
StyleNames,
|
||||||
|
WindowAutoPlacement,
|
||||||
|
DialogButtonBoxLayout,
|
||||||
|
DialogButtonBoxButtonsHaveIcons,
|
||||||
|
UseFullScreenForPopupMenu,
|
||||||
|
KeyboardScheme
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DialogType {
|
enum DialogType {
|
||||||
@ -84,6 +89,16 @@ public:
|
|||||||
NPalettes
|
NPalettes
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum KeyboardSchemes
|
||||||
|
{
|
||||||
|
WindowsKeyboardScheme,
|
||||||
|
MacKeyboardScheme,
|
||||||
|
X11KeyboardScheme,
|
||||||
|
KdeKeyboardScheme,
|
||||||
|
GnomeKeyboardScheme,
|
||||||
|
CdeKeyboardScheme
|
||||||
|
};
|
||||||
|
|
||||||
virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const;
|
virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const;
|
||||||
virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const;
|
virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const;
|
||||||
|
|
||||||
|
@ -89,12 +89,15 @@ QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const
|
|||||||
return QVariant(QString(QStringLiteral("hicolor")));
|
return QVariant(QString(QStringLiteral("hicolor")));
|
||||||
case QPlatformTheme::IconThemeSearchPaths:
|
case QPlatformTheme::IconThemeSearchPaths:
|
||||||
return xdgIconThemePaths();
|
return xdgIconThemePaths();
|
||||||
|
case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
|
||||||
|
return QVariant(true);
|
||||||
case QPlatformTheme::StyleNames: {
|
case QPlatformTheme::StyleNames: {
|
||||||
QStringList styleNames;
|
QStringList styleNames;
|
||||||
styleNames << QStringLiteral("Plastique") << QStringLiteral("Windows");
|
styleNames << QStringLiteral("Plastique") << QStringLiteral("Windows");
|
||||||
return QVariant(styleNames);
|
return QVariant(styleNames);
|
||||||
}
|
}
|
||||||
break;
|
case QPlatformTheme::KeyboardScheme:
|
||||||
|
return QVariant(int(X11KeyboardScheme));
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -229,6 +232,12 @@ static QStringList kdeIconThemeSearchPaths(const QString &kdeHome)
|
|||||||
QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
|
QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
|
||||||
{
|
{
|
||||||
switch (hint) {
|
switch (hint) {
|
||||||
|
case QPlatformTheme::UseFullScreenForPopupMenu:
|
||||||
|
return QVariant(true);
|
||||||
|
case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
|
||||||
|
return QVariant(true);
|
||||||
|
case QPlatformTheme::DialogButtonBoxLayout:
|
||||||
|
return QVariant(2); // QDialogButtonBox::KdeLayout
|
||||||
case QPlatformTheme::ToolButtonStyle:
|
case QPlatformTheme::ToolButtonStyle:
|
||||||
return QVariant(m_toolButtonStyle);
|
return QVariant(m_toolButtonStyle);
|
||||||
case QPlatformTheme::ToolBarIconSize:
|
case QPlatformTheme::ToolBarIconSize:
|
||||||
@ -241,6 +250,8 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
|
|||||||
return QVariant(kdeIconThemeSearchPaths(m_kdeHome));
|
return QVariant(kdeIconThemeSearchPaths(m_kdeHome));
|
||||||
case QPlatformTheme::StyleNames:
|
case QPlatformTheme::StyleNames:
|
||||||
return QVariant(m_styleNames);
|
return QVariant(m_styleNames);
|
||||||
|
case QPlatformTheme::KeyboardScheme:
|
||||||
|
return QVariant(int(KdeKeyboardScheme));
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -282,6 +293,10 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
|
|||||||
QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
|
QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
|
||||||
{
|
{
|
||||||
switch (hint) {
|
switch (hint) {
|
||||||
|
case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
|
||||||
|
return QVariant(true);
|
||||||
|
case QPlatformTheme::DialogButtonBoxLayout:
|
||||||
|
return QVariant(3); // QDialogButtonBox::GnomeLayout
|
||||||
case QPlatformTheme::SystemIconThemeName:
|
case QPlatformTheme::SystemIconThemeName:
|
||||||
case QPlatformTheme::SystemIconFallbackThemeName:
|
case QPlatformTheme::SystemIconFallbackThemeName:
|
||||||
return QVariant(QString(QStringLiteral("gnome")));
|
return QVariant(QString(QStringLiteral("gnome")));
|
||||||
@ -292,6 +307,8 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
|
|||||||
styleNames << QStringLiteral("GTK+") << QStringLiteral("cleanlooks") << QStringLiteral("windows");
|
styleNames << QStringLiteral("GTK+") << QStringLiteral("cleanlooks") << QStringLiteral("windows");
|
||||||
return QVariant(styleNames);
|
return QVariant(styleNames);
|
||||||
}
|
}
|
||||||
|
case QPlatformTheme::KeyboardScheme:
|
||||||
|
return QVariant(int(GnomeKeyboardScheme));
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -105,13 +105,16 @@ QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialo
|
|||||||
QVariant QCocoaTheme::themeHint(ThemeHint hint) const
|
QVariant QCocoaTheme::themeHint(ThemeHint hint) const
|
||||||
{
|
{
|
||||||
switch (hint) {
|
switch (hint) {
|
||||||
case QPlatformTheme::StyleNames:
|
case QPlatformTheme::StyleNames:
|
||||||
return QStringList() << QLatin1Literal("macintosh");
|
return QStringList(QStringLiteral("macintosh"));
|
||||||
break;
|
case QPlatformTheme::DialogButtonBoxLayout:
|
||||||
default:
|
return QVariant(1); // QDialogButtonBox::MacLayout
|
||||||
return QPlatformTheme::themeHint(hint);
|
case KeyboardScheme:
|
||||||
|
return QVariant(int(MacKeyboardScheme));
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return QPlatformTheme::themeHint(hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -220,11 +220,12 @@ static inline QStringList styleNames()
|
|||||||
QVariant QWindowsTheme::themeHint(ThemeHint hint) const
|
QVariant QWindowsTheme::themeHint(ThemeHint hint) const
|
||||||
{
|
{
|
||||||
switch (hint) {
|
switch (hint) {
|
||||||
case SystemIconThemeName:
|
case UseFullScreenForPopupMenu:
|
||||||
break;
|
return QVariant(true);
|
||||||
|
case DialogButtonBoxLayout:
|
||||||
|
return QVariant(int(0)); // QDialogButtonBox::WinLayout
|
||||||
case IconThemeSearchPaths:
|
case IconThemeSearchPaths:
|
||||||
return QVariant(iconThemeSearchPaths());
|
return QVariant(iconThemeSearchPaths());
|
||||||
break;
|
|
||||||
case StyleNames:
|
case StyleNames:
|
||||||
return QVariant(styleNames());
|
return QVariant(styleNames());
|
||||||
case TextCursorWidth:
|
case TextCursorWidth:
|
||||||
@ -233,8 +234,12 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const
|
|||||||
return QVariant(booleanSystemParametersInfo(SPI_GETDROPSHADOW, false));
|
return QVariant(booleanSystemParametersInfo(SPI_GETDROPSHADOW, false));
|
||||||
case MaximumScrollBarDragDistance:
|
case MaximumScrollBarDragDistance:
|
||||||
return QVariant(qRound(qreal(QWindowsContext::instance()->defaultDPI()) * 1.375));
|
return QVariant(qRound(qreal(QWindowsContext::instance()->defaultDPI()) * 1.375));
|
||||||
|
case KeyboardScheme:
|
||||||
|
return QVariant(int(WindowsKeyboardScheme));
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QPlatformTheme::themeHint(hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWindowsTheme::refresh()
|
void QWindowsTheme::refresh()
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
#include "qplatformtheme_qpa.h"
|
#include "qplatformtheme_qpa.h"
|
||||||
#include "private/qdialog_p.h"
|
#include "private/qdialog_p.h"
|
||||||
#include "private/qguiapplication_p.h"
|
#include "private/qguiapplication_p.h"
|
||||||
|
#include "qplatformtheme_qpa.h"
|
||||||
#ifndef QT_NO_ACCESSIBILITY
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
#include "qaccessible.h"
|
#include "qaccessible.h"
|
||||||
#endif
|
#endif
|
||||||
@ -790,11 +791,10 @@ void QDialog::showEvent(QShowEvent *event)
|
|||||||
/*! \internal */
|
/*! \internal */
|
||||||
void QDialog::adjustPosition(QWidget* w)
|
void QDialog::adjustPosition(QWidget* w)
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_X11
|
|
||||||
// if the WM advertises that it will place the windows properly for us, let it do it :)
|
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
||||||
if (X11->isSupportedByWM(ATOM(_NET_WM_FULL_PLACEMENT)))
|
if (theme->themeHint(QPlatformTheme::WindowAutoPlacement).toBool())
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
QPoint p(0, 0);
|
QPoint p(0, 0);
|
||||||
int extraw = 0, extrah = 0, scrn = 0;
|
int extraw = 0, extrah = 0, scrn = 0;
|
||||||
if (w)
|
if (w)
|
||||||
|
@ -60,11 +60,6 @@
|
|||||||
#include <private/qt_cocoa_helpers_mac_p.h>
|
#include <private/qt_cocoa_helpers_mac_p.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
|
||||||
#include "private/qt_x11_p.h"
|
|
||||||
#include "private/qkde_p.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "private/qhexstring_p.h"
|
#include "private/qhexstring_p.h"
|
||||||
|
|
||||||
#ifndef QT_NO_ICON
|
#ifndef QT_NO_ICON
|
||||||
|
@ -83,12 +83,6 @@
|
|||||||
# include "private/qtextengine_p.h"
|
# include "private/qtextengine_p.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
|
||||||
# include <private/qt_x11_p.h>
|
|
||||||
#elif defined(Q_WS_MAC)
|
|
||||||
# include <private/qt_cocoa_helpers_mac_p.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <private/qstylehelper_p.h>
|
#include <private/qstylehelper_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -4920,12 +4914,8 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
|
|||||||
break;
|
break;
|
||||||
case SH_DialogButtonLayout:
|
case SH_DialogButtonLayout:
|
||||||
ret = QDialogButtonBox::WinLayout;
|
ret = QDialogButtonBox::WinLayout;
|
||||||
#ifdef Q_WS_X11
|
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
||||||
if (X11->desktopEnvironment == DE_KDE)
|
ret = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt();
|
||||||
ret = QDialogButtonBox::KdeLayout;
|
|
||||||
else if (X11->desktopEnvironment == DE_GNOME)
|
|
||||||
ret = QDialogButtonBox::GnomeLayout;
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case SH_ComboBox_PopupFrameStyle:
|
case SH_ComboBox_PopupFrameStyle:
|
||||||
ret = QFrame::StyledPanel | QFrame::Plain;
|
ret = QFrame::StyledPanel | QFrame::Plain;
|
||||||
@ -4934,10 +4924,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
|
|||||||
ret = Qt::LinksAccessibleByMouse;
|
ret = Qt::LinksAccessibleByMouse;
|
||||||
break;
|
break;
|
||||||
case SH_DialogButtonBox_ButtonsHaveIcons:
|
case SH_DialogButtonBox_ButtonsHaveIcons:
|
||||||
#ifdef Q_WS_X11
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
||||||
|
ret = theme->themeHint(QPlatformTheme::DialogButtonBoxButtonsHaveIcons).toBool() ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
case SH_SpellCheckUnderlineStyle:
|
case SH_SpellCheckUnderlineStyle:
|
||||||
ret = QTextCharFormat::WaveUnderline;
|
ret = QTextCharFormat::WaveUnderline;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qkeysequence
|
TARGET = tst_qkeysequence
|
||||||
|
|
||||||
QT += widgets widgets-private testlib
|
QT += widgets testlib
|
||||||
QT += core-private gui-private
|
QT += core-private gui-private
|
||||||
|
|
||||||
SOURCES += tst_qkeysequence.cpp
|
SOURCES += tst_qkeysequence.cpp
|
||||||
|
@ -41,9 +41,10 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
#include <private/qapplication_p.h>
|
|
||||||
#include <qkeysequence.h>
|
#include <qkeysequence.h>
|
||||||
|
#include <qplatformtheme_qpa.h>
|
||||||
#include <private/qkeysequence_p.h>
|
#include <private/qkeysequence_p.h>
|
||||||
|
#include <private/qguiapplication_p.h>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
|
|
||||||
@ -142,6 +143,7 @@ private slots:
|
|||||||
|
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
private:
|
private:
|
||||||
|
int m_keyboardScheme;
|
||||||
QTranslator *ourTranslator;
|
QTranslator *ourTranslator;
|
||||||
QTranslator *qtTranslator;
|
QTranslator *qtTranslator;
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
@ -161,8 +163,10 @@ const QString tst_QKeySequence::MacAlt = QString(QChar(0x2325));
|
|||||||
const QString tst_QKeySequence::MacShift = QString(QChar(0x21E7));
|
const QString tst_QKeySequence::MacShift = QString(QChar(0x21E7));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tst_QKeySequence::tst_QKeySequence()
|
tst_QKeySequence::tst_QKeySequence() : m_keyboardScheme(QPlatformTheme::WindowsKeyboardScheme)
|
||||||
{
|
{
|
||||||
|
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
||||||
|
m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
tst_QKeySequence::~tst_QKeySequence()
|
tst_QKeySequence::~tst_QKeySequence()
|
||||||
@ -297,8 +301,7 @@ void tst_QKeySequence::checkMultipleCodes()
|
|||||||
*/
|
*/
|
||||||
void tst_QKeySequence::ensureSorted()
|
void tst_QKeySequence::ensureSorted()
|
||||||
{
|
{
|
||||||
//### accessing static members from private classes does not work on msvc at the moment
|
#if defined(QT_BUILD_INTERNAL)
|
||||||
#if defined(QT_BUILD_INTERNAL) && !defined(Q_WS_WIN)
|
|
||||||
uint N = QKeySequencePrivate::numberOfKeyBindings;
|
uint N = QKeySequencePrivate::numberOfKeyBindings;
|
||||||
uint val = QKeySequencePrivate::keyBindings[0].shortcut;
|
uint val = QKeySequencePrivate::keyBindings[0].shortcut;
|
||||||
for ( uint i = 1 ; i < N ; ++i) {
|
for ( uint i = 1 ; i < N ; ++i) {
|
||||||
@ -322,13 +325,13 @@ void tst_QKeySequence::standardKeys_data()
|
|||||||
QTest::newRow("delete") << (int)QKeySequence::Delete<< QString("DEL");
|
QTest::newRow("delete") << (int)QKeySequence::Delete<< QString("DEL");
|
||||||
QTest::newRow("open") << (int)QKeySequence::Open << QString("CTRL+O");
|
QTest::newRow("open") << (int)QKeySequence::Open << QString("CTRL+O");
|
||||||
QTest::newRow("find") << (int)QKeySequence::Find<< QString("CTRL+F");
|
QTest::newRow("find") << (int)QKeySequence::Find<< QString("CTRL+F");
|
||||||
#ifdef Q_WS_WIN
|
if (m_keyboardScheme == QPlatformTheme::WindowsKeyboardScheme) {
|
||||||
QTest::newRow("addTab") << (int)QKeySequence::AddTab<< QString("CTRL+T");
|
QTest::newRow("addTab") << (int)QKeySequence::AddTab<< QString("CTRL+T");
|
||||||
QTest::newRow("findNext") << (int)QKeySequence::FindNext<< QString("F3");
|
QTest::newRow("findNext") << (int)QKeySequence::FindNext<< QString("F3");
|
||||||
QTest::newRow("findPrevious") << (int)QKeySequence::FindPrevious << QString("SHIFT+F3");
|
QTest::newRow("findPrevious") << (int)QKeySequence::FindPrevious << QString("SHIFT+F3");
|
||||||
QTest::newRow("close") << (int)QKeySequence::Close<< QString("CTRL+F4");
|
QTest::newRow("close") << (int)QKeySequence::Close<< QString("CTRL+F4");
|
||||||
QTest::newRow("replace") << (int)QKeySequence::Replace<< QString("CTRL+H");
|
QTest::newRow("replace") << (int)QKeySequence::Replace<< QString("CTRL+H");
|
||||||
#endif
|
}
|
||||||
QTest::newRow("bold") << (int)QKeySequence::Bold << QString("CTRL+B");
|
QTest::newRow("bold") << (int)QKeySequence::Bold << QString("CTRL+B");
|
||||||
QTest::newRow("italic") << (int)QKeySequence::Italic << QString("CTRL+I");
|
QTest::newRow("italic") << (int)QKeySequence::Italic << QString("CTRL+I");
|
||||||
QTest::newRow("underline") << (int)QKeySequence::Underline << QString("CTRL+U");
|
QTest::newRow("underline") << (int)QKeySequence::Underline << QString("CTRL+U");
|
||||||
@ -362,23 +365,33 @@ void tst_QKeySequence::standardKeys()
|
|||||||
{
|
{
|
||||||
QFETCH(int, standardKey);
|
QFETCH(int, standardKey);
|
||||||
QFETCH(QString, expected);
|
QFETCH(QString, expected);
|
||||||
QKeySequence ks((QKeySequence::StandardKey)standardKey);
|
QKeySequence actualKeySequence((QKeySequence::StandardKey)standardKey);
|
||||||
QKeySequence ks2(expected);
|
QKeySequence expectedKeySequence(expected);
|
||||||
QVERIFY(ks == ks2);
|
QVERIFY2(actualKeySequence == expectedKeySequence,
|
||||||
|
qPrintable(QString::fromLatin1("Key mismatch, expected '%1', got '%2' for standard key %3").
|
||||||
|
arg(expected, actualKeySequence.toString()).arg(standardKey)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QKeySequence::keyBindings()
|
void tst_QKeySequence::keyBindings()
|
||||||
{
|
{
|
||||||
QList<QKeySequence> bindings = QKeySequence::keyBindings(QKeySequence::Copy);
|
const QList<QKeySequence> bindings =
|
||||||
|
QKeySequence::keyBindings(QKeySequence::Copy);
|
||||||
|
|
||||||
QList<QKeySequence> expected;
|
QList<QKeySequence> expected;
|
||||||
#if defined(Q_OS_MAC)
|
const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C"));
|
||||||
expected << QKeySequence("CTRL+C");
|
const QKeySequence ctrlInsert = QKeySequence(QStringLiteral("CTRL+INSERT"));
|
||||||
#elif defined Q_WS_X11
|
switch (m_keyboardScheme) {
|
||||||
expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT");
|
case QPlatformTheme::MacKeyboardScheme:
|
||||||
#else
|
expected << ctrlC;
|
||||||
expected << QKeySequence("CTRL+C") << QKeySequence("CTRL+INSERT");
|
break;
|
||||||
#endif
|
case QPlatformTheme::WindowsKeyboardScheme:
|
||||||
QVERIFY(bindings == expected);
|
expected << ctrlC << ctrlInsert;
|
||||||
|
break;
|
||||||
|
default: // X11
|
||||||
|
expected << ctrlC << QKeySequence(QStringLiteral("F16")) << ctrlInsert;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
QCOMPARE(bindings, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QKeySequence::mnemonic_data()
|
void tst_QKeySequence::mnemonic_data()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_languagechange
|
TARGET = tst_languagechange
|
||||||
QT += widgets core-private testlib
|
QT += widgets core-private gui-private testlib
|
||||||
SOURCES += tst_languagechange.cpp
|
SOURCES += tst_languagechange.cpp
|
||||||
|
@ -43,13 +43,16 @@
|
|||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
|
#include <private/qguiapplication_p.h>
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
#include <QtCore/QTranslator>
|
#include <QtCore/QTranslator>
|
||||||
#include <QtCore/QTemporaryDir>
|
#include <QtCore/QTemporaryDir>
|
||||||
#include <private/qthread_p.h>
|
#include <private/qthread_p.h>
|
||||||
|
#include <QtGui/QPlatformTheme>
|
||||||
#include <QtWidgets/QInputDialog>
|
#include <QtWidgets/QInputDialog>
|
||||||
#include <QtWidgets/QColorDialog>
|
#include <QtWidgets/QColorDialog>
|
||||||
|
#include <QtWidgets/QDialogButtonBox>
|
||||||
#include <QtWidgets/QFileDialog>
|
#include <QtWidgets/QFileDialog>
|
||||||
#include <QtWidgets/QDesktopWidget>
|
#include <QtWidgets/QDesktopWidget>
|
||||||
|
|
||||||
@ -66,12 +69,16 @@ private slots:
|
|||||||
void retranslatability_data();
|
void retranslatability_data();
|
||||||
void retranslatability();
|
void retranslatability();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QDialogButtonBox::ButtonLayout m_layout;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
tst_languageChange::tst_languageChange()
|
tst_languageChange::tst_languageChange() :
|
||||||
|
m_layout(QDialogButtonBox::WinLayout)
|
||||||
{
|
{
|
||||||
|
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
||||||
|
m_layout = static_cast<QDialogButtonBox::ButtonLayout>(theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_languageChange::initTestCase()
|
void tst_languageChange::initTestCase()
|
||||||
@ -240,6 +247,9 @@ void tst_languageChange::retranslatability()
|
|||||||
QFETCH( int, dialogType);
|
QFETCH( int, dialogType);
|
||||||
QFETCH( TranslationSet, expected);
|
QFETCH( TranslationSet, expected);
|
||||||
|
|
||||||
|
if (m_layout == QDialogButtonBox::GnomeLayout)
|
||||||
|
QSKIP("The input data are not suitable for this layout (QDialogButtonBox::GnomeLayout)");
|
||||||
|
|
||||||
// This will always be queried for when a language changes
|
// This will always be queried for when a language changes
|
||||||
expected.insert("QCoreApplication::QT_LAYOUT_DIRECTION::Translate this string to the string 'LTR' in left-to-right "
|
expected.insert("QCoreApplication::QT_LAYOUT_DIRECTION::Translate this string to the string 'LTR' in left-to-right "
|
||||||
"languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to "
|
"languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to "
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET = tst_qmessagebox
|
TARGET = tst_qmessagebox
|
||||||
QT += widgets testlib
|
QT += gui-private core-private widgets testlib
|
||||||
DEPENDPATH += .
|
DEPENDPATH += .
|
||||||
INCLUDEPATH += .
|
INCLUDEPATH += .
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
#include <QPlatformTheme>
|
||||||
|
#include <private/qguiapplication_p.h>
|
||||||
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
|
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
|
||||||
#include <QMacStyle>
|
#include <QMacStyle>
|
||||||
#endif
|
#endif
|
||||||
@ -407,15 +409,12 @@ void tst_QMessageBox::staticSourceCompat()
|
|||||||
sendKeySoon();
|
sendKeySoon();
|
||||||
ret = QMessageBox::information(0, "title", "text", QMessageBox::Yes, QMessageBox::No);
|
ret = QMessageBox::information(0, "title", "text", QMessageBox::Yes, QMessageBox::No);
|
||||||
int expectedButton = int(QMessageBox::Yes);
|
int expectedButton = int(QMessageBox::Yes);
|
||||||
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
|
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
|
||||||
if (qobject_cast<QMacStyle *>(qApp->style()))
|
const int dialogButtonBoxLayout = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt();
|
||||||
expectedButton = int(QMessageBox::No);
|
if (dialogButtonBoxLayout == QDialogButtonBox::MacLayout
|
||||||
#elif !defined(QT_NO_STYLE_CLEANLOOKS)
|
|| dialogButtonBoxLayout == QDialogButtonBox::GnomeLayout)
|
||||||
if (qobject_cast<QCleanlooksStyle *>(qApp->style())) {
|
expectedButton = int(QMessageBox::No);
|
||||||
QEXPECT_FAIL("", "Special handling of QMessageBox::information buttons for Cleanlooks not implemented yet, QTBUG-24315", Continue);
|
|
||||||
expectedButton = int(QMessageBox::No);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
QCOMPARE(ret, expectedButton);
|
QCOMPARE(ret, expectedButton);
|
||||||
QCOMPARE(keyToSend, -1);
|
QCOMPARE(keyToSend, -1);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CONFIG += testcase
|
CONFIG += testcase
|
||||||
TARGET = tst_qaction
|
TARGET = tst_qaction
|
||||||
QT += widgets testlib
|
QT += gui-private core-private widgets testlib
|
||||||
SOURCES += tst_qaction.cpp
|
SOURCES += tst_qaction.cpp
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
#include <qevent.h>
|
#include <qevent.h>
|
||||||
#include <qaction.h>
|
#include <qaction.h>
|
||||||
#include <qmenu.h>
|
#include <qmenu.h>
|
||||||
|
#include <qplatformtheme_qpa.h>
|
||||||
|
#include <private/qguiapplication_p.h>
|
||||||
|
|
||||||
class tst_QAction : public QObject
|
class tst_QAction : public QObject
|
||||||
{
|
{
|
||||||
@ -77,6 +79,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int m_lastEventType;
|
int m_lastEventType;
|
||||||
|
int m_keyboardScheme;
|
||||||
QAction *m_lastAction;
|
QAction *m_lastAction;
|
||||||
QWidget *m_tstWidget;
|
QWidget *m_tstWidget;
|
||||||
};
|
};
|
||||||
@ -121,8 +124,10 @@ private:
|
|||||||
tst_QAction *tst;
|
tst_QAction *tst;
|
||||||
};
|
};
|
||||||
|
|
||||||
tst_QAction::tst_QAction()
|
tst_QAction::tst_QAction() : m_keyboardScheme(QPlatformTheme::WindowsKeyboardScheme)
|
||||||
{
|
{
|
||||||
|
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
||||||
|
m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
tst_QAction::~tst_QAction()
|
tst_QAction::~tst_QAction()
|
||||||
@ -237,13 +242,21 @@ void tst_QAction::setStandardKeys()
|
|||||||
QVERIFY(act.shortcut() == act.shortcuts().first());
|
QVERIFY(act.shortcut() == act.shortcuts().first());
|
||||||
|
|
||||||
QList<QKeySequence> expected;
|
QList<QKeySequence> expected;
|
||||||
#if defined(Q_OS_MAC)
|
const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C"));
|
||||||
expected << QKeySequence("CTRL+C");
|
const QKeySequence ctrlInsert = QKeySequence(QStringLiteral("CTRL+INSERT"));
|
||||||
#else
|
switch (m_keyboardScheme) {
|
||||||
expected << QKeySequence("CTRL+C") << QKeySequence("CTRL+INSERT");
|
case QPlatformTheme::MacKeyboardScheme:
|
||||||
#endif
|
expected << ctrlC;
|
||||||
// Qt/Embedded on Windows: expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT");
|
break;
|
||||||
QVERIFY(act.shortcuts() == expected);
|
case QPlatformTheme::WindowsKeyboardScheme:
|
||||||
|
expected << ctrlC << ctrlInsert;
|
||||||
|
break;
|
||||||
|
default: // X11
|
||||||
|
expected << ctrlC << QKeySequence(QStringLiteral("F16")) << ctrlInsert;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
QCOMPARE(act.shortcuts(), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user