diff options
Diffstat (limited to 'src/controls')
52 files changed, 292 insertions, 78 deletions
diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml index 4c30664d..fa2d1b51 100644 --- a/src/controls/ApplicationWindow.qml +++ b/src/controls/ApplicationWindow.qml @@ -45,6 +45,7 @@ import QtQuick.Controls.Private 1.0 \since 5.1 \inqmlmodule QtQuick.Controls \ingroup applicationwindow + \ingroup controls \brief Provides a top-level application window. \image applicationwindow.png diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index a2eff0b6..4e29dfe9 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -145,6 +145,50 @@ Control { */ property alias editText: input.text + /*! \qmlproperty enumeration ComboBox::inputMethodHints + \since QtQuick.Controls 1.5 + Provides hints to the input method about the expected content of the combo box and how it + should operate. + + The value is a bit-wise combination of flags or \c Qt.ImhNone if no hints are set. + + Flags that alter behavior are: + + \list + \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords. + \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method + in any persistent storage like predictive user dictionary. + \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case + when a sentence ends. + \li Qt.ImhPreferNumbers - Numbers are preferred (but not required). + \li Qt.ImhPreferUppercase - Upper case letters are preferred (but not required). + \li Qt.ImhPreferLowercase - Lower case letters are preferred (but not required). + \li Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing. + + \li Qt.ImhDate - The text editor functions as a date field. + \li Qt.ImhTime - The text editor functions as a time field. + \endlist + + Flags that restrict input (exclusive flags) are: + + \list + \li Qt.ImhDigitsOnly - Only digits are allowed. + \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign. + \li Qt.ImhUppercaseOnly - Only upper case letter input is allowed. + \li Qt.ImhLowercaseOnly - Only lower case letter input is allowed. + \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed. + \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed. + \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed. + \endlist + + Masks: + + \list + \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used. + \endlist + */ + property alias inputMethodHints: input.inputMethodHints + /*! This property specifies whether the combobox should gain active focus when pressed. The default value is \c false. */ property bool activeFocusOnPress: false @@ -511,6 +555,8 @@ Control { onTextRoleChanged: popup.resolveTextValue(textRole) + ExclusiveGroup { id: eg } + Menu { id: popup objectName: "popup" @@ -536,8 +582,6 @@ Control { __minimumWidth: comboBox.width __visualItem: comboBox - property ExclusiveGroup eg: ExclusiveGroup { id: eg } - property bool modelIsArray: false Instantiator { diff --git a/src/controls/Menu.qml b/src/controls/Menu.qml index 037fa550..d485cb65 100644 --- a/src/controls/Menu.qml +++ b/src/controls/Menu.qml @@ -44,6 +44,7 @@ import QtQuick.Controls.Private 1.0 \inqmlmodule QtQuick.Controls \since 5.1 \ingroup menus + \ingroup controls \brief Provides a menu component for use as a context menu, popup menu, or as part of a menu bar. diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml index 444185cc..a16635ff 100644 --- a/src/controls/MenuBar.qml +++ b/src/controls/MenuBar.qml @@ -44,6 +44,7 @@ import QtQuick.Controls.Private 1.0 \inqmlmodule QtQuick.Controls \since 5.1 \ingroup applicationwindow + \ingroup controls \brief Provides a horizontal menu bar. \image menubar.png diff --git a/src/controls/Private/AbstractCheckable.qml b/src/controls/Private/AbstractCheckable.qml index 42abebe5..bca626e0 100644 --- a/src/controls/Private/AbstractCheckable.qml +++ b/src/controls/Private/AbstractCheckable.qml @@ -41,7 +41,6 @@ import QtQuick.Controls.Private 1.0 /*! \qmltype AbstractCheckable \inqmlmodule QtQuick.Controls - \ingroup controls \brief An abstract representation of a checkable control with a label \qmlabstract \internal diff --git a/src/controls/Private/BasicButton.qml b/src/controls/Private/BasicButton.qml index 1756a296..346cd419 100644 --- a/src/controls/Private/BasicButton.qml +++ b/src/controls/Private/BasicButton.qml @@ -38,6 +38,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Styles 1.1 +import QtQuick.Window 2.2 /*! \qmltype BasicButton @@ -206,7 +207,7 @@ Control { Timer { interval: 1000 - running: behavior.containsMouse && !pressed && tooltip.length + running: behavior.containsMouse && !pressed && tooltip.length && behavior.Window.visibility !== Window.Hidden onTriggered: Tooltip.showText(behavior, Qt.point(behavior.mouseX, behavior.mouseY), tooltip) } } diff --git a/src/controls/Private/BasicTableView.qml b/src/controls/Private/BasicTableView.qml index 27635bc9..5fd21167 100644 --- a/src/controls/Private/BasicTableView.qml +++ b/src/controls/Private/BasicTableView.qml @@ -94,6 +94,7 @@ ScrollView { property Component itemDelegate: __style ? __style.itemDelegate : null /*! \qmlproperty Component BasicTableView::rowDelegate + \keyword basictableview-rowdelegate This property defines a delegate to draw a row. @@ -116,6 +117,7 @@ ScrollView { property Component rowDelegate: __style ? __style.rowDelegate : null /*! \qmlproperty Component BasicTableView::headerDelegate + \keyword basictableview-headerdelegate This property defines a delegate to draw a header. diff --git a/src/controls/Private/Control.qml b/src/controls/Private/Control.qml index f4733cc5..4b965482 100644 --- a/src/controls/Private/Control.qml +++ b/src/controls/Private/Control.qml @@ -72,19 +72,20 @@ FocusScope { property alias __styleData: styleLoader.styleData Loader { + id: styleLoader + sourceComponent: style + property Item __control: root + property QtObject styleData: null + onStatusChanged: { + if (status === Loader.Error) + console.error("Failed to load Style for", root) + } + } + + Loader { id: panelLoader anchors.fill: parent sourceComponent: __style ? __style.panel : null onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root) - Loader { - id: styleLoader - sourceComponent: style - property Item __control: root - property QtObject styleData: null - onStatusChanged: { - if (status === Loader.Error) - console.error("Failed to load Style for", root) - } - } } } diff --git a/src/controls/Private/EditMenu.qml b/src/controls/Private/EditMenu.qml index 51abe758..a70e8407 100644 --- a/src/controls/Private/EditMenu.qml +++ b/src/controls/Private/EditMenu.qml @@ -45,8 +45,9 @@ Loader { property Item selectionHandle property Flickable flickable property Component defaultMenu: item && item.defaultMenu ? item.defaultMenu : null - property Menu menuInstance: null + property QtObject menuInstance: null property MouseArea mouseArea + property QtObject style: __style Connections { target: control @@ -67,6 +68,18 @@ Loader { return menuInstance; } - source: Qt.resolvedUrl(Qt.platform.os === "ios" ? "EditMenu_ios.qml" - : Qt.platform.os === "android" ? "" : "EditMenu_base.qml") + function syncStyle() { + if (!style) + return; + + if (style.__editMenu) + sourceComponent = style.__editMenu; + else { + // todo: get ios/android/base menus from style as well + source = (Qt.resolvedUrl(Qt.platform.os === "ios" ? "EditMenu_ios.qml" + : Qt.platform.os === "android" ? "" : "EditMenu_base.qml")); + } + } + onStyleChanged: syncStyle(); + Component.onCompleted: syncStyle(); } diff --git a/src/controls/Private/MenuContentItem.qml b/src/controls/Private/MenuContentItem.qml index a0b346c4..e3be2e44 100644 --- a/src/controls/Private/MenuContentItem.qml +++ b/src/controls/Private/MenuContentItem.qml @@ -174,7 +174,7 @@ Loader { id: menuItemLoader Accessible.role: opts.type === MenuItemType.Item || opts.type === MenuItemType.Menu ? - Accessible.MenuItem : Acccessible.NoRole + Accessible.MenuItem : Accessible.NoRole Accessible.name: StyleHelpers.removeMnemonics(opts.text) Accessible.checkable: opts.checkable Accessible.checked: opts.checked diff --git a/src/controls/Private/TreeViewItemDelegateLoader.qml b/src/controls/Private/TreeViewItemDelegateLoader.qml index c4e13729..8b8801fc 100644 --- a/src/controls/Private/TreeViewItemDelegateLoader.qml +++ b/src/controls/Private/TreeViewItemDelegateLoader.qml @@ -98,6 +98,7 @@ TableViewItemDelegateLoader { visible: itemDelegateLoader.width > __itemIndentation sourceComponent: __style && __style.__branchDelegate || null anchors.right: parent.item ? parent.item.left : undefined + anchors.rightMargin: __style.__indentation > width ? (__style.__indentation - width) / 2 : 0 anchors.verticalCenter: parent.verticalCenter property QtObject styleData: itemDelegateLoader.styleData onLoaded: if (__rowItem) __rowItem.branchDecoration = item diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp index 55850bf0..8483830b 100644 --- a/src/controls/Private/qquickcontrolsettings.cpp +++ b/src/controls/Private/qquickcontrolsettings.cpp @@ -98,6 +98,9 @@ bool QQuickControlSettings::isMobile() const #if defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || defined(Q_OS_BLACKBERRY) || defined(Q_OS_QNX) || defined(Q_OS_WINRT) return true; #else + if (qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MOBILE")) { + return true; + } return false; #endif } @@ -112,7 +115,7 @@ QString QQuickControlSettings::makeStyleComponentPath(const QString &controlStyl return styleDirPath + QStringLiteral("/") + controlStyleName; } -QUrl QQuickControlSettings::makeStyleComponentUrl(const QString &controlStyleName, QString styleDirPath) +QUrl QQuickControlSettings::makeStyleComponentUrl(const QString &controlStyleName, const QString &styleDirPath) { QString styleFilePath = makeStyleComponentPath(controlStyleName, styleDirPath); diff --git a/src/controls/Private/qquickcontrolsettings_p.h b/src/controls/Private/qquickcontrolsettings_p.h index 1b99fd3e..6a4e8c6a 100644 --- a/src/controls/Private/qquickcontrolsettings_p.h +++ b/src/controls/Private/qquickcontrolsettings_p.h @@ -90,7 +90,7 @@ private: void findStyle(QQmlEngine *engine, const QString &styleName); bool resolveCurrentStylePath(); QString makeStyleComponentPath(const QString &controlStyleName, const QString &styleDirPath); - QUrl makeStyleComponentUrl(const QString &controlStyleName, QString styleDirPath); + QUrl makeStyleComponentUrl(const QString &controlStyleName, const QString &styleDirPath); struct StyleData { diff --git a/src/controls/Private/qquicktreemodeladaptor.cpp b/src/controls/Private/qquicktreemodeladaptor.cpp index 87b2808e..666fafc9 100644 --- a/src/controls/Private/qquicktreemodeladaptor.cpp +++ b/src/controls/Private/qquicktreemodeladaptor.cpp @@ -120,6 +120,29 @@ void QQuickTreeModelAdaptor::clearModelData() endResetModel(); } +const QModelIndex &QQuickTreeModelAdaptor::rootIndex() const +{ + return m_rootIndex; +} + +void QQuickTreeModelAdaptor::setRootIndex(const QModelIndex &idx) +{ + if (m_rootIndex == idx) + return; + + if (m_model) + clearModelData(); + m_rootIndex = idx; + if (m_model) + showModelTopLevelItems(); + emit rootIndexChanged(); +} + +void QQuickTreeModelAdaptor::resetRootIndex() +{ + setRootIndex(QModelIndex()); +} + QHash<int, QByteArray> QQuickTreeModelAdaptor::roleNames() const { if (!m_model) @@ -180,7 +203,7 @@ bool QQuickTreeModelAdaptor::setData(const QModelIndex &index, const QVariant &v int QQuickTreeModelAdaptor::itemIndex(const QModelIndex &index) const { // This is basically a plagiarism of QTreeViewPrivate::viewIndex() - if (!index.isValid() || m_items.isEmpty()) + if (!index.isValid() || index == m_rootIndex || m_items.isEmpty()) return -1; const int totalCount = m_items.count(); @@ -226,7 +249,7 @@ bool QQuickTreeModelAdaptor::isVisible(const QModelIndex &index) bool QQuickTreeModelAdaptor::childrenVisible(const QModelIndex &index) { - return (!index.isValid() && !m_items.isEmpty()) + return (index == m_rootIndex && !m_items.isEmpty()) || (m_expandedItems.contains(index) && isVisible(index)); } @@ -302,21 +325,21 @@ void QQuickTreeModelAdaptor::showModelTopLevelItems(bool doInsertRows) if (!m_model) return; - if (m_model->hasChildren(QModelIndex()) && m_model->canFetchMore(QModelIndex())) - m_model->fetchMore(QModelIndex()); - const long topLevelRowCount = m_model->rowCount(); + if (m_model->hasChildren(m_rootIndex) && m_model->canFetchMore(m_rootIndex)) + m_model->fetchMore(m_rootIndex); + const long topLevelRowCount = m_model->rowCount(m_rootIndex); if (topLevelRowCount == 0) return; - showModelChildItems(TreeItem(), 0, topLevelRowCount - 1, doInsertRows); + showModelChildItems(TreeItem(m_rootIndex), 0, topLevelRowCount - 1, doInsertRows); } void QQuickTreeModelAdaptor::showModelChildItems(const TreeItem &parentItem, int start, int end, bool doInsertRows, bool doExpandPendingRows) { const QModelIndex &parentIndex = parentItem.index; - int rowIdx = parentIndex.isValid() ? itemIndex(parentIndex) + 1 : 0; + int rowIdx = parentIndex.isValid() && parentIndex != m_rootIndex ? itemIndex(parentIndex) + 1 : 0; Q_ASSERT(rowIdx == 0 || parentItem.expanded); - if (parentIndex.isValid() && (rowIdx == 0 || !parentItem.expanded)) + if (parentIndex.isValid() && parentIndex != m_rootIndex && (rowIdx == 0 || !parentItem.expanded)) return; if (m_model->rowCount(parentIndex) == 0) { @@ -603,8 +626,11 @@ void QQuickTreeModelAdaptor::modelRowsInserted(const QModelIndex & parent, int s ASSERT_CONSISTENCY(); return; } - } else if (parent.isValid()) { + } else if (parent == m_rootIndex) { item = TreeItem(parent); + } else { + ASSERT_CONSISTENCY(); + return; } showModelChildItems(item, start, end); ASSERT_CONSISTENCY(); @@ -612,10 +638,8 @@ void QQuickTreeModelAdaptor::modelRowsInserted(const QModelIndex & parent, int s void QQuickTreeModelAdaptor::modelRowsAboutToBeRemoved(const QModelIndex & parent, int start, int end) { - Q_UNUSED(start); - Q_UNUSED(end); ASSERT_CONSISTENCY(); - if (!parent.isValid() || childrenVisible(parent)) { + if (parent == m_rootIndex || childrenVisible(parent)) { const QModelIndex &smi = m_model->index(start, 0, parent); int startIndex = itemIndex(smi); const QModelIndex &emi = m_model->index(end, 0, parent); @@ -756,9 +780,9 @@ bool QQuickTreeModelAdaptor::testConsistency(bool dumpOnFail) const } return true; } - QModelIndex parent; + QModelIndex parent = m_rootIndex; QStack<QModelIndex> ancestors; - QModelIndex idx = m_model->index(0, 0); + QModelIndex idx = m_model->index(0, 0, parent); for (int i = 0; i < m_items.count(); i++) { bool isConsistent = true; const TreeItem &item = m_items.at(i); diff --git a/src/controls/Private/qquicktreemodeladaptor_p.h b/src/controls/Private/qquicktreemodeladaptor_p.h index 2297c365..3eefbe77 100644 --- a/src/controls/Private/qquicktreemodeladaptor_p.h +++ b/src/controls/Private/qquicktreemodeladaptor_p.h @@ -61,6 +61,7 @@ class QQuickTreeModelAdaptor : public QAbstractListModel { Q_OBJECT Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(QModelIndex rootIndex READ rootIndex WRITE setRootIndex RESET resetRootIndex NOTIFY rootIndexChanged) struct TreeItem; @@ -68,6 +69,9 @@ public: explicit QQuickTreeModelAdaptor(QObject *parent = 0); QAbstractItemModel *model() const; + const QModelIndex &rootIndex() const; + void setRootIndex(const QModelIndex &idx); + void resetRootIndex(); enum { DepthRole = Qt::UserRole - 4, @@ -110,6 +114,7 @@ public: signals: void modelChanged(QAbstractItemModel *model); + void rootIndexChanged(); void expanded(const QModelIndex &index); void collapsed(const QModelIndex &index); @@ -149,6 +154,7 @@ private: }; QPointer<QAbstractItemModel> m_model; + QPersistentModelIndex m_rootIndex; QList<TreeItem> m_items; QSet<QPersistentModelIndex> m_expandedItems; QList<TreeItem *> m_itemsToExpand; diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index 5c21848f..74d5ee7d 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -44,6 +44,7 @@ import QtQuick.Controls.Styles 1.1 \inqmlmodule QtQuick.Controls \since 5.1 \ingroup views + \ingroup controls \brief Provides a scrolling view within another Item. \image scrollview.png diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml index 41c50329..c2e361ac 100644 --- a/src/controls/SplitView.qml +++ b/src/controls/SplitView.qml @@ -45,6 +45,7 @@ import QtQuick.Window 2.1 \inqmlmodule QtQuick.Controls \since 5.1 \ingroup views + \ingroup controls \brief Lays out items with a draggable splitter between each item. \image splitview.png diff --git a/src/controls/StackView.qml b/src/controls/StackView.qml index 26772781..c76459ff 100644 --- a/src/controls/StackView.qml +++ b/src/controls/StackView.qml @@ -42,6 +42,7 @@ import QtQuick.Controls.Private 1.0 \qmltype StackView \inherits Item \ingroup views + \ingroup controls \inqmlmodule QtQuick.Controls \since 5.1 diff --git a/src/controls/StackViewDelegate.qml b/src/controls/StackViewDelegate.qml index c837c281..a1dacb21 100644 --- a/src/controls/StackViewDelegate.qml +++ b/src/controls/StackViewDelegate.qml @@ -39,6 +39,7 @@ import QtQuick 2.2 /*! \qmltype StackViewDelegate \inqmlmodule QtQuick.Controls + \ingroup controls \since 5.1 \brief A delegate used by StackView for loading transitions. diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml index f151a3ac..468d3587 100644 --- a/src/controls/StatusBar.qml +++ b/src/controls/StatusBar.qml @@ -43,6 +43,7 @@ import QtQuick.Controls.Private 1.0 \inqmlmodule QtQuick.Controls \since 5.1 \ingroup applicationwindow + \ingroup controls \brief Contains status information in your app. The common way of using StatusBar is in relation to \l ApplicationWindow. diff --git a/src/controls/Styles/Base/BasicTableViewStyle.qml b/src/controls/Styles/Base/BasicTableViewStyle.qml index 973d09c0..c8d817c9 100644 --- a/src/controls/Styles/Base/BasicTableViewStyle.qml +++ b/src/controls/Styles/Base/BasicTableViewStyle.qml @@ -94,7 +94,8 @@ ScrollViewStyle { anchors.fill: parent verticalAlignment: Text.AlignVCenter horizontalAlignment: styleData.textAlignment - anchors.leftMargin: 12 + anchors.leftMargin: horizontalAlignment === Text.AlignLeft ? 12 : 1 + anchors.rightMargin: horizontalAlignment === Text.AlignRight ? 8 : 1 text: styleData.value elide: Text.ElideRight color: textColor @@ -137,8 +138,9 @@ ScrollViewStyle { Text { id: label objectName: "label" - width: parent.width - x - x: styleData.depth && styleData.column === 0 ? 0 : 8 + width: parent.width - x - (horizontalAlignment === Text.AlignRight ? 8 : 1) + x: (styleData.hasOwnProperty("depth") && styleData.column === 0) ? 0 : + horizontalAlignment === Text.AlignRight ? 1 : 8 horizontalAlignment: styleData.textAlignment anchors.verticalCenter: parent.verticalCenter anchors.verticalCenterOffset: 1 diff --git a/src/controls/Styles/Base/ScrollViewStyle.qml b/src/controls/Styles/Base/ScrollViewStyle.qml index ed72951f..09bc7da3 100644 --- a/src/controls/Styles/Base/ScrollViewStyle.qml +++ b/src/controls/Styles/Base/ScrollViewStyle.qml @@ -43,6 +43,7 @@ import QtQuick.Controls.Private 1.0 \inqmlmodule QtQuick.Controls.Styles \since 5.1 \ingroup viewsstyling + \ingroup controlsstyling \brief Provides custom styling for ScrollView */ Style { diff --git a/src/controls/Styles/Base/TabViewStyle.qml b/src/controls/Styles/Base/TabViewStyle.qml index 4842c39a..94cc1240 100644 --- a/src/controls/Styles/Base/TabViewStyle.qml +++ b/src/controls/Styles/Base/TabViewStyle.qml @@ -43,6 +43,7 @@ import QtQuick.Controls.Private 1.0 \inqmlmodule QtQuick.Controls.Styles \since 5.1 \ingroup viewsstyling + \ingroup controlsstyling \brief Provides custom styling for TabView \qml diff --git a/src/controls/Styles/Base/TextAreaStyle.qml b/src/controls/Styles/Base/TextAreaStyle.qml index 678d365d..1da52227 100644 --- a/src/controls/Styles/Base/TextAreaStyle.qml +++ b/src/controls/Styles/Base/TextAreaStyle.qml @@ -146,4 +146,10 @@ ScrollViewStyle { \since QtQuick.Controls.Styles 1.3 */ property Component __cursorDelegate + + /*! \internal + The delegate for the cut/copy/paste menu. + \since QtQuick.Controls.Styles 1.4 + */ + property Component __editMenu } diff --git a/src/controls/Styles/Base/TextFieldStyle.qml b/src/controls/Styles/Base/TextFieldStyle.qml index e9247416..b5e024b4 100644 --- a/src/controls/Styles/Base/TextFieldStyle.qml +++ b/src/controls/Styles/Base/TextFieldStyle.qml @@ -209,4 +209,10 @@ Style { \since QtQuick.Controls.Styles 1.3 */ property Component __cursorDelegate + + /*! \internal + The delegate for the cut/copy/paste menu. + \since QtQuick.Controls.Styles 1.4 + */ + property Component __editMenu } diff --git a/src/controls/Styles/Base/TreeViewStyle.qml b/src/controls/Styles/Base/TreeViewStyle.qml index b8f03f65..e90542fe 100644 --- a/src/controls/Styles/Base/TreeViewStyle.qml +++ b/src/controls/Styles/Base/TreeViewStyle.qml @@ -43,10 +43,10 @@ BasicTableViewStyle { readonly property TreeView control: __control - property int indentation: 12 + property int indentation: 16 property Component branchDelegate: Item { - width: 16 + width: indentation height: 16 Text { visible: styleData.column === 0 && styleData.hasChildren @@ -54,8 +54,9 @@ BasicTableViewStyle { color: !control.activeFocus || styleData.selected ? styleData.textColor : "#666" font.pointSize: 10 renderType: Text.NativeRendering + style: Text.PlainText anchors.centerIn: parent - anchors.verticalCenterOffset: styleData.isExpanded ? 2 : 0 + anchors.verticalCenterOffset: 2 } } diff --git a/src/controls/Styles/Desktop/TableViewStyle.qml b/src/controls/Styles/Desktop/TableViewStyle.qml index f5199f3f..1ead1b34 100644 --- a/src/controls/Styles/Desktop/TableViewStyle.qml +++ b/src/controls/Styles/Desktop/TableViewStyle.qml @@ -96,7 +96,10 @@ ScrollViewStyle { font: __styleitem.font anchors.left: parent.left anchors.right: parent.right - anchors.leftMargin: styleData["depth"] && styleData.column === 0 ? 0 : 8 + anchors.leftMargin: styleData.hasOwnProperty("depth") && styleData.column === 0 ? 0 : + horizontalAlignment === Text.AlignRight ? 1 : 8 + anchors.rightMargin: (styleData.hasOwnProperty("depth") && styleData.column === 0) + || horizontalAlignment !== Text.AlignRight ? 1 : 8 horizontalAlignment: styleData.textAlignment anchors.verticalCenter: parent.verticalCenter elide: styleData.elideMode diff --git a/src/controls/Styles/Desktop/TreeViewStyle.qml b/src/controls/Styles/Desktop/TreeViewStyle.qml index 1901c40c..6424ed0e 100644 --- a/src/controls/Styles/Desktop/TreeViewStyle.qml +++ b/src/controls/Styles/Desktop/TreeViewStyle.qml @@ -56,12 +56,12 @@ Desktop.TableViewStyle { hasFocus: __styleitem.active Component.onCompleted: { - implicitWidth = si.pixelMetric("treeviewindentation") + root.__indentation = si.pixelMetric("treeviewindentation") + implicitWidth = root.__indentation implicitHeight = implicitWidth var rect = si.subControlRect("dummy"); width = rect.width height = rect.height - root.__indentation = width } } } diff --git a/src/controls/Styles/iOS/SliderStyle.qml b/src/controls/Styles/iOS/SliderStyle.qml index 3d39ce2b..8a87f809 100644 --- a/src/controls/Styles/iOS/SliderStyle.qml +++ b/src/controls/Styles/iOS/SliderStyle.qml @@ -34,6 +34,54 @@ ** ****************************************************************************/ +import QtQuick 2.3 import QtQuick.Controls.Styles 1.3 -SliderStyle { } +SliderStyle { + groove: Rectangle { + implicitWidth: 20 + implicitHeight: 2 + + color: "#a8a8a8" + radius: 45.0 + + Rectangle { + width: styleData.handlePosition + height: parent.height + color: "#0a60ff" + radius: parent.radius + } + } + + handle: Item { + width: 29 + height: 32 + + Rectangle { + y: 3 + width: 29 + height: 29 + radius: 90.0 + + color: "#d6d6d6" + opacity: 0.2 + } + + Rectangle { + width: 29 + height: 29 + radius: 90.0 + + gradient: Gradient { + GradientStop { position: 0.0; color: "#e2e2e2" } + GradientStop { position: 1.0; color: "#d6d6d6" } + } + + Rectangle { + anchors.fill: parent + anchors.margins: 1 + radius: parent.radius + } + } + } +} diff --git a/src/controls/Tab.qml b/src/controls/Tab.qml index f5d02cf3..07a4cd9e 100644 --- a/src/controls/Tab.qml +++ b/src/controls/Tab.qml @@ -41,6 +41,7 @@ import QtQuick 2.2 \inqmlmodule QtQuick.Controls \since 5.1 \ingroup viewaddons + \ingroup controls \brief Tab represents the content of a tab in a TabView. A Tab item inherits from Loader and provides a similar diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml index bd043be9..f7a8324a 100644 --- a/src/controls/TabView.qml +++ b/src/controls/TabView.qml @@ -43,6 +43,7 @@ import QtQuick.Controls.Private 1.0 \inqmlmodule QtQuick.Controls \since 5.1 \ingroup views + \ingroup controls \brief A control that allows the user to select one of multiple stacked items. \image tabview.png diff --git a/src/controls/TableViewColumn.qml b/src/controls/TableViewColumn.qml index 9bcdfe6d..3f5a8468 100644 --- a/src/controls/TableViewColumn.qml +++ b/src/controls/TableViewColumn.qml @@ -41,6 +41,7 @@ import QtQuick 2.2 \inqmlmodule QtQuick.Controls \since 5.1 \ingroup viewitems + \ingroup controls \brief Used to define columns in a \l TableView or in a \l TreeView. \image tableview.png diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index 23360f06..87b13e0d 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -34,7 +34,7 @@ ** ****************************************************************************/ -import QtQuick 2.2 +import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Private 1.0 @@ -423,6 +423,16 @@ ScrollView { signal linkHovered(string link) /*! + \qmlsignal TextArea::editingFinished() + \since QtQuick.Controls 1.5 + + This signal is emitted when the text area loses focus. + + The corresponding handler is \c onEditingFinished. + */ + signal editingFinished() + + /*! \qmlproperty string TextArea::hoveredLink \since QtQuick.Controls 1.1 @@ -819,6 +829,7 @@ ScrollView { onLinkActivated: area.linkActivated(link) onLinkHovered: area.linkHovered(link) + onEditingFinished: area.editingFinished() function activate() { if (activeFocusOnPress) { diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml index 589869d3..0c8a0df6 100644 --- a/src/controls/TextField.qml +++ b/src/controls/TextField.qml @@ -34,7 +34,7 @@ ** ****************************************************************************/ -import QtQuick 2.2 +import QtQuick 2.6 import QtQuick.Controls 1.2 import QtQuick.Controls.Private 1.0 @@ -660,6 +660,8 @@ Control { Keys.forwardTo: textfield + EnterKey.type: control.EnterKey.type + onAccepted: textfield.accepted() onEditingFinished: textfield.editingFinished() diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index 48f62f16..f5d0a994 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -43,6 +43,7 @@ import QtQuick.Controls.Private 1.0 \inqmlmodule QtQuick.Controls \since 5.1 \ingroup applicationwindow + \ingroup controls \brief Contains ToolButton and related controls. \image toolbar.png diff --git a/src/controls/TreeView.qml b/src/controls/TreeView.qml index c97930f3..637c46c3 100644 --- a/src/controls/TreeView.qml +++ b/src/controls/TreeView.qml @@ -44,6 +44,7 @@ BasicTableView { id: root property var model: null + property alias rootIndex: modelAdaptor.rootIndex readonly property var currentIndex: modelAdaptor.mapRowToModelIndex(__currentRow) property ItemSelectionModel selection: null diff --git a/src/controls/controls.pro b/src/controls/controls.pro index 7dd176f0..f725b1ce 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -1,6 +1,8 @@ +requires(contains(QT_CONFIG, accessibility)) + TARGET = qtquickcontrolsplugin TARGETPATH = QtQuick/Controls -IMPORT_VERSION = 1.4 +IMPORT_VERSION = 1.5 QT += qml quick quick-private qml-private gui-private core-private diff --git a/src/controls/doc/qtquickcontrols.qdocconf b/src/controls/doc/qtquickcontrols.qdocconf index e8aa0422..33df123f 100644 --- a/src/controls/doc/qtquickcontrols.qdocconf +++ b/src/controls/doc/qtquickcontrols.qdocconf @@ -17,16 +17,22 @@ qhp.QtQuickControls.filterAttributes = qtquickcontrols $QT_VERSION qtrefdoc qhp.QtQuickControls.customFilters.Qt.name = QtQuickControls $QT_VERSION qhp.QtQuickControls.customFilters.Qt.filterAttributes = qtquickcontrols $QT_VERSION -qhp.QtQuickControls.subprojects = qtquickcontrolsqmltypes qtquickcontrolsstyles - -qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.title = Controls QML Types -qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.indexTitle = Qt Quick Controls QML Types -qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.selectors = qmlclass # cannot choose qmltypes from a specific group QTBUG-32985 -qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.sortPages = true - -qhp.QtQuickControls.subprojects.qtquickcontrolsstyles.title = Qt Quick Controls Styles Structure -qhp.QtQuickControls.subprojects.qtquickcontrolsstyles.indexTitle = Qt Quick Controls Styles Structure -qhp.QtQuickControls.subprojects.qtquickcontrolsstyles.type = manual +qhp.QtQuickControls.subprojects = qqcqmltypes qqcstylesqmltypes qqcexamples + +qhp.QtQuickControls.subprojects.qqcqmltypes.title = Controls QML Types +qhp.QtQuickControls.subprojects.qqcqmltypes.indexTitle = Qt Quick Controls QML Types +qhp.QtQuickControls.subprojects.qqcqmltypes.selectors = group:controls +qhp.QtQuickControls.subprojects.qqcqmltypes.sortPages = true + +qhp.QtQuickControls.subprojects.qqcstylesqmltypes.title = Controls Styles QML Types +qhp.QtQuickControls.subprojects.qqcstylesqmltypes.indexTitle = Qt Quick Controls Styles QML Types +qhp.QtQuickControls.subprojects.qqcstylesqmltypes.selectors = group:controlsstyling +qhp.QtQuickControls.subprojects.qqcstylesqmltypes.sortPages = true + +qhp.QtQuickControls.subprojects.qqcexamples.title = Examples and Tutorials +qhp.QtQuickControls.subprojects.qqcexamples.indexTitle = Qt Quick Controls Examples +qhp.QtQuickControls.subprojects.qqcexamples.selectors = doc:example group:stylingtutorials +qhp.QtQuickControls.subprojects.qqcexamples.sortpages = true depends = qtcore qtdoc qtgui qtwidgets qtqml qtquick qtquicklayouts qtquickdialogs qtquickextras diff --git a/src/controls/doc/src/qtquickcontrols-overview.qdoc b/src/controls/doc/src/qtquickcontrols-overview.qdoc index 45a4557a..f549d0c8 100644 --- a/src/controls/doc/src/qtquickcontrols-overview.qdoc +++ b/src/controls/doc/src/qtquickcontrols-overview.qdoc @@ -126,6 +126,10 @@ forgotten. This is a known limitation and a workaround is to add potentially missing imports in one of the qml files of the application using the controls. + \section2 Testing Desktop and Mobile behavior of the controls + You can test how the controls on your application or style will behave on + a mobile platform by setting the environment variable \e QT_QUICK_CONTROLS_MOBILE, to force a behavior optimized for mobile devices. + \section1 Related information \list diff --git a/src/controls/doc/src/qtquickcontrols-tableview.qdoc b/src/controls/doc/src/qtquickcontrols-tableview.qdoc index 15b99c18..a9c6d22a 100644 --- a/src/controls/doc/src/qtquickcontrols-tableview.qdoc +++ b/src/controls/doc/src/qtquickcontrols-tableview.qdoc @@ -31,6 +31,7 @@ \inherits BasicTableView \since 5.1 \ingroup views + \ingroup controls \brief Provides a list view with scroll bars, styling and header sections. \image tableview.png diff --git a/src/controls/doc/src/qtquickcontrols-treeview.qdoc b/src/controls/doc/src/qtquickcontrols-treeview.qdoc index fb186059..8188e955 100644 --- a/src/controls/doc/src/qtquickcontrols-treeview.qdoc +++ b/src/controls/doc/src/qtquickcontrols-treeview.qdoc @@ -31,6 +31,7 @@ \inherits BasicTableView \since 5.5 \ingroup views + \ingroup controls \brief Provides a tree view with scroll bars, styling and header sections. \image treeview.png @@ -63,8 +64,8 @@ the model role they attach to. Each property in the model will then be shown in their corresponding column. - You can customize the look by overriding the \l {TreeView::itemDelegate}{itemDelegate}, - \l {TreeView::rowDelegate}{rowDelegate}, or \l {TreeView::headerDelegate}{headerDelegate} properties. + You can customize the look by overriding the \l [QML]{TreeView::}{itemDelegate}, + \l {basictableview-rowdelegate}{rowDelegate}, or \l {basictableview-headerdelegate}{headerDelegate} properties. The view itself does not provide sorting. This has to be done on the model itself. However you can provide sorting @@ -142,6 +143,19 @@ */ /*! + \qmlproperty QModelIndex TreeView::rootIndex + The model index of the root item in the tree view. The root item is the + parent item to the view's top-level items. Only items descending from the + root item will be visible in the view. + + Its default value is an invalid QModelIndex, which means the whole + model data is shown by the tree view (assigning \c undefined to this + proprety resets it to its default value.) + + \since QtQuick.Controls 1.5 +*/ + +/*! \qmlproperty QModelIndex TreeView::currentIndex The model index of the current row in the tree view. */ diff --git a/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc b/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc index 94eb6fb4..792f064c 100644 --- a/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc +++ b/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc @@ -125,17 +125,6 @@ */ /*! - \page qtquickcontrolsstyles-structure.html - \title Qt Quick Controls Styles Structure - \list - \li \l{Qt Quick Controls Styles} - \list - \li \l{Qt Quick Controls Styles QML Types}{Styles QMl Types} - \endlist - \endlist -*/ - -/*! \qmlmodule QtQuick.Controls.Styles 1.4 \title Qt Quick Controls Styles QML Types \ingroup qmlmodules diff --git a/src/controls/doc/src/qtquickcontrolsstyles-tableviewstyle.qdoc b/src/controls/doc/src/qtquickcontrolsstyles-tableviewstyle.qdoc index 0b5012f1..c781f903 100644 --- a/src/controls/doc/src/qtquickcontrolsstyles-tableviewstyle.qdoc +++ b/src/controls/doc/src/qtquickcontrolsstyles-tableviewstyle.qdoc @@ -31,6 +31,7 @@ \inherits BasicTableViewStyle \since 5.1 \ingroup viewsstyling + \ingroup controlsstyling \brief Provides custom styling for TableView */ diff --git a/src/controls/doc/src/qtquickcontrolsstyles-treeviewstyle.qdoc b/src/controls/doc/src/qtquickcontrolsstyles-treeviewstyle.qdoc index 3f4508f4..e98b6cae 100644 --- a/src/controls/doc/src/qtquickcontrolsstyles-treeviewstyle.qdoc +++ b/src/controls/doc/src/qtquickcontrolsstyles-treeviewstyle.qdoc @@ -31,6 +31,7 @@ \inherits BasicTableViewStyle \since 5.5 \ingroup viewsstyling + \ingroup controlsstyling \brief Provides custom styling for TreeView */ diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp index 8ab956c6..e1afeef2 100644 --- a/src/controls/plugin.cpp +++ b/src/controls/plugin.cpp @@ -112,7 +112,10 @@ static const struct { { "TextArea", 1, 3 }, - { "TreeView", 1, 4 } + { "TreeView", 1, 4 }, + + { "TextArea", 1, 5 }, + { "TreeView", 1, 5 } }; void QtQuickControlsPlugin::registerTypes(const char *uri) diff --git a/src/controls/qquickaction.cpp b/src/controls/qquickaction.cpp index 90a1fd67..6add916d 100644 --- a/src/controls/qquickaction.cpp +++ b/src/controls/qquickaction.cpp @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE \qmltype Action \instantiates QQuickAction \ingroup applicationwindow + \ingroup controls \inqmlmodule QtQuick.Controls \brief Action provides an abstract user interface action that can be bound to items diff --git a/src/controls/qquickaction_p.h b/src/controls/qquickaction_p.h index 1828cc9e..e3b9c852 100644 --- a/src/controls/qquickaction_p.h +++ b/src/controls/qquickaction_p.h @@ -104,7 +104,7 @@ public: QIcon icon() const { return m_icon; } QVariant iconVariant() const { return QVariant(m_icon); } - void setIcon(QIcon icon) { m_icon = icon; emit iconChanged(); } + void setIcon(const QIcon &icon) { m_icon = icon; emit iconChanged(); } bool event(QEvent *e); @@ -116,12 +116,12 @@ Q_SIGNALS: void toggled(bool checked); void textChanged(); - void shortcutChanged(QVariant shortcut); + void shortcutChanged(const QVariant &shortcut); void iconChanged(); void iconNameChanged(); void iconSourceChanged(); - void tooltipChanged(QString arg); + void tooltipChanged(const QString &arg); void enabledChanged(); void checkableChanged(); diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp index beabe65b..fec24189 100644 --- a/src/controls/qquickmenu.cpp +++ b/src/controls/qquickmenu.cpp @@ -695,12 +695,12 @@ int QQuickMenu::indexOfMenuItem(QQuickMenuBase *item) const } } -QQuickMenuItem *QQuickMenu::addItem(QString title) +QQuickMenuItem *QQuickMenu::addItem(const QString &title) { return insertItem(m_itemsCount, title); } -QQuickMenuItem *QQuickMenu::insertItem(int index, QString title) +QQuickMenuItem *QQuickMenu::insertItem(int index, const QString &title) { QQuickMenuItem *item = new QQuickMenuItem(this); item->setText(title); diff --git a/src/controls/qquickmenu_p.h b/src/controls/qquickmenu_p.h index a626179a..1c51fe71 100644 --- a/src/controls/qquickmenu_p.h +++ b/src/controls/qquickmenu_p.h @@ -77,8 +77,8 @@ public: enum MenuType { DefaultMenu = 0, EditMenu }; Q_INVOKABLE void popup(); - Q_INVOKABLE QQuickMenuItem *addItem(QString); - Q_INVOKABLE QQuickMenuItem *insertItem(int, QString); + Q_INVOKABLE QQuickMenuItem *addItem(const QString &); + Q_INVOKABLE QQuickMenuItem *insertItem(int, const QString &); Q_INVOKABLE void addSeparator(); Q_INVOKABLE void insertSeparator(int); diff --git a/src/controls/qquickmenuitem.cpp b/src/controls/qquickmenuitem.cpp index be15a435..0702d398 100644 --- a/src/controls/qquickmenuitem.cpp +++ b/src/controls/qquickmenuitem.cpp @@ -135,6 +135,7 @@ void QQuickMenuBase::setVisualItem(QQuickItem *item) \instantiates QQuickMenuSeparator \inqmlmodule QtQuick.Controls \ingroup menus + \ingroup controls \brief MenuSeparator provides a separator for items inside a menu. \image menu.png @@ -284,6 +285,7 @@ void QQuickMenuText::updateIcon() \qmltype MenuItem \instantiates QQuickMenuItem \ingroup menus + \ingroup controls \inqmlmodule QtQuick.Controls \brief MenuItem provides an item to add in a menu or a menu bar. diff --git a/src/controls/qquickpopupwindow.cpp b/src/controls/qquickpopupwindow.cpp index a8f45167..59cfe22b 100644 --- a/src/controls/qquickpopupwindow.cpp +++ b/src/controls/qquickpopupwindow.cpp @@ -67,6 +67,7 @@ void QQuickPopupWindow::show() if (QWindow *tp = transientParent()) { if (m_parentItem) { QPointF pos = m_parentItem->mapToItem(m_parentItem->window()->contentItem(), QPointF(posx, posy)); + pos += tp->mapFromGlobal(m_parentItem->window()->mapToGlobal(QPoint())); posx = pos.x(); posy = pos.y(); } diff --git a/src/controls/qquickstack.cpp b/src/controls/qquickstack.cpp index 16031656..3524b9ef 100644 --- a/src/controls/qquickstack.cpp +++ b/src/controls/qquickstack.cpp @@ -42,6 +42,7 @@ QT_BEGIN_NAMESPACE \qmltype Stack \instantiates QQuickStack \inqmlmodule QtQuick.Controls + \ingroup controls \brief Provides attached properties for items pushed onto a StackView. The Stack type provides attached properties for items pushed onto a \l StackView. |