diff options
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/Private/qquickspinboxvalidator.cpp | 4 | ||||
-rw-r--r-- | src/controls/TableView.qml | 49 | ||||
-rw-r--r-- | src/controls/qquickpopupwindow.cpp | 3 |
3 files changed, 38 insertions, 18 deletions
diff --git a/src/controls/Private/qquickspinboxvalidator.cpp b/src/controls/Private/qquickspinboxvalidator.cpp index afbc866c..2fec79e8 100644 --- a/src/controls/Private/qquickspinboxvalidator.cpp +++ b/src/controls/Private/qquickspinboxvalidator.cpp @@ -200,7 +200,9 @@ QValidator::State QQuickSpinBoxValidator::validate(QString &input, int &pos) con bool ok = false; qreal val = locale().toDouble(value, &ok); if (ok) { - if (state == QValidator::Acceptable) { + if (state == QValidator::Acceptable || + (state == QValidator::Intermediate && val >= 0 && val <= m_validator.top()) || + (state == QValidator::Intermediate && val < 0 && val >= m_validator.bottom())) { const_cast<QQuickSpinBoxValidator *>(this)->setValue(val); if (input != textFromValue(val)) state = QValidator::Intermediate; diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index df4c941f..fb940c44 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -56,25 +56,42 @@ import QtQuick.Window 2.1 A TableView is similar to \l ListView, and adds scroll bars, selection, and resizable header sections. As with \l ListView, data for each row is provided through a \l model: - \code - ListModel { - id: libraryModel - ListElement{ title: "A Masterpiece" ; author: "Gabriel" } - ListElement{ title: "Brilliance" ; author: "Jens" } - ListElement{ title: "Outstanding" ; author: "Frederik" } - } - \endcode + \code + ListModel { + id: libraryModel + ListElement { + title: "A Masterpiece" + author: "Gabriel" + } + ListElement { + title: "Brilliance" + author: "Jens" + } + ListElement { + title: "Outstanding" + author: "Frederik" + } + } + \endcode You provide title and size of a column header by adding a \l TableViewColumn as demonstrated below. - \code - - TableView { - TableViewColumn{ role: "title" ; title: "Title" ; width: 100 } - TableViewColumn{ role: "author" ; title: "Author" ; width: 200 } - model: libraryModel - } - \endcode + + \code + TableView { + TableViewColumn { + role: "title" + title: "Title" + width: 100 + } + TableViewColumn { + role: "author" + title: "Author" + width: 200 + } + model: libraryModel + } + \endcode The header sections are attached to values in the \l model by defining the model role they attach to. Each property in the model will diff --git a/src/controls/qquickpopupwindow.cpp b/src/controls/qquickpopupwindow.cpp index 70b27758..fa7ebee1 100644 --- a/src/controls/qquickpopupwindow.cpp +++ b/src/controls/qquickpopupwindow.cpp @@ -180,7 +180,8 @@ void QQuickPopupWindow::forwardEventToTransientParent(QMouseEvent *e) || e->type() == QEvent::MouseButtonPress)) { // Clicked outside any popup dismissPopup(); - } else if (transientParent()) { + } + if (transientParent()) { QPoint parentPos = transientParent()->mapFromGlobal(mapToGlobal(e->pos())); QMouseEvent pe = QMouseEvent(e->type(), parentPos, e->button(), e->buttons(), e->modifiers()); QGuiApplication::sendEvent(transientParent(), &pe); |