diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-12-01 13:59:53 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-12-01 13:59:53 +0100 |
commit | 4ba00f0054ffd183377fd420b35ef7a388c0bcfe (patch) | |
tree | dde076314b40ce0dd540e5363ff6d9fca98016f4 /src | |
parent | 948932c9c6ae535647e69962aad2add516802b9c (diff) | |
parent | d8c5dea96fb8861089e2166ae574a85d2b69c09e (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
src/imports/controls/SpinBox.qml
src/imports/controls/material/SpinBox.qml
src/imports/controls/universal/SpinBox.qml
tests/auto/controls/data/tst_swipedelegate.qml
Change-Id: Ie1d1f487890f0a9f80a00df5e813e1d2e8303fe5
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/calendar/qquickcalendar.cpp | 2 | ||||
-rw-r--r-- | src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc | 494 | ||||
-rw-r--r-- | src/quickcontrols2/qquickstyle.cpp | 29 | ||||
-rw-r--r-- | src/quickcontrols2/qquickstyle_p.h | 1 | ||||
-rw-r--r-- | src/quickcontrols2/qquickstyleattached.cpp | 15 | ||||
-rw-r--r-- | src/quicktemplates2/qquickdial.cpp | 14 | ||||
-rw-r--r-- | src/quicktemplates2/qquickdial_p.h | 2 | ||||
-rw-r--r-- | src/quicktemplates2/qquickoverlay.cpp | 17 | ||||
-rw-r--r-- | src/quicktemplates2/qquickoverlay_p_p.h | 1 | ||||
-rw-r--r-- | src/quicktemplates2/qquickswipedelegate.cpp | 15 |
10 files changed, 476 insertions, 114 deletions
diff --git a/src/imports/calendar/qquickcalendar.cpp b/src/imports/calendar/qquickcalendar.cpp index b64759f2..cb543012 100644 --- a/src/imports/calendar/qquickcalendar.cpp +++ b/src/imports/calendar/qquickcalendar.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE The Qt Labs Calendar module uses 0-based month numbers to be consistent with the JavaScript Date type, that is used by the QML language. This means that \c Date::getMonth() can be assigned to MonthGrid::month and - WeekNumberColumn::month as is. When dealing with dealing with month numbers + WeekNumberColumn::month as is. When dealing with month numbers directly, it is highly recommended to use the following enumeration values to avoid confusion. diff --git a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc index 5cb7a9a5..01429b94 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc @@ -109,20 +109,20 @@ \li Yes \li No \row - \li Runtime style changes - \li Yes - \li Yes + \li Runtime style/theme changes + \li Yes \sup 1 + \li Yes \sup 2 \row \li Can be used on Desktop \li Yes \li Yes \row \li Can be used on Mobile - \li Yes + \li Yes \sup 3 \li Yes \row \li Can be used on Embedded - \li Yes + \li Yes \sup 3 \li Yes \row \li Internal event handling @@ -130,6 +130,12 @@ \li C++ \endtable + \list 1 + \li Not officially supported, but technically possible via private APIs + \li Only themes for specific styles can be changed at runtime, styles are fixed + \li Performance may not be optimal + \endlist + \section2 Porting Qt Quick Controls Code The API of Qt Quick Controls 2 is very similar to Qt Quick Controls, but it @@ -179,191 +185,487 @@ This works with both modules, and will reduce the amount of work needed when the migration begins. - \section3 Type Comparison Table + \section2 Type Comparison Table + + The first column lists all types available in \l {Qt Quick Controls} + {Qt Quick Controls 1}, \l {Qt Quick Dialogs}, and \l {Qt Quick Extras}. + The second column documents the respective type in Qt Quick Controls 2. + When a direct alternative is not available, the third column contains + an alternative that provides related functionality. The last column + contains some remarks about the differences between the types in the + different modules. \table \header - \li Qt Quick Controls 1, Qt Quick Extras - \li Qt Quick Controls 2, Qt Labs Calendar - \row - \li \mdash - \li \l [QML QtQuickControls2] {AbstractButton} + \li Qt Quick Controls 1 + \li Qt Quick Controls 2 + \li Alternatives + \li Remarks \row \li \l [QML QtQuickControls] {Action} - \li \span {} {\mdash \nbsp \sub {(see \l [QML QtQuick] {Shortcut} instead)}} + \li \mdash + \li \l [QML QtQuick] {Shortcut} \br\sup {(Qt Quick)} + \li \list + \li \b {Qt Quick Controls 1}: \c Action is an abstract user interface + action that is bound to buttons and menu items, and can provide + shortcuts. + \li \b {Qt Quick}: \c Shortcut provides the shortcut functionality that + was previously only provided by \c Action. + \endlist \row \li \l [QML QtQuickControls] {ApplicationWindow} \li \l [QML QtQuickControls2] {ApplicationWindow} + \li + \li \row \li \l [QML QtQuickControls] {BusyIndicator} \li \l [QML QtQuickControls2] {BusyIndicator} + \li + \li \row \li \l [QML QtQuickControls] {Button} \li \l [QML QtQuickControls2] {Button} + \li + \li \row - \li \l [QML QtQuickExtras] {CircularGauge} + \li \l [QML QtQuickControls] {Calendar} \li \mdash + \li \l [QML QtLabsCalendar] {MonthGrid},\br + \l [QML QtLabsCalendar] {DayOfWeekRow},\br + \l [QML QtLabsCalendar] {WeekNumberColumn} \br\sup {(Qt Labs Calendar)} + \li \list + \li \b {Qt Labs Calendar}: \c MonthGrid, \c DayOfWeek, and \c WeekNumberColumn + are \e experimental unstyled building blocks for calendar views. + \endlist \row + \li \l [QML QtQuickControls] {CheckBox} + \li \l [QML QtQuickControls2] {CheckBox} + \li + \li + \row + \li \l [QML QtQuickControls] {ComboBox} + \li \l [QML QtQuickControls2] {ComboBox} + \li + \li \list + \li \b {Qt Quick Controls 2}: \c ComboBox is not editable. + \endlist + \row + \li \l [QML QtQuickControls] {ExclusiveGroup} \li \mdash - \li \l [QML QtQuickControls2] {Control} + \li \l [QML QtQuickControls2] {ButtonGroup} \br\sup {(Qt Quick Controls 2)} + \li \list + \li \b {Qt Quick Controls 2}: \c ButtonGroup offers similar functionality. + \endlist \row + \li \l [QML QtQuickControls] {GroupBox} + \li \l [QML QtQuickControls2] {GroupBox} + \li + \li + \row + \li \l [QML QtQuickControls] {Label} + \li \l [QML QtQuickControls2] {Label} + \li + \li + \row + \li \l [QML QtQuickControls] {Menu} + \li \l [QML QtQuickControls2] {Menu} + \li \l [QML QtLabsPlatform] {Menu} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Quick Controls 1}: \c Menu is native on platforms where an + implementation is available in the Qt Platform Abstraction Layer. + Other platforms use a QML-based top-level menu popup window. \c Menu + supports traditional desktop style cascading submenus, but does not + work on Embedded Linux because \l EGLFS does not support multiple + top-level windows. + \li \b {Qt Quick Controls 2}: \c Menu is a non-native \c Item-based popup + that is stacked above the application content. Due to this, menu popups + are restricted within window boundaries. \c Menu is fully customizable + using QML and Qt Quick, and allows adding any \c Items. Traditional + desktop oriented features, such as cascading submenus and visualizing + keyboard shortcuts are missing. + \li \b {Qt Labs Platform}: \c Menu is an \e experimental native menu that + uses Qt Widgets as a fallback on platforms where a native implementation + is not available in the Qt Platform Abstraction Layer. + \endlist + \row + \li \l [QML QtQuickControls] {MenuBar} \li \mdash - \li \l [QML QtQuickControls2] {Container} + \li \l [QML QtLabsPlatform] {MenuBar} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Quick Controls 1}: \c MenuBar is native on platforms where an + implementation is available in the Qt Platform Abstraction Layer. Other + platforms use a QML-based menubar item stacked at the top of the window. + \li \b {Qt Labs Platform}: \c MenuBar is an \e experimental native menubar. + It is only available on platforms where a native implementation is available + in the Qt Platform Abstraction Layer. + \endlist + \row + \li \l [QML QtQuickControls] {MenuItem},\br + \l [QML QtQuickControls] {MenuSeparator} + \li \l [QML QtQuickControls2] {MenuItem},\br + \l [QML QtQuickControls2] {MenuSeparator} + \li \l [QML QtLabsPlatform] {MenuItem},\br + \l [QML QtLabsPlatform] {MenuSeparator} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Quick Controls 1}: \c MenuItem and \c MenuSeparator are native + on platforms where an implementation is available in the Qt Platform + Abstraction Layer. Other platforms use QML-based menu items and separators. + \li \b {Qt Quick Controls 2}: \c MenuItem and \c MenuSeparator are a non-native + QML-based menu items and separators that can be fully customized using QML + and Qt Quick. + \li \b {Qt Labs Platform}: \c MenuItem and \c MenuSeparator are \e experimental + native menu items and separators. + \endlist \row - \li \l [QML QtQuickControls] {Calendar} - \li \l [QML QtLabsCalendar] {MonthGrid}, - \l [QML QtLabsCalendar] {DayOfWeekRow}, - \l [QML QtLabsCalendar] {WeekNumberColumn} + \li \l [QML QtQuickControls] {ProgressBar} + \li \l [QML QtQuickControls2] {ProgressBar} + \li + \li \row - \li \l [QML QtQuickControls] {CheckBox} - \li \l [QML QtQuickControls2] {CheckBox} + \li \l [QML QtQuickControls] {RadioButton} + \li \l [QML QtQuickControls2] {RadioButton} + \li + \li \row + \li \l [QML QtQuickControls] {ScrollView} \li \mdash - \li \l [QML QtQuickControls2] {CheckDelegate} + \li \l [QML QtQuickControls2] {ScrollBar},\br + \l [QML QtQuickControls2] {ScrollIndicator} \br\sup {(Qt Quick Controls 2)} + \li \list + \li \b {Qt Quick Controls 2}: \c ScrollBar and \c ScrollIndicator offer + similar functionality. They can be attached to any \c Flickable to + build scrollable views. + \endlist \row - \li \l [QML QtQuickControls] {ComboBox} - \li \l [QML QtQuickControls2] {ComboBox} + \li \l [QML QtQuickControls] {Slider} + \li \l [QML QtQuickControls2] {Slider} + \li + \li \row - \li \l [QML QtQuickExtras] {DelayButton} + \li \l [QML QtQuickControls] {SpinBox} + \li \l [QML QtQuickControls2] {SpinBox} + \li + \li + \row + \li \l [QML QtQuickControls] {SplitView} \li \mdash + \li + \li \row - \li \l [QML QtQuickExtras] {Dial} - \li \l [QML QtQuickControls2] {Dial} + \li \l [QML QtQuickControls] {StackView},\br + \l [QML QtQuickControls] {StackViewDelegate},\br + \l [QML QtQuickControls] {Stack} + \li \l [QML QtQuickControls2] {StackView} + \li + \li \list + \li \b {Qt Quick Controls 2}: \c StackView provides customizable transitions + and attached properties via a single \c StackView type. + \endlist \row + \li \l [QML QtQuickControls] {StatusBar} \li \mdash - \li \l [QML QtQuickControls2] {Drawer} + \li \l [QML QtQuickControls2] {ToolBar} \br\sup {(Qt Quick Controls 2)} + \li \list + \li \b {Qt Quick Controls 2}: \c ApplicationWindow allows assigning any + item or control, such as \c ToolBar, as a header or footer. + \endlist \row - \li \l [QML QtQuickControls] {ExclusiveGroup} - \li \l [QML QtQuickControls2] {ButtonGroup} + \li \l [QML QtQuickControls] {Switch} + \li \l [QML QtQuickControls2] {Switch} + \li + \li \row + \li \l [QML QtQuickControls] {TabView},\br + \l [QML QtQuickControls] {Tab} \li \mdash - \li \l [QML QtQuickControls2] {Frame} + \li \l [QML QtQuickControls2] {TabBar},\br + \l [QML QtQuickControls2] {TabButton} \br\sup {(Qt Quick Controls 2)} + \li \list + \li \b {Qt Quick Controls 2}: \c TabBar and \c TabButton offer similar + functionality, and can be used to build tabbed views. + \endlist \row - \li \l [QML QtQuickExtras] {Gauge} + \li \l [QML QtQuickControls] {TableView} \li \mdash + \li + \li \row - \li \l [QML QtQuickControls] {GroupBox} - \li \l [QML QtQuickControls2] {GroupBox} + \li \l [QML QtQuickControls] {TextArea} + \li \l [QML QtQuickControls2] {TextArea} + \li + \li \list + \li \b {Qt Quick Controls 1}: \c TextArea inherits \c ScrollView and is therefore + always a scrollable editor. + \li \b {Qt Quick Controls 2}: \c TextArea is a simpler multi-line editor that can + be optionally attached to a \c Flickable to provide scrolling functionality. + This allows using \c TextArea in a scrollable page without having two nested + scrollable areas, which can be problematic and cause usability issues. + \endlist \row - \li \mdash - \li \l [QML QtQuickControls2] {ItemDelegate} + \li \l [QML QtQuickControls] {TextField} + \li \l [QML QtQuickControls2] {TextField} + \li + \li \row - \li \l [QML QtQuickControls] {Label} - \li \l [QML QtQuickControls2] {Label} + \li \l [QML QtQuickControls] {ToolBar} + \li \l [QML QtQuickControls2] {ToolBar} + \li + \li \row - \li \l [QML QtQuickControls] {Menu} - \li \l [QML QtQuickControls2] {Menu} + \li \l [QML QtQuickControls] {ToolButton} + \li \l [QML QtQuickControls2] {ToolButton} + \li + \li \row - \li \l [QML QtQuickControls] {MenuBar} + \li \l [QML QtQuickControls] {TreeView} \li \mdash + \li + \li + + \header + \li Qt Quick Dialogs + \li Qt Quick Controls 2 + \li Alternatives + \li Remarks \row - \li \l [QML QtQuickControls] {MenuItem} - \li \l [QML QtQuickControls2] {MenuItem} - \row - \li \l [QML QtQuickControls] {MenuSeparator} - \li \l [QML QtQuickControls2] {MenuSeparator} + \li \l [QML QtQuickDialogs] {Dialog} + \li \mdash + \li \l [QML QtQuickControls2] {Dialog} + \li \list + \li \b {Qt Quick Dialogs}: \c Dialog is either a top-level window or an \c Item-based popup + depending on whether the underlying platform supports multiple top-level windows. + \li \b {Qt Quick Controls 2}: \c Dialog is not a top-level window, but an \c Item-based + popup that is stacked above the application content. Due to this, dialogs are restricted + within window boundaries. + \endlist + \row + \li \l [QML QtQuickDialogs] {ColorDialog},\br + \l [QML QtQuickDialogs] {FileDialog},\br + \l [QML QtQuickDialogs] {FontDialog},\br + \l [QML QtQuickDialogs] {MessageDialog} + \li \mdash + \li \l [QML QtLabsPlatform] {ColorDialog},\br + \l [QML QtLabsPlatform] {FileDialog},\br + \l [QML QtLabsPlatform] {FolderDialog},\br + \l [QML QtLabsPlatform] {FontDialog},\br + \l [QML QtLabsPlatform] {MessageDialog} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Quick Dialogs}: Dialogs are native on platforms where an implementation + is available in the Qt Platform Abstraction Layer. Other platforms use either + Qt Widgets or QML-based dialogs depending on whether the underlying platform + supports multiple top-level windows. + \li \b {Qt Labs Platform}: \e Experimental native dialogs that use Qt Widgets as + a fallback on platforms where a native implementation is not available in the + Qt Platform Abstraction Layer. + \endlist + + \header + \li Qt Quick Extras + \li Qt Quick Controls 2 + \li Alternatives + \li Remarks \row + \li \l [QML QtQuickExtras] {CircularGauge} \li \mdash - \li \l [QML QtQuickControls2] {Page} + \li + \li \row + \li \l [QML QtQuickExtras] {DelayButton} \li \mdash - \li \l [QML QtQuickControls2] {PageIndicator} + \li + \li \row + \li \l [QML QtQuickExtras] {Dial} + \li \l [QML QtQuickControls2] {Dial} + \li + \li + \row + \li \l [QML QtQuickExtras] {Gauge} \li \mdash - \li \l [QML QtQuickControls2] {Pane} + \li + \li \row \li \l [QML QtQuickExtras] {Picture} \li \mdash + \li + \li \row \li \l [QML QtQuickExtras] {PieMenu} \li \mdash + \li + \li \row + \li \l [QML QtQuickExtras] {StatusIndicator} \li \mdash - \li \l [QML QtQuickControls2] {Popup} + \li + \li \row - \li \l [QML QtQuickControls] {ProgressBar} - \li \l [QML QtQuickControls2] {ProgressBar} + \li \l [QML QtQuickExtras] {ToggleButton} + \li \mdash + \li + \li \row - \li \l [QML QtQuickControls] {RadioButton} - \li \l [QML QtQuickControls2] {RadioButton} + \li \l [QML QtQuickExtras] {Tumbler},\br + \l [QML QtQuickExtras] {TumblerColumn} + \li \l [QML QtQuickControls2] {Tumbler} + \li + \li \list + \li \b {Qt Quick Extras}: \c Tumbler can consist of multiple columns. + \li \b {Qt Quick Controls 2}: \c Tumbler presents a single spinnable wheel. + Multiple columns can be created by placing multiple \c Tumblers next + to each other. + \endlist + + \header + \li No Predecessor + \li Qt Quick Controls 2 + \li Alternatives + \li Remarks \row \li \mdash - \li \l [QML QtQuickControls2] {RadioDelegate} + \li \l [QML QtQuickControls2] {AbstractButton} + \li + \li \row \li \mdash - \li \l [QML QtQuickControls2] {RangeSlider} + \li \l [QML QtQuickControls2] {ButtonGroup} + \li \l [QML QtQuickControls] {ExclusiveGroup} \br\sup {(Qt Quick Controls 1)} + \li \list + \li \b {Qt Quick Controls 1}: \c ExclusiveGroup offers similar functionality. + \endlist \row - \li \l [QML QtQuickControls] {ScrollView} - \li \l [QML QtQuickControls2] {ScrollBar}, - \l [QML QtQuickControls2] {ScrollIndicator} + \li \mdash + \li \l [QML QtQuickControls2] {CheckDelegate} + \li + \li \row - \li \l [QML QtQuickControls] {Slider} - \li \l [QML QtQuickControls2] {Slider} + \li \mdash + \li \l [QML QtQuickControls2] {Container} + \li + \li \row - \li \l [QML QtQuickControls] {SplitView} \li \mdash + \li \l [QML QtQuickControls2] {Control} + \li + \li \row - \li \l [QML QtQuickControls] {SpinBox} - \li \l [QML QtQuickControls2] {SpinBox} + \li \mdash + \li \l [QML QtQuickControls2] {Drawer} + \li + \li \row - \li \l [QML QtQuickControls] {StackView}, - \l [QML QtQuickControls] {StackViewDelegate}, - \l [QML QtQuickControls] {Stack} - \li \l [QML QtQuickControls2] {StackView} + \li \mdash + \li \l [QML QtQuickControls2] {Frame} + \li + \li \row - \li \l [QML QtQuickControls] {StatusBar} \li \mdash + \li \l [QML QtQuickControls2] {ItemDelegate} + \li + \li \row - \li \l [QML QtQuickExtras] {StatusIndicator} \li \mdash + \li \l [QML QtQuickControls2] {Page} + \li + \li \row \li \mdash - \li \l [QML QtQuickControls2] {SwipeDelegate} + \li \l [QML QtQuickControls2] {PageIndicator} + \li + \li \row \li \mdash - \li \l [QML QtQuickControls2] {SwipeView} + \li \l [QML QtQuickControls2] {Pane} + \li + \li \row - \li \l [QML QtQuickControls] {Switch} - \li \l [QML QtQuickControls2] {Switch} + \li \mdash + \li \l [QML QtQuickControls2] {Popup} + \li + \li \row \li \mdash - \li \l [QML QtQuickControls2] {SwitchDelegate} + \li \l [QML QtQuickControls2] {RadioDelegate} + \li + \li \row - \li \l [QML QtQuickControls] {TabView}, - \l [QML QtQuickControls] {Tab} - \li \l [QML QtQuickControls2] {TabBar}, - \l [QML QtQuickControls2] {TabButton} + \li \mdash + \li \l [QML QtQuickControls2] {RangeSlider} + \li + \li \row - \li \l [QML QtQuickControls] {TableView} \li \mdash + \li \l [QML QtQuickControls2] {RoundButton} + \li + \li \row - \li \l [QML QtQuickControls] {TextArea} - \li \l [QML QtQuickControls2] {TextArea} + \li \mdash + \li \l [QML QtQuickControls2] {ScrollBar},\br + \l [QML QtQuickControls2] {ScrollIndicator} + \li \l [QML QtQuickControls] {ScrollView} \br\sup {(Qt Quick Controls 1)} + \li \list + \li \b {Qt Quick Controls 1}: \c ScrollView offers similar functionality. + It combines horizontal and vertical scrollbars, and the background and + frame around the scrollable view. + \endlist \row - \li \l [QML QtQuickControls] {TextField} - \li \l [QML QtQuickControls2] {TextField} + \li \mdash + \li \mdash + \li \l [QML QtLabsPlatform] {StandardPaths} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Quick Dialogs}: \c FileDialog offers a shortcut property that can be used + to access the most common standard paths. + \li \b {Qt Labs Platform}: \c StandardPaths offers a separate type to give full access + to the standard paths. + \endlist \row - \li \l [QML QtQuickExtras] {ToggleButton} \li \mdash + \li \l [QML QtQuickControls2] {SwipeDelegate} + \li + \li \row - \li \l [QML QtQuickControls] {ToolBar} - \li \l [QML QtQuickControls2] {ToolBar} + \li \mdash + \li \l [QML QtQuickControls2] {SwipeView} + \li + \li \row - \li \l [QML QtQuickControls] {ToolButton} - \li \l [QML QtQuickControls2] {ToolButton} + \li \mdash + \li \l [QML QtQuickControls2] {SwitchDelegate} + \li + \li \row \li \mdash - \li \l [QML QtQuickControls2] {ToolSeparator} + \li \mdash + \li \l [QML QtLabsPlatform] {SystemTrayIcon} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Labs Platform}: \c SystemTrayIcon is an \e experimental native + system tray icon that uses Qt Widgets as a fallback on platforms where + a native implementation is not available in the Qt Platform Abstraction + Layer. + \endlist \row \li \mdash - \li \l [QML QtQuickControls2] {ToolTip} + \li \l [QML QtQuickControls2] {TabBar},\br + \l [QML QtQuickControls2] {TabButton} + \li \l [QML QtQuickControls] {TabView} \br\sup {(Qt Quick Controls 1)} + \li \list + \li \b {Qt Quick Controls 1}: \c TabView offers similar functionality. + It combines the tab bar, background and frame around the tabs. + \endlist \row - \li \l [QML QtQuickControls] {TreeView} \li \mdash + \li \l [QML QtQuickControls2] {ToolSeparator} + \li + \li \row - \li \l [QML QtQuickExtras] {Tumbler}, - \l [QML QtQuickExtras] {TumblerColumn} - \li \l [QML QtQuickControls2] {Tumbler} + \li \mdash + \li \l [QML QtQuickControls2] {ToolTip} + \li + \li \list + \li \b {Qt Quick Controls 1}: \c Button and \c Action have built-in + Qt Widgets-based tooltips. + \li \b {Qt Quick Controls 2}: \c ToolTip can be attached to any \c Item. + \endlist \endtable \section1 Related Information @@ -373,5 +675,7 @@ \li \l{Qt Quick Controls 2 QML Types} \li \l{Qt Quick Controls QML Types} \li \l{Qt Quick Extras QML Types} + \li \l{Qt Labs Calendar QML Types} + \li \l{Qt Labs Platform QML Types} \endlist */ diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp index aa168301..cf4979c1 100644 --- a/src/quickcontrols2/qquickstyle.cpp +++ b/src/quickcontrols2/qquickstyle.cpp @@ -183,6 +183,15 @@ struct QQuickStyleSpec setFallbackStyle(settings->value(QStringLiteral("FallbackStyle")).toString(), ":/qtquickcontrols2.conf"); } } + + // resolve a path relative to the config + QString configPath = QFileInfo(resolveConfigFilePath()).path(); + QString stylePath = findStyle(configPath, style); + if (!stylePath.isEmpty()) { + style = stylePath; + resolved = true; + } + custom = style.contains(QLatin1Char('/')); if (baseUrl.isValid()) { @@ -220,11 +229,26 @@ struct QQuickStyleSpec fallbackMethod.clear(); } + QString resolveConfigFilePath() + { + if (configFilePath.isEmpty()) { + configFilePath = QFile::decodeName(qgetenv("QT_QUICK_CONTROLS_CONF")); + if (!QFile::exists(configFilePath)) { + if (!configFilePath.isEmpty()) + qWarning("QT_QUICK_CONTROLS_CONF=%s: No such file", qPrintable(configFilePath)); + + configFilePath = QStringLiteral(":/qtquickcontrols2.conf"); + } + } + return configFilePath; + } + bool custom; bool resolved; QString style; QString fallbackStyle; QByteArray fallbackMethod; + QString configFilePath; }; Q_GLOBAL_STATIC(QQuickStyleSpec, styleSpec) @@ -282,6 +306,11 @@ void QQuickStylePrivate::reset() styleSpec()->reset(); } +QString QQuickStylePrivate::configFilePath() +{ + return styleSpec()->resolveConfigFilePath(); +} + /*! Returns the name of the application style. diff --git a/src/quickcontrols2/qquickstyle_p.h b/src/quickcontrols2/qquickstyle_p.h index a893d20a..1655f805 100644 --- a/src/quickcontrols2/qquickstyle_p.h +++ b/src/quickcontrols2/qquickstyle_p.h @@ -61,6 +61,7 @@ public: static bool isCustomStyle(); static void init(const QUrl &baseUrl); static void reset(); + static QString configFilePath(); }; QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickstyleattached.cpp b/src/quickcontrols2/qquickstyleattached.cpp index 2ef07fd6..d1f27ff3 100644 --- a/src/quickcontrols2/qquickstyleattached.cpp +++ b/src/quickcontrols2/qquickstyleattached.cpp @@ -35,6 +35,7 @@ ****************************************************************************/ #include "qquickstyleattached_p.h" +#include "qquickstyle_p.h" #include <QtCore/qfile.h> #include <QtCore/qsettings.h> @@ -167,18 +168,6 @@ static QList<QQuickStyleAttached *> findChildStyles(const QMetaObject *type, QOb return children; } -static QString resolveConfigFile() -{ - QString filePath = QFile::decodeName(qgetenv("QT_QUICK_CONTROLS_CONF")); - if (!QFile::exists(filePath)) { - if (!filePath.isEmpty()) - qWarning("QT_QUICK_CONTROLS_CONF=%s: No such file", qPrintable(filePath)); - - filePath = QStringLiteral(":/qtquickcontrols2.conf"); - } - return filePath; -} - QQuickStyleAttached::QQuickStyleAttached(QObject *parent) : QObject(parent) { QQuickItem *item = qobject_cast<QQuickItem *>(parent); @@ -208,7 +197,7 @@ QQuickStyleAttached::~QQuickStyleAttached() QSharedPointer<QSettings> QQuickStyleAttached::settings(const QString &group) { #ifndef QT_NO_SETTINGS - static const QString filePath = resolveConfigFile(); + const QString filePath = QQuickStylePrivate::configFilePath(); if (QFile::exists(filePath)) { QFileSelector selector; QSettings *settings = new QSettings(selector.select(filePath), QSettings::IniFormat); diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp index 2932f4ce..7bfc0487 100644 --- a/src/quicktemplates2/qquickdial.cpp +++ b/src/quicktemplates2/qquickdial.cpp @@ -657,6 +657,20 @@ void QQuickDial::mouseUngrabEvent() setPressed(false); } +void QQuickDial::wheelEvent(QWheelEvent *event) +{ + Q_D(QQuickDial); + QQuickControl::wheelEvent(event); + if (d->wheelEnabled) { + const qreal oldValue = d->value; + const QPointF angle = event->angleDelta(); + const qreal delta = (qFuzzyIsNull(angle.y()) ? angle.x() : angle.y()) / QWheelEvent::DefaultDeltasPerStep; + const qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize; + setValue(oldValue + step * delta); + event->setAccepted(!qFuzzyCompare(d->value, oldValue)); + } +} + void QQuickDial::mirrorChange() { QQuickControl::mirrorChange(); diff --git a/src/quicktemplates2/qquickdial_p.h b/src/quicktemplates2/qquickdial_p.h index cd45ad0e..cfaf1f32 100644 --- a/src/quicktemplates2/qquickdial_p.h +++ b/src/quicktemplates2/qquickdial_p.h @@ -138,6 +138,8 @@ protected: void mouseMoveEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; void mouseUngrabEvent() override; + void wheelEvent(QWheelEvent *event) override; + void mirrorChange() override; void componentComplete() override; diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index 55fecb15..27b66aee 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -194,6 +194,13 @@ void QQuickOverlayPrivate::removePopup(QQuickPopup *popup) q->setVisible(!allDrawers.isEmpty() || !q->childItems().isEmpty()); } +void QQuickOverlayPrivate::setMouseGrabberPopup(QQuickPopup *popup) +{ + if (popup && !popup->isVisible()) + popup = nullptr; + mouseGrabberPopup = popup; +} + QQuickOverlay::QQuickOverlay(QQuickItem *parent) : QQuickItem(*(new QQuickOverlayPrivate), parent) { @@ -327,7 +334,7 @@ void QQuickOverlay::mousePressEvent(QMouseEvent *event) for (QQuickDrawer *drawer : drawers) { QQuickDrawerPrivate *p = QQuickDrawerPrivate::get(drawer); if (p->startDrag(window(), event)) { - d->mouseGrabberPopup = drawer; + d->setMouseGrabberPopup(drawer); return; } } @@ -337,7 +344,7 @@ void QQuickOverlay::mousePressEvent(QMouseEvent *event) const auto popups = d->stackingOrderPopups(); for (QQuickPopup *popup : popups) { if (popup->overlayEvent(this, event)) { - d->mouseGrabberPopup = popup; + d->setMouseGrabberPopup(popup); return; } } @@ -360,7 +367,7 @@ void QQuickOverlay::mouseReleaseEvent(QMouseEvent *event) if (d->mouseGrabberPopup) { d->mouseGrabberPopup->overlayEvent(this, event); - d->mouseGrabberPopup = nullptr; + d->setMouseGrabberPopup(nullptr); } else { const auto popups = d->stackingOrderPopups(); for (QQuickPopup *popup : popups) { @@ -406,7 +413,7 @@ bool QQuickOverlay::childMouseEventFilter(QQuickItem *item, QEvent *event) case QEvent::MouseButtonPress: emit pressed(); if (popup->overlayEvent(item, event)) { - d->mouseGrabberPopup = popup; + d->setMouseGrabberPopup(popup); return true; } break; @@ -414,7 +421,7 @@ bool QQuickOverlay::childMouseEventFilter(QQuickItem *item, QEvent *event) return popup->overlayEvent(item, event); case QEvent::MouseButtonRelease: emit released(); - d->mouseGrabberPopup = nullptr; + d->setMouseGrabberPopup(nullptr); return popup->overlayEvent(item, event); default: break; diff --git a/src/quicktemplates2/qquickoverlay_p_p.h b/src/quicktemplates2/qquickoverlay_p_p.h index ef142f1b..b10bfe83 100644 --- a/src/quicktemplates2/qquickoverlay_p_p.h +++ b/src/quicktemplates2/qquickoverlay_p_p.h @@ -72,6 +72,7 @@ public: void addPopup(QQuickPopup *popup); void removePopup(QQuickPopup *popup); + void setMouseGrabberPopup(QQuickPopup *popup); void popupAboutToShow(); void popupAboutToHide(); diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp index e660cfa2..2f7e7382 100644 --- a/src/quicktemplates2/qquickswipedelegate.cpp +++ b/src/quicktemplates2/qquickswipedelegate.cpp @@ -775,6 +775,21 @@ bool QQuickSwipeDelegatePrivate::handleMouseReleaseEvent(QQuickItem *item, QMous const bool hadGrabbedMouse = q->keepMouseGrab(); q->setKeepMouseGrab(false); + // Animations for the background and contentItem delegates are typically + // only enabled when !control.down, so that the animations aren't running + // when the user is swiping. To ensure that the animations are enabled + // *before* the positions of these delegates change (via the swipe.setPosition() calls below), + // we must cancel the press. QQuickAbstractButton::mouseUngrabEvent() does this + // for us, but by then it's too late. + if (hadGrabbedMouse) { + // TODO: this is copied from QQuickAbstractButton::mouseUngrabEvent(). + // Eventually it should be moved into a private helper so that we don't have to duplicate it. + q->setPressed(false); + stopPressRepeat(); + stopPressAndHold(); + emit q->canceled(); + } + // The control can be exposed by either swiping past the halfway mark, or swiping fast enough. const qreal swipeVelocity = swipePrivate->velocityCalculator.velocity().x(); if (swipePrivate->position > 0.5 || |