| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformtheme.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||
| 2 | ** | - | ||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||
| 5 | ** | - | ||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||
| 7 | ** | - | ||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||
| 9 | ** Commercial License Usage | - | ||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||
| 16 | ** | - | ||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||
| 25 | ** | - | ||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||
| 29 | ** | - | ||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||
| 31 | ** | - | ||||||
| 32 | ****************************************************************************/ | - | ||||||
| 33 | - | |||||||
| 34 | #include "qplatformtheme.h" | - | ||||||
| 35 | - | |||||||
| 36 | #include "qplatformtheme_p.h" | - | ||||||
| 37 | - | |||||||
| 38 | #include <QtCore/QVariant> | - | ||||||
| 39 | #include <QtCore/QStringList> | - | ||||||
| 40 | #include <QtCore/qfileinfo.h> | - | ||||||
| 41 | #include <qpalette.h> | - | ||||||
| 42 | #include <qtextformat.h> | - | ||||||
| 43 | #include <private/qiconloader_p.h> | - | ||||||
| 44 | #include <private/qguiapplication_p.h> | - | ||||||
| 45 | #include <qpa/qplatformintegration.h> | - | ||||||
| 46 | #include <qpa/qplatformdialoghelper.h> | - | ||||||
| 47 | - | |||||||
| 48 | #include <algorithm> | - | ||||||
| 49 | - | |||||||
| 50 | QT_BEGIN_NAMESPACE | - | ||||||
| 51 | - | |||||||
| 52 | /*! | - | ||||||
| 53 | \class QPlatformTheme | - | ||||||
| 54 | \since 5.0 | - | ||||||
| 55 | \internal | - | ||||||
| 56 | \preliminary | - | ||||||
| 57 | \ingroup qpa | - | ||||||
| 58 | \brief The QPlatformTheme class allows customizing the UI based on themes. | - | ||||||
| 59 | - | |||||||
| 60 | */ | - | ||||||
| 61 | - | |||||||
| 62 | /*! | - | ||||||
| 63 | \enum QPlatformTheme::ThemeHint | - | ||||||
| 64 | - | |||||||
| 65 | This enum describes the available theme hints. | - | ||||||
| 66 | - | |||||||
| 67 | \value CursorFlashTime (int) Cursor flash time in ms, overriding | - | ||||||
| 68 | QPlatformIntegration::styleHint. | - | ||||||
| 69 | - | |||||||
| 70 | \value KeyboardInputInterval (int) Keyboard input interval in ms, overriding | - | ||||||
| 71 | QPlatformIntegration::styleHint. | - | ||||||
| 72 | - | |||||||
| 73 | \value MouseDoubleClickInterval (int) Mouse double click interval in ms, | - | ||||||
| 74 | overriding QPlatformIntegration::styleHint. | - | ||||||
| 75 | - | |||||||
| 76 | \value MouseDoubleClickDistance (int) The maximum distance in logical pixels which the mouse can travel | - | ||||||
| 77 | between clicks in order for the click sequence to be handled as a double click. | - | ||||||
| 78 | The default value is 5 logical pixels. | - | ||||||
| 79 | - | |||||||
| 80 | \value MousePressAndHoldInterval (int) Mouse press and hold interval in ms, | - | ||||||
| 81 | overriding QPlatformIntegration::styleHint. | - | ||||||
| 82 | - | |||||||
| 83 | \value StartDragDistance (int) Start drag distance, | - | ||||||
| 84 | overriding QPlatformIntegration::styleHint. | - | ||||||
| 85 | - | |||||||
| 86 | \value StartDragTime (int) Start drag time in ms, | - | ||||||
| 87 | overriding QPlatformIntegration::styleHint. | - | ||||||
| 88 | - | |||||||
| 89 | \value WheelScrollLines (int) The number of lines to scroll a widget, when the mouse wheel is rotated. | - | ||||||
| 90 | The default value is 3. \sa QApplication::wheelScrollLines() | - | ||||||
| 91 | - | |||||||
| 92 | \value KeyboardAutoRepeatRate (int) Keyboard auto repeat rate, | - | ||||||
| 93 | overriding QPlatformIntegration::styleHint. | - | ||||||
| 94 | - | |||||||
| 95 | \value PasswordMaskDelay (int) Pass word mask delay in ms, | - | ||||||
| 96 | overriding QPlatformIntegration::styleHint. | - | ||||||
| 97 | - | |||||||
| 98 | \value StartDragVelocity (int) Velocity of a drag, | - | ||||||
| 99 | overriding QPlatformIntegration::styleHint. | - | ||||||
| 100 | - | |||||||
| 101 | \value TextCursorWidth (int) Determines the width of the text cursor. | - | ||||||
| 102 | - | |||||||
| 103 | \value DropShadow (bool) Determines whether the drop shadow effect for | - | ||||||
| 104 | tooltips or whatsthis is enabled. | - | ||||||
| 105 | - | |||||||
| 106 | \value MaximumScrollBarDragDistance (int) Determines the value returned by | - | ||||||
| 107 | QStyle::pixelMetric(PM_MaximumDragDistance) | - | ||||||
| 108 | - | |||||||
| 109 | \value ToolButtonStyle (int) A value representing a Qt::ToolButtonStyle. | - | ||||||
| 110 | - | |||||||
| 111 | \value ToolBarIconSize Icon size for tool bars. | - | ||||||
| 112 | - | |||||||
| 113 | \value SystemIconThemeName (QString) Name of the icon theme. | - | ||||||
| 114 | - | |||||||
| 115 | \value SystemIconFallbackThemeName (QString) Name of the fallback icon theme. | - | ||||||
| 116 | - | |||||||
| 117 | \value IconThemeSearchPaths (QStringList) Search paths for icons. | - | ||||||
| 118 | - | |||||||
| 119 | \value ItemViewActivateItemOnSingleClick (bool) Activate items by single click. | - | ||||||
| 120 | - | |||||||
| 121 | \value StyleNames (QStringList) A list of preferred style names. | - | ||||||
| 122 | - | |||||||
| 123 | \value WindowAutoPlacement (bool) A boolean value indicating whether Windows | - | ||||||
| 124 | (particularly dialogs) are placed by the system | - | ||||||
| 125 | (see _NET_WM_FULL_PLACEMENT in X11). | - | ||||||
| 126 | - | |||||||
| 127 | \value DialogButtonBoxLayout (int) An integer representing a | - | ||||||
| 128 | QDialogButtonBox::ButtonLayout value. | - | ||||||
| 129 | - | |||||||
| 130 | \value DialogButtonBoxButtonsHaveIcons (bool) A boolean value indicating whether | - | ||||||
| 131 | the buttons of a QDialogButtonBox should have icons. | - | ||||||
| 132 | - | |||||||
| 133 | \value UseFullScreenForPopupMenu (bool) Pop menus can cover the full screen including task bar. | - | ||||||
| 134 | - | |||||||
| 135 | \value KeyboardScheme (int) An integer value (enum KeyboardSchemes) specifying the | - | ||||||
| 136 | keyboard scheme. | - | ||||||
| 137 | - | |||||||
| 138 | \value UiEffects (int) A flag value consisting of UiEffect values specifying the enabled UI animations. | - | ||||||
| 139 | - | |||||||
| 140 | \value SpellCheckUnderlineStyle (int) A QTextCharFormat::UnderlineStyle specifying | - | ||||||
| 141 | the underline style used misspelled words when spell checking. | - | ||||||
| 142 | - | |||||||
| 143 | \value TabFocusBehavior (int) A Qt::TabFocusBehavior specifying | - | ||||||
| 144 | the behavior of focus change when tab key was pressed. | - | ||||||
| 145 | This enum value was added in Qt 5.5. | - | ||||||
| 146 | - | |||||||
| 147 | \value DialogSnapToDefaultButton (bool) Whether the mouse should snap to the default button when a dialog | - | ||||||
| 148 | becomes visible. | - | ||||||
| 149 | - | |||||||
| 150 | \value ContextMenuOnMouseRelease (bool) Whether the context menu should be shown on mouse release. | - | ||||||
| 151 | - | |||||||
| 152 | \sa themeHint(), QStyle::pixelMetric() | - | ||||||
| 153 | */ | - | ||||||
| 154 | - | |||||||
| 155 | - | |||||||
| 156 | // Table of key bindings. It must be sorted on key sequence: | - | ||||||
| 157 | // The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.) | - | ||||||
| 158 | // A priority of 1 indicates that this is the primary key binding when multiple are defined. | - | ||||||
| 159 | - | |||||||
| 160 | enum KeyPlatform { | - | ||||||
| 161 | KB_Win = (1 << QPlatformTheme::WindowsKeyboardScheme), | - | ||||||
| 162 | KB_Mac = (1 << QPlatformTheme::MacKeyboardScheme), | - | ||||||
| 163 | KB_X11 = (1 << QPlatformTheme::X11KeyboardScheme), | - | ||||||
| 164 | KB_KDE = (1 << QPlatformTheme::KdeKeyboardScheme), | - | ||||||
| 165 | KB_Gnome = (1 << QPlatformTheme::GnomeKeyboardScheme), | - | ||||||
| 166 | KB_CDE = (1 << QPlatformTheme::CdeKeyboardScheme), | - | ||||||
| 167 | KB_All = 0xffff | - | ||||||
| 168 | }; | - | ||||||
| 169 | - | |||||||
| 170 | const QKeyBinding QPlatformThemePrivate::keyBindings[] = { | - | ||||||
| 171 | // StandardKey Priority Key Sequence Platforms | - | ||||||
| 172 | {QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, KB_Mac}, | - | ||||||
| 173 | {QKeySequence::HelpContents, 0, Qt::Key_F1, KB_Win | KB_X11}, | - | ||||||
| 174 | {QKeySequence::WhatsThis, 1, Qt::SHIFT | Qt::Key_F1, KB_All}, | - | ||||||
| 175 | {QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, KB_All}, | - | ||||||
| 176 | {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, KB_Mac}, | - | ||||||
| 177 | {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, KB_Win}, | - | ||||||
| 178 | {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, KB_Mac}, | - | ||||||
| 179 | {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, KB_Win | KB_X11}, | - | ||||||
| 180 | {QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, KB_All}, | - | ||||||
| 181 | {QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, KB_All}, | - | ||||||
| 182 | {QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, KB_X11}, //emacs (line edit only) | - | ||||||
| 183 | {QKeySequence::Delete, 1, Qt::Key_Delete, KB_All}, | - | ||||||
| 184 | {QKeySequence::Delete, 0, Qt::META | Qt::Key_D, KB_Mac}, | - | ||||||
| 185 | {QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, KB_All}, | - | ||||||
| 186 | {QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, KB_Win | KB_X11}, //## Check if this should work on mac | - | ||||||
| 187 | {QKeySequence::Cut, 0, Qt::Key_F20, KB_X11}, //Cut on sun keyboards | - | ||||||
| 188 | {QKeySequence::Cut, 0, Qt::META | Qt::Key_K, KB_Mac}, | - | ||||||
| 189 | {QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, KB_X11 | KB_Win}, | - | ||||||
| 190 | {QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, KB_All}, | - | ||||||
| 191 | {QKeySequence::Copy, 0, Qt::Key_F16, KB_X11}, //Copy on sun keyboards | - | ||||||
| 192 | {QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, KB_X11}, | - | ||||||
| 193 | {QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, KB_All}, | - | ||||||
| 194 | {QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, KB_Win | KB_X11}, | - | ||||||
| 195 | {QKeySequence::Paste, 0, Qt::Key_F18, KB_X11}, //Paste on sun keyboards | - | ||||||
| 196 | {QKeySequence::Paste, 0, Qt::META | Qt::Key_Y, KB_Mac}, | - | ||||||
| 197 | {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, KB_Win}, | - | ||||||
| 198 | {QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, KB_All}, | - | ||||||
| 199 | {QKeySequence::Undo, 0, Qt::Key_F14, KB_X11}, //Undo on sun keyboards | - | ||||||
| 200 | {QKeySequence::Redo, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Backspace,KB_Win}, | - | ||||||
| 201 | {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, KB_Mac}, | - | ||||||
| 202 | {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, KB_Win | KB_X11}, | - | ||||||
| 203 | {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, KB_Win}, | - | ||||||
| 204 | {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, KB_Win | KB_X11}, | - | ||||||
| 205 | {QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, KB_Mac}, | - | ||||||
| 206 | {QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, KB_Mac}, | - | ||||||
| 207 | {QKeySequence::Back, 0, Qt::Key_Backspace, KB_Win}, | - | ||||||
| 208 | {QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, KB_Win | KB_X11}, | - | ||||||
| 209 | {QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, KB_Mac}, | - | ||||||
| 210 | {QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, KB_Mac}, | - | ||||||
| 211 | {QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, KB_Win}, | - | ||||||
| 212 | {QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, KB_Gnome | KB_Mac}, | - | ||||||
| 213 | {QKeySequence::Refresh, 0, Qt::Key_F5, KB_Win | KB_X11}, | - | ||||||
| 214 | {QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, KB_All}, | - | ||||||
| 215 | {QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, KB_All}, | - | ||||||
| 216 | {QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, KB_All}, | - | ||||||
| 217 | {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, KB_KDE}, | - | ||||||
| 218 | {QKeySequence::AddTab, 0, Qt::CTRL | Qt::Key_T, KB_All}, | - | ||||||
| 219 | {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, KB_Win}, | - | ||||||
| 220 | {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Tab, KB_Mac}, //different priority from above | - | ||||||
| 221 | {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, KB_Win | KB_X11}, | - | ||||||
| 222 | {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_BraceRight, KB_Mac}, | - | ||||||
| 223 | {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, KB_KDE}, | - | ||||||
| 224 | {QKeySequence::NextChild, 0, Qt::Key_Forward, KB_All}, | - | ||||||
| 225 | {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, KB_Win}, | - | ||||||
| 226 | {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, KB_Mac },//different priority from above | - | ||||||
| 227 | {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, KB_Win | KB_X11}, | - | ||||||
| 228 | {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::Key_BraceLeft, KB_Mac}, | - | ||||||
| 229 | {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, KB_KDE}, | - | ||||||
| 230 | {QKeySequence::PreviousChild, 0, Qt::Key_Back, KB_All}, | - | ||||||
| 231 | {QKeySequence::Find, 0, Qt::CTRL | Qt::Key_F, KB_All}, | - | ||||||
| 232 | {QKeySequence::FindNext, 0, Qt::CTRL | Qt::Key_G, KB_Win}, | - | ||||||
| 233 | {QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, KB_Gnome | KB_Mac}, | - | ||||||
| 234 | {QKeySequence::FindNext, 1, Qt::Key_F3, KB_Win}, | - | ||||||
| 235 | {QKeySequence::FindNext, 0, Qt::Key_F3, KB_X11}, | - | ||||||
| 236 | {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Win}, | - | ||||||
| 237 | {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Gnome | KB_Mac}, | - | ||||||
| 238 | {QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, KB_Win}, | - | ||||||
| 239 | {QKeySequence::FindPrevious, 0, Qt::SHIFT | Qt::Key_F3, KB_X11}, | - | ||||||
| 240 | {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, KB_KDE}, | - | ||||||
| 241 | {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, KB_Gnome}, | - | ||||||
| 242 | {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, KB_Win}, | - | ||||||
| 243 | {QKeySequence::SelectAll, 1, Qt::CTRL | Qt::Key_A, KB_All}, | - | ||||||
| 244 | {QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, KB_All}, | - | ||||||
| 245 | {QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, KB_All}, | - | ||||||
| 246 | {QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, KB_All}, | - | ||||||
| 247 | {QKeySequence::MoveToNextChar, 1, Qt::Key_Right, KB_All}, | - | ||||||
| 248 | {QKeySequence::MoveToNextChar, 0, Qt::META | Qt::Key_F, KB_Mac}, | - | ||||||
| 249 | {QKeySequence::MoveToPreviousChar, 1, Qt::Key_Left, KB_All}, | - | ||||||
| 250 | {QKeySequence::MoveToPreviousChar, 0, Qt::META | Qt::Key_B, KB_Mac}, | - | ||||||
| 251 | {QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, KB_Mac}, | - | ||||||
| 252 | {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, KB_Win | KB_X11}, | - | ||||||
| 253 | {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, KB_Mac}, | - | ||||||
| 254 | {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, KB_Win | KB_X11}, | - | ||||||
| 255 | {QKeySequence::MoveToNextLine, 1, Qt::Key_Down, KB_All}, | - | ||||||
| 256 | {QKeySequence::MoveToNextLine, 0, Qt::META | Qt::Key_N, KB_Mac}, | - | ||||||
| 257 | {QKeySequence::MoveToPreviousLine, 1, Qt::Key_Up, KB_All}, | - | ||||||
| 258 | {QKeySequence::MoveToPreviousLine, 0, Qt::META | Qt::Key_P, KB_Mac}, | - | ||||||
| 259 | {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, KB_Mac}, | - | ||||||
| 260 | {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, KB_Mac}, | - | ||||||
| 261 | {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_V, KB_Mac}, | - | ||||||
| 262 | {QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, KB_Mac }, | - | ||||||
| 263 | {QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, KB_All}, | - | ||||||
| 264 | {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, KB_Mac}, | - | ||||||
| 265 | {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_Up, KB_Mac}, | - | ||||||
| 266 | {QKeySequence::MoveToPreviousPage, 0, Qt::ALT | Qt::Key_PageUp, KB_Mac }, | - | ||||||
| 267 | {QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, KB_All}, | - | ||||||
| 268 | {QKeySequence::MoveToStartOfLine, 0, Qt::META | Qt::Key_Left, KB_Mac}, | - | ||||||
| 269 | {QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, KB_Mac }, | - | ||||||
| 270 | {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, KB_Win | KB_X11}, | - | ||||||
| 271 | {QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, KB_Mac}, | - | ||||||
| 272 | {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, KB_Mac }, | - | ||||||
| 273 | {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, KB_Win | KB_X11}, | - | ||||||
| 274 | {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL + Qt::Key_E, KB_X11}, | - | ||||||
| 275 | {QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, KB_Mac}, | - | ||||||
| 276 | {QKeySequence::MoveToStartOfBlock, 1, Qt::ALT | Qt::Key_Up, KB_Mac}, //mac only | - | ||||||
| 277 | {QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, KB_Mac}, | - | ||||||
| 278 | {QKeySequence::MoveToEndOfBlock, 1, Qt::ALT | Qt::Key_Down, KB_Mac}, //mac only | - | ||||||
| 279 | {QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, KB_Mac}, | - | ||||||
| 280 | {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, KB_Win | KB_X11}, | - | ||||||
| 281 | {QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, KB_Mac}, | - | ||||||
| 282 | {QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, KB_Mac}, | - | ||||||
| 283 | {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, KB_Win | KB_X11}, | - | ||||||
| 284 | {QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, KB_Mac}, | - | ||||||
| 285 | {QKeySequence::SelectNextChar, 0, Qt::SHIFT | Qt::Key_Right, KB_All}, | - | ||||||
| 286 | {QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, KB_All}, | - | ||||||
| 287 | {QKeySequence::SelectNextWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Right, KB_Mac}, | - | ||||||
| 288 | {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Win | KB_X11}, | - | ||||||
| 289 | {QKeySequence::SelectPreviousWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Left, KB_Mac}, | - | ||||||
| 290 | {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, KB_Win | KB_X11}, | - | ||||||
| 291 | {QKeySequence::SelectNextLine, 0, Qt::SHIFT | Qt::Key_Down, KB_All}, | - | ||||||
| 292 | {QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, KB_All}, | - | ||||||
| 293 | {QKeySequence::SelectNextPage, 0, Qt::SHIFT | Qt::Key_PageDown, KB_All}, | - | ||||||
| 294 | {QKeySequence::SelectPreviousPage, 0, Qt::SHIFT | Qt::Key_PageUp, KB_All}, | - | ||||||
| 295 | {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, KB_Mac}, | - | ||||||
| 296 | {QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, KB_Mac }, | - | ||||||
| 297 | {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11}, | - | ||||||
| 298 | {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac}, | - | ||||||
| 299 | {QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Mac }, | - | ||||||
| 300 | {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11}, | - | ||||||
| 301 | {QKeySequence::SelectStartOfBlock, 1, Qt::ALT | Qt::SHIFT | Qt::Key_Up, KB_Mac}, //mac only | - | ||||||
| 302 | {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, KB_Mac}, | - | ||||||
| 303 | {QKeySequence::SelectEndOfBlock, 1, Qt::ALT | Qt::SHIFT | Qt::Key_Down, KB_Mac}, //mac only | - | ||||||
| 304 | {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, KB_Mac}, | - | ||||||
| 305 | {QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, KB_Mac}, | - | ||||||
| 306 | {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11}, | - | ||||||
| 307 | {QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, KB_Mac}, | - | ||||||
| 308 | {QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, KB_Mac}, | - | ||||||
| 309 | {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11}, | - | ||||||
| 310 | {QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, KB_Mac}, | - | ||||||
| 311 | {QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, KB_Mac}, | - | ||||||
| 312 | {QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, KB_X11 | KB_Win}, | - | ||||||
| 313 | {QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, KB_Mac}, | - | ||||||
| 314 | {QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, KB_X11 | KB_Win}, | - | ||||||
| 315 | {QKeySequence::DeleteEndOfLine, 0, Qt::CTRL | Qt::Key_K, KB_X11}, //emacs (line edit only) | - | ||||||
| 316 | {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, KB_All}, | - | ||||||
| 317 | {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, KB_All}, | - | ||||||
| 318 | {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Enter, KB_Mac}, | - | ||||||
| 319 | {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, KB_Mac}, | - | ||||||
| 320 | {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, KB_All}, | - | ||||||
| 321 | {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, KB_All}, | - | ||||||
| 322 | {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_O, KB_Mac}, | - | ||||||
| 323 | {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, KB_Gnome | KB_Mac}, | - | ||||||
| 324 | {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, KB_Mac}, | - | ||||||
| 325 | {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, KB_X11 | KB_Gnome | KB_KDE | KB_Mac}, | - | ||||||
| 326 | {QKeySequence::FullScreen, 1, Qt::META | Qt::CTRL | Qt::Key_F, KB_Mac}, | - | ||||||
| 327 | {QKeySequence::FullScreen, 0, Qt::ALT | Qt::Key_Enter, KB_Win}, | - | ||||||
| 328 | {QKeySequence::FullScreen, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F, KB_KDE}, | - | ||||||
| 329 | {QKeySequence::FullScreen, 1, Qt::CTRL | Qt::Key_F11, KB_Gnome}, | - | ||||||
| 330 | {QKeySequence::FullScreen, 1, Qt::Key_F11, KB_Win | KB_KDE}, | - | ||||||
| 331 | {QKeySequence::Deselect, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_A, KB_X11}, | - | ||||||
| 332 | {QKeySequence::DeleteCompleteLine, 0, Qt::CTRL | Qt::Key_U, KB_X11}, | - | ||||||
| 333 | {QKeySequence::Backspace, 0, Qt::META | Qt::Key_H, KB_Mac}, | - | ||||||
| 334 | {QKeySequence::Cancel, 0, Qt::Key_Escape, KB_All}, | - | ||||||
| 335 | {QKeySequence::Cancel, 0, Qt::CTRL | Qt::Key_Period, KB_Mac} | - | ||||||
| 336 | }; | - | ||||||
| 337 | - | |||||||
| 338 | const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding)); | - | ||||||
| 339 | - | |||||||
| 340 | QPlatformThemePrivate::QPlatformThemePrivate() | - | ||||||
| 341 | : systemPalette(0) | - | ||||||
| 342 | { never executed: }end of blocknever executed: end of block | 0 | ||||||
| 343 | - | |||||||
| 344 | QPlatformThemePrivate::~QPlatformThemePrivate() | - | ||||||
| 345 | { | - | ||||||
| 346 | delete systemPalette; | - | ||||||
| 347 | } never executed: end of block | 0 | ||||||
| 348 | - | |||||||
| 349 | Q_GUI_EXPORT QPalette qt_fusionPalette(); | - | ||||||
| 350 | - | |||||||
| 351 | void QPlatformThemePrivate::initializeSystemPalette() | - | ||||||
| 352 | { | - | ||||||
| 353 | Q_ASSERT(!systemPalette); | - | ||||||
| 354 | systemPalette = new QPalette(qt_fusionPalette()); | - | ||||||
| 355 | } never executed: end of block | 0 | ||||||
| 356 | - | |||||||
| 357 | QPlatformTheme::QPlatformTheme() | - | ||||||
| 358 | : d_ptr(new QPlatformThemePrivate) | - | ||||||
| 359 | { | - | ||||||
| 360 | - | |||||||
| 361 | } never executed: end of block | 0 | ||||||
| 362 | - | |||||||
| 363 | QPlatformTheme::QPlatformTheme(QPlatformThemePrivate *priv) | - | ||||||
| 364 | : d_ptr(priv) | - | ||||||
| 365 | { never executed: }end of blocknever executed: end of block | 0 | ||||||
| 366 | - | |||||||
| 367 | QPlatformTheme::~QPlatformTheme() | - | ||||||
| 368 | { | - | ||||||
| 369 | - | |||||||
| 370 | } | - | ||||||
| 371 | - | |||||||
| 372 | bool QPlatformTheme::usePlatformNativeDialog(DialogType type) const | - | ||||||
| 373 | { | - | ||||||
| 374 | Q_UNUSED(type); | - | ||||||
| 375 | return false; never executed: return false; | 0 | ||||||
| 376 | } | - | ||||||
| 377 | - | |||||||
| 378 | QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType type) const | - | ||||||
| 379 | { | - | ||||||
| 380 | Q_UNUSED(type); | - | ||||||
| 381 | return 0; never executed: return 0; | 0 | ||||||
| 382 | } | - | ||||||
| 383 | - | |||||||
| 384 | const QPalette *QPlatformTheme::palette(Palette type) const | - | ||||||
| 385 | { | - | ||||||
| 386 | Q_D(const QPlatformTheme); | - | ||||||
| 387 | if (type == QPlatformTheme::SystemPalette) {
| 0 | ||||||
| 388 | if (!d->systemPalette)
| 0 | ||||||
| 389 | const_cast<QPlatformTheme *>(this)->d_ptr->initializeSystemPalette(); never executed: const_cast<QPlatformTheme *>(this)->d_ptr->initializeSystemPalette(); | 0 | ||||||
| 390 | return d->systemPalette; never executed: return d->systemPalette; | 0 | ||||||
| 391 | } | - | ||||||
| 392 | return 0; never executed: return 0; | 0 | ||||||
| 393 | } | - | ||||||
| 394 | - | |||||||
| 395 | const QFont *QPlatformTheme::font(Font type) const | - | ||||||
| 396 | { | - | ||||||
| 397 | Q_UNUSED(type) | - | ||||||
| 398 | return 0; never executed: return 0; | 0 | ||||||
| 399 | } | - | ||||||
| 400 | - | |||||||
| 401 | QPixmap QPlatformTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const | - | ||||||
| 402 | { | - | ||||||
| 403 | Q_UNUSED(sp); | - | ||||||
| 404 | Q_UNUSED(size); | - | ||||||
| 405 | // TODO Should return QCommonStyle pixmaps? | - | ||||||
| 406 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||
| 407 | } | - | ||||||
| 408 | - | |||||||
| 409 | QPixmap QPlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size, | - | ||||||
| 410 | QPlatformTheme::IconOptions iconOptions) const | - | ||||||
| 411 | { | - | ||||||
| 412 | Q_UNUSED(fileInfo); | - | ||||||
| 413 | Q_UNUSED(size); | - | ||||||
| 414 | Q_UNUSED(iconOptions); | - | ||||||
| 415 | // TODO Should return QCommonStyle pixmaps? | - | ||||||
| 416 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||
| 417 | } | - | ||||||
| 418 | - | |||||||
| 419 | QVariant QPlatformTheme::themeHint(ThemeHint hint) const | - | ||||||
| 420 | { | - | ||||||
| 421 | // For theme hints which mirror platform integration style hints, query | - | ||||||
| 422 | // the platform integration. The base QPlatformIntegration::styleHint() | - | ||||||
| 423 | // function will in turn query QPlatformTheme::defaultThemeHint() if there | - | ||||||
| 424 | // is no custom value. | - | ||||||
| 425 | switch (hint) { | - | ||||||
| 426 | case QPlatformTheme::CursorFlashTime: never executed: case QPlatformTheme::CursorFlashTime: | 0 | ||||||
| 427 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::CursorFlashTime); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::CursorFlashTime); | 0 | ||||||
| 428 | case QPlatformTheme::KeyboardInputInterval: never executed: case QPlatformTheme::KeyboardInputInterval: | 0 | ||||||
| 429 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardInputInterval); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardInputInterval); | 0 | ||||||
| 430 | case QPlatformTheme::KeyboardAutoRepeatRate: never executed: case QPlatformTheme::KeyboardAutoRepeatRate: | 0 | ||||||
| 431 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardAutoRepeatRate); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardAutoRepeatRate); | 0 | ||||||
| 432 | case QPlatformTheme::MouseDoubleClickInterval: never executed: case QPlatformTheme::MouseDoubleClickInterval: | 0 | ||||||
| 433 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MouseDoubleClickInterval); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MouseDoubleClickInterval); | 0 | ||||||
| 434 | case QPlatformTheme::StartDragDistance: never executed: case QPlatformTheme::StartDragDistance: | 0 | ||||||
| 435 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragDistance); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragDistance); | 0 | ||||||
| 436 | case QPlatformTheme::StartDragTime: never executed: case QPlatformTheme::StartDragTime: | 0 | ||||||
| 437 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragTime); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragTime); | 0 | ||||||
| 438 | case QPlatformTheme::StartDragVelocity: never executed: case QPlatformTheme::StartDragVelocity: | 0 | ||||||
| 439 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragVelocity); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragVelocity); | 0 | ||||||
| 440 | case QPlatformTheme::PasswordMaskDelay: never executed: case QPlatformTheme::PasswordMaskDelay: | 0 | ||||||
| 441 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskDelay); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskDelay); | 0 | ||||||
| 442 | case QPlatformTheme::PasswordMaskCharacter: never executed: case QPlatformTheme::PasswordMaskCharacter: | 0 | ||||||
| 443 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter); | 0 | ||||||
| 444 | case QPlatformTheme::MousePressAndHoldInterval: never executed: case QPlatformTheme::MousePressAndHoldInterval: | 0 | ||||||
| 445 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval); | 0 | ||||||
| 446 | case QPlatformTheme::ItemViewActivateItemOnSingleClick: never executed: case QPlatformTheme::ItemViewActivateItemOnSingleClick: | 0 | ||||||
| 447 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick); | 0 | ||||||
| 448 | default: never executed: default: | 0 | ||||||
| 449 | return QPlatformTheme::defaultThemeHint(hint); never executed: return QPlatformTheme::defaultThemeHint(hint); | 0 | ||||||
| 450 | } | - | ||||||
| 451 | } | - | ||||||
| 452 | - | |||||||
| 453 | QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint) | - | ||||||
| 454 | { | - | ||||||
| 455 | switch (hint) { | - | ||||||
| 456 | case QPlatformTheme::CursorFlashTime: never executed: case QPlatformTheme::CursorFlashTime: | 0 | ||||||
| 457 | return QVariant(1000); never executed: return QVariant(1000); | 0 | ||||||
| 458 | case QPlatformTheme::KeyboardInputInterval: never executed: case QPlatformTheme::KeyboardInputInterval: | 0 | ||||||
| 459 | return QVariant(400); never executed: return QVariant(400); | 0 | ||||||
| 460 | case QPlatformTheme::KeyboardAutoRepeatRate: never executed: case QPlatformTheme::KeyboardAutoRepeatRate: | 0 | ||||||
| 461 | return QVariant(30); never executed: return QVariant(30); | 0 | ||||||
| 462 | case QPlatformTheme::MouseDoubleClickInterval: never executed: case QPlatformTheme::MouseDoubleClickInterval: | 0 | ||||||
| 463 | return QVariant(400); never executed: return QVariant(400); | 0 | ||||||
| 464 | case QPlatformTheme::StartDragDistance: never executed: case QPlatformTheme::StartDragDistance: | 0 | ||||||
| 465 | return QVariant(10); never executed: return QVariant(10); | 0 | ||||||
| 466 | case QPlatformTheme::StartDragTime: never executed: case QPlatformTheme::StartDragTime: | 0 | ||||||
| 467 | return QVariant(500); never executed: return QVariant(500); | 0 | ||||||
| 468 | case QPlatformTheme::PasswordMaskDelay: never executed: case QPlatformTheme::PasswordMaskDelay: | 0 | ||||||
| 469 | return QVariant(int(0)); never executed: return QVariant(int(0)); | 0 | ||||||
| 470 | case QPlatformTheme::PasswordMaskCharacter: never executed: case QPlatformTheme::PasswordMaskCharacter: | 0 | ||||||
| 471 | return QVariant(QChar(0x25CF)); never executed: return QVariant(QChar(0x25CF)); | 0 | ||||||
| 472 | case QPlatformTheme::StartDragVelocity: never executed: case QPlatformTheme::StartDragVelocity: | 0 | ||||||
| 473 | return QVariant(int(0)); // no limit never executed: return QVariant(int(0)); | 0 | ||||||
| 474 | case QPlatformTheme::UseFullScreenForPopupMenu: never executed: case QPlatformTheme::UseFullScreenForPopupMenu: | 0 | ||||||
| 475 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||
| 476 | case QPlatformTheme::WindowAutoPlacement: never executed: case QPlatformTheme::WindowAutoPlacement: | 0 | ||||||
| 477 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||
| 478 | case QPlatformTheme::DialogButtonBoxLayout: never executed: case QPlatformTheme::DialogButtonBoxLayout: | 0 | ||||||
| 479 | return QVariant(int(0)); never executed: return QVariant(int(0)); | 0 | ||||||
| 480 | case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: never executed: case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: | 0 | ||||||
| 481 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||
| 482 | case QPlatformTheme::ItemViewActivateItemOnSingleClick: never executed: case QPlatformTheme::ItemViewActivateItemOnSingleClick: | 0 | ||||||
| 483 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||
| 484 | case QPlatformTheme::ToolButtonStyle: never executed: case QPlatformTheme::ToolButtonStyle: | 0 | ||||||
| 485 | return QVariant(int(Qt::ToolButtonIconOnly)); never executed: return QVariant(int(Qt::ToolButtonIconOnly)); | 0 | ||||||
| 486 | case QPlatformTheme::ToolBarIconSize: never executed: case QPlatformTheme::ToolBarIconSize: | 0 | ||||||
| 487 | return QVariant(int(0)); never executed: return QVariant(int(0)); | 0 | ||||||
| 488 | case QPlatformTheme::SystemIconThemeName: never executed: case QPlatformTheme::SystemIconThemeName: | 0 | ||||||
| 489 | case QPlatformTheme::SystemIconFallbackThemeName: never executed: case QPlatformTheme::SystemIconFallbackThemeName: | 0 | ||||||
| 490 | return QVariant(QString()); never executed: return QVariant(QString()); | 0 | ||||||
| 491 | case QPlatformTheme::IconThemeSearchPaths: never executed: case QPlatformTheme::IconThemeSearchPaths: | 0 | ||||||
| 492 | return QVariant(QStringList()); never executed: return QVariant(QStringList()); | 0 | ||||||
| 493 | case QPlatformTheme::StyleNames: never executed: case QPlatformTheme::StyleNames: | 0 | ||||||
| 494 | return QVariant(QStringList()); never executed: return QVariant(QStringList()); | 0 | ||||||
| 495 | case TextCursorWidth: never executed: case TextCursorWidth: | 0 | ||||||
| 496 | return QVariant(1); never executed: return QVariant(1); | 0 | ||||||
| 497 | case DropShadow: never executed: case DropShadow: | 0 | ||||||
| 498 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||
| 499 | case MaximumScrollBarDragDistance: never executed: case MaximumScrollBarDragDistance: | 0 | ||||||
| 500 | return QVariant(-1); never executed: return QVariant(-1); | 0 | ||||||
| 501 | case KeyboardScheme: never executed: case KeyboardScheme: | 0 | ||||||
| 502 | return QVariant(int(WindowsKeyboardScheme)); never executed: return QVariant(int(WindowsKeyboardScheme)); | 0 | ||||||
| 503 | case UiEffects: never executed: case UiEffects: | 0 | ||||||
| 504 | return QVariant(int(0)); never executed: return QVariant(int(0)); | 0 | ||||||
| 505 | case SpellCheckUnderlineStyle: never executed: case SpellCheckUnderlineStyle: | 0 | ||||||
| 506 | return QVariant(int(QTextCharFormat::SpellCheckUnderline)); never executed: return QVariant(int(QTextCharFormat::SpellCheckUnderline)); | 0 | ||||||
| 507 | case TabFocusBehavior: never executed: case TabFocusBehavior: | 0 | ||||||
| 508 | return QVariant(int(Qt::TabFocusAllControls)); never executed: return QVariant(int(Qt::TabFocusAllControls)); | 0 | ||||||
| 509 | case IconPixmapSizes: never executed: case IconPixmapSizes: | 0 | ||||||
| 510 | return QVariant::fromValue(QList<int>()); never executed: return QVariant::fromValue(QList<int>()); | 0 | ||||||
| 511 | case DialogSnapToDefaultButton: never executed: case DialogSnapToDefaultButton: | 0 | ||||||
| 512 | case ContextMenuOnMouseRelease: never executed: case ContextMenuOnMouseRelease: | 0 | ||||||
| 513 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||
| 514 | case MousePressAndHoldInterval: never executed: case MousePressAndHoldInterval: | 0 | ||||||
| 515 | return QVariant(800); never executed: return QVariant(800); | 0 | ||||||
| 516 | case MouseDoubleClickDistance: never executed: case MouseDoubleClickDistance: | 0 | ||||||
| 517 | { | - | ||||||
| 518 | bool ok = false; | - | ||||||
| 519 | const int dist = qEnvironmentVariableIntValue("QT_DBL_CLICK_DIST", &ok); | - | ||||||
| 520 | return QVariant(ok ? dist : 5); never executed: return QVariant(ok ? dist : 5); | 0 | ||||||
| 521 | } | - | ||||||
| 522 | case WheelScrollLines: never executed: case WheelScrollLines: | 0 | ||||||
| 523 | return QVariant(3); never executed: return QVariant(3); | 0 | ||||||
| 524 | } | - | ||||||
| 525 | return QVariant(); never executed: return QVariant(); | 0 | ||||||
| 526 | } | - | ||||||
| 527 | - | |||||||
| 528 | QPlatformMenuItem *QPlatformTheme::createPlatformMenuItem() const | - | ||||||
| 529 | { | - | ||||||
| 530 | return 0; never executed: return 0; | 0 | ||||||
| 531 | } | - | ||||||
| 532 | - | |||||||
| 533 | QPlatformMenu *QPlatformTheme::createPlatformMenu() const | - | ||||||
| 534 | { | - | ||||||
| 535 | return 0; never executed: return 0; | 0 | ||||||
| 536 | } | - | ||||||
| 537 | - | |||||||
| 538 | QPlatformMenuBar *QPlatformTheme::createPlatformMenuBar() const | - | ||||||
| 539 | { | - | ||||||
| 540 | return 0; never executed: return 0; | 0 | ||||||
| 541 | } | - | ||||||
| 542 | - | |||||||
| 543 | #ifndef QT_NO_SYSTEMTRAYICON | - | ||||||
| 544 | /*! | - | ||||||
| 545 | Factory function for QSystemTrayIcon. This function will return 0 if the platform | - | ||||||
| 546 | integration does not support creating any system tray icon. | - | ||||||
| 547 | */ | - | ||||||
| 548 | QPlatformSystemTrayIcon *QPlatformTheme::createPlatformSystemTrayIcon() const | - | ||||||
| 549 | { | - | ||||||
| 550 | return 0; never executed: return 0; | 0 | ||||||
| 551 | } | - | ||||||
| 552 | #endif | - | ||||||
| 553 | - | |||||||
| 554 | /*! | - | ||||||
| 555 | Factory function for the QIconEngine used by QIcon::fromTheme(). By default this | - | ||||||
| 556 | function returns a QIconLoaderEngine, but subclasses can reimplement it to | - | ||||||
| 557 | provide their own. | - | ||||||
| 558 | - | |||||||
| 559 | It is especially useful to benefit from some platform specific facilities or | - | ||||||
| 560 | optimizations like an inter-process cache in systems mostly built with Qt. | - | ||||||
| 561 | - | |||||||
| 562 | \since 5.1 | - | ||||||
| 563 | */ | - | ||||||
| 564 | QIconEngine *QPlatformTheme::createIconEngine(const QString &iconName) const | - | ||||||
| 565 | { | - | ||||||
| 566 | return new QIconLoaderEngine(iconName); never executed: return new QIconLoaderEngine(iconName); | 0 | ||||||
| 567 | } | - | ||||||
| 568 | - | |||||||
| 569 | #if defined(Q_OS_MACX) | - | ||||||
| 570 | static inline int maybeSwapShortcut(int shortcut) | - | ||||||
| 571 | { | - | ||||||
| 572 | if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { | - | ||||||
| 573 | uint oldshortcut = shortcut; | - | ||||||
| 574 | shortcut &= ~(Qt::CTRL | Qt::META); | - | ||||||
| 575 | if (oldshortcut & Qt::CTRL) | - | ||||||
| 576 | shortcut |= Qt::META; | - | ||||||
| 577 | if (oldshortcut & Qt::META) | - | ||||||
| 578 | shortcut |= Qt::CTRL; | - | ||||||
| 579 | } | - | ||||||
| 580 | return shortcut; | - | ||||||
| 581 | } | - | ||||||
| 582 | #endif | - | ||||||
| 583 | - | |||||||
| 584 | // mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler) | - | ||||||
| 585 | struct ByStandardKey { | - | ||||||
| 586 | typedef bool result_type; | - | ||||||
| 587 | - | |||||||
| 588 | bool operator()(QKeySequence::StandardKey lhs, QKeySequence::StandardKey rhs) const | - | ||||||
| 589 | { return lhs < rhs; } never executed: return lhs < rhs; | 0 | ||||||
| 590 | - | |||||||
| 591 | bool operator()(const QKeyBinding& lhs, const QKeyBinding& rhs) const | - | ||||||
| 592 | { return operator()(lhs.standardKey, rhs.standardKey); } never executed: return operator()(lhs.standardKey, rhs.standardKey); | 0 | ||||||
| 593 | - | |||||||
| 594 | bool operator()(QKeySequence::StandardKey lhs, const QKeyBinding& rhs) const | - | ||||||
| 595 | { return operator()(lhs, rhs.standardKey); } never executed: return operator()(lhs, rhs.standardKey); | 0 | ||||||
| 596 | - | |||||||
| 597 | bool operator()(const QKeyBinding& lhs, QKeySequence::StandardKey rhs) const | - | ||||||
| 598 | { return operator()(lhs.standardKey, rhs); } never executed: return operator()(lhs.standardKey, rhs); | 0 | ||||||
| 599 | }; | - | ||||||
| 600 | - | |||||||
| 601 | /*! | - | ||||||
| 602 | Returns the key sequence that should be used for a standard action. | - | ||||||
| 603 | - | |||||||
| 604 | \since 5.2 | - | ||||||
| 605 | */ | - | ||||||
| 606 | QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) const | - | ||||||
| 607 | { | - | ||||||
| 608 | const uint platform = QPlatformThemePrivate::currentKeyPlatforms(); | - | ||||||
| 609 | QList <QKeySequence> list; | - | ||||||
| 610 | - | |||||||
| 611 | std::pair<const QKeyBinding *, const QKeyBinding *> range = | - | ||||||
| 612 | std::equal_range(QPlatformThemePrivate::keyBindings, | - | ||||||
| 613 | QPlatformThemePrivate::keyBindings + QPlatformThemePrivate::numberOfKeyBindings, | - | ||||||
| 614 | key, ByStandardKey()); | - | ||||||
| 615 | - | |||||||
| 616 | for (const QKeyBinding *it = range.first; it < range.second; ++it) {
| 0 | ||||||
| 617 | if (!(it->platform & platform))
| 0 | ||||||
| 618 | continue; never executed: continue; | 0 | ||||||
| 619 | - | |||||||
| 620 | uint shortcut = | - | ||||||
| 621 | #if defined(Q_OS_MACX) | - | ||||||
| 622 | maybeSwapShortcut(it->shortcut); | - | ||||||
| 623 | #else | - | ||||||
| 624 | it->shortcut; | - | ||||||
| 625 | #endif | - | ||||||
| 626 | if (it->priority > 0)
| 0 | ||||||
| 627 | list.prepend(QKeySequence(shortcut)); never executed: list.prepend(QKeySequence(shortcut)); | 0 | ||||||
| 628 | else | - | ||||||
| 629 | list.append(QKeySequence(shortcut)); never executed: list.append(QKeySequence(shortcut)); | 0 | ||||||
| 630 | } | - | ||||||
| 631 | - | |||||||
| 632 | return list; never executed: return list; | 0 | ||||||
| 633 | } | - | ||||||
| 634 | - | |||||||
| 635 | /*! | - | ||||||
| 636 | Returns the text of a standard \a button. | - | ||||||
| 637 | - | |||||||
| 638 | \since 5.3 | - | ||||||
| 639 | \sa QPlatformDialogHelper::StandardButton | - | ||||||
| 640 | */ | - | ||||||
| 641 | - | |||||||
| 642 | QString QPlatformTheme::standardButtonText(int button) const | - | ||||||
| 643 | { | - | ||||||
| 644 | return QPlatformTheme::defaultStandardButtonText(button); never executed: return QPlatformTheme::defaultStandardButtonText(button); | 0 | ||||||
| 645 | } | - | ||||||
| 646 | - | |||||||
| 647 | QString QPlatformTheme::defaultStandardButtonText(int button) | - | ||||||
| 648 | { | - | ||||||
| 649 | switch (button) { | - | ||||||
| 650 | case QPlatformDialogHelper::Ok: never executed: case QPlatformDialogHelper::Ok: | 0 | ||||||
| 651 | return QCoreApplication::translate("QPlatformTheme", "OK"); never executed: return QCoreApplication::translate("QPlatformTheme", "OK"); | 0 | ||||||
| 652 | case QPlatformDialogHelper::Save: never executed: case QPlatformDialogHelper::Save: | 0 | ||||||
| 653 | return QCoreApplication::translate("QPlatformTheme", "Save"); never executed: return QCoreApplication::translate("QPlatformTheme", "Save"); | 0 | ||||||
| 654 | case QPlatformDialogHelper::SaveAll: never executed: case QPlatformDialogHelper::SaveAll: | 0 | ||||||
| 655 | return QCoreApplication::translate("QPlatformTheme", "Save All"); never executed: return QCoreApplication::translate("QPlatformTheme", "Save All"); | 0 | ||||||
| 656 | case QPlatformDialogHelper::Open: never executed: case QPlatformDialogHelper::Open: | 0 | ||||||
| 657 | return QCoreApplication::translate("QPlatformTheme", "Open"); never executed: return QCoreApplication::translate("QPlatformTheme", "Open"); | 0 | ||||||
| 658 | case QPlatformDialogHelper::Yes: never executed: case QPlatformDialogHelper::Yes: | 0 | ||||||
| 659 | return QCoreApplication::translate("QPlatformTheme", "&Yes"); never executed: return QCoreApplication::translate("QPlatformTheme", "&Yes"); | 0 | ||||||
| 660 | case QPlatformDialogHelper::YesToAll: never executed: case QPlatformDialogHelper::YesToAll: | 0 | ||||||
| 661 | return QCoreApplication::translate("QPlatformTheme", "Yes to &All"); never executed: return QCoreApplication::translate("QPlatformTheme", "Yes to &All"); | 0 | ||||||
| 662 | case QPlatformDialogHelper::No: never executed: case QPlatformDialogHelper::No: | 0 | ||||||
| 663 | return QCoreApplication::translate("QPlatformTheme", "&No"); never executed: return QCoreApplication::translate("QPlatformTheme", "&No"); | 0 | ||||||
| 664 | case QPlatformDialogHelper::NoToAll: never executed: case QPlatformDialogHelper::NoToAll: | 0 | ||||||
| 665 | return QCoreApplication::translate("QPlatformTheme", "N&o to All"); never executed: return QCoreApplication::translate("QPlatformTheme", "N&o to All"); | 0 | ||||||
| 666 | case QPlatformDialogHelper::Abort: never executed: case QPlatformDialogHelper::Abort: | 0 | ||||||
| 667 | return QCoreApplication::translate("QPlatformTheme", "Abort"); never executed: return QCoreApplication::translate("QPlatformTheme", "Abort"); | 0 | ||||||
| 668 | case QPlatformDialogHelper::Retry: never executed: case QPlatformDialogHelper::Retry: | 0 | ||||||
| 669 | return QCoreApplication::translate("QPlatformTheme", "Retry"); never executed: return QCoreApplication::translate("QPlatformTheme", "Retry"); | 0 | ||||||
| 670 | case QPlatformDialogHelper::Ignore: never executed: case QPlatformDialogHelper::Ignore: | 0 | ||||||
| 671 | return QCoreApplication::translate("QPlatformTheme", "Ignore"); never executed: return QCoreApplication::translate("QPlatformTheme", "Ignore"); | 0 | ||||||
| 672 | case QPlatformDialogHelper::Close: never executed: case QPlatformDialogHelper::Close: | 0 | ||||||
| 673 | return QCoreApplication::translate("QPlatformTheme", "Close"); never executed: return QCoreApplication::translate("QPlatformTheme", "Close"); | 0 | ||||||
| 674 | case QPlatformDialogHelper::Cancel: never executed: case QPlatformDialogHelper::Cancel: | 0 | ||||||
| 675 | return QCoreApplication::translate("QPlatformTheme", "Cancel"); never executed: return QCoreApplication::translate("QPlatformTheme", "Cancel"); | 0 | ||||||
| 676 | case QPlatformDialogHelper::Discard: never executed: case QPlatformDialogHelper::Discard: | 0 | ||||||
| 677 | return QCoreApplication::translate("QPlatformTheme", "Discard"); never executed: return QCoreApplication::translate("QPlatformTheme", "Discard"); | 0 | ||||||
| 678 | case QPlatformDialogHelper::Help: never executed: case QPlatformDialogHelper::Help: | 0 | ||||||
| 679 | return QCoreApplication::translate("QPlatformTheme", "Help"); never executed: return QCoreApplication::translate("QPlatformTheme", "Help"); | 0 | ||||||
| 680 | case QPlatformDialogHelper::Apply: never executed: case QPlatformDialogHelper::Apply: | 0 | ||||||
| 681 | return QCoreApplication::translate("QPlatformTheme", "Apply"); never executed: return QCoreApplication::translate("QPlatformTheme", "Apply"); | 0 | ||||||
| 682 | case QPlatformDialogHelper::Reset: never executed: case QPlatformDialogHelper::Reset: | 0 | ||||||
| 683 | return QCoreApplication::translate("QPlatformTheme", "Reset"); never executed: return QCoreApplication::translate("QPlatformTheme", "Reset"); | 0 | ||||||
| 684 | case QPlatformDialogHelper::RestoreDefaults: never executed: case QPlatformDialogHelper::RestoreDefaults: | 0 | ||||||
| 685 | return QCoreApplication::translate("QPlatformTheme", "Restore Defaults"); never executed: return QCoreApplication::translate("QPlatformTheme", "Restore Defaults"); | 0 | ||||||
| 686 | default: never executed: default: | 0 | ||||||
| 687 | break; never executed: break; | 0 | ||||||
| 688 | } | - | ||||||
| 689 | return QString(); never executed: return QString(); | 0 | ||||||
| 690 | } | - | ||||||
| 691 | - | |||||||
| 692 | unsigned QPlatformThemePrivate::currentKeyPlatforms() | - | ||||||
| 693 | { | - | ||||||
| 694 | const uint keyboardScheme = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt(); | - | ||||||
| 695 | unsigned result = 1u << keyboardScheme; | - | ||||||
| 696 | if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
| 0 | ||||||
| 697 | || keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
| 0 | ||||||
| 698 | || keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
| 0 | ||||||
| 699 | result |= KB_X11; never executed: result |= KB_X11; | 0 | ||||||
| 700 | return result; never executed: return result; | 0 | ||||||
| 701 | } | - | ||||||
| 702 | - | |||||||
| 703 | QT_END_NAMESPACE | - | ||||||
| Source code | Switch to Preprocessed file |