summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-05 18:45:53 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-05 18:45:53 +0100
commit7c5b79a92d8aa64a50f05acf21659ab136e3ca66 (patch)
treef98eba3fcd3d5418476749e676fa7429f88d075b /src
parent4746541dcfebb73ea8398e60e046e394ea9fa441 (diff)
parent4c3196c979d9a7f46b3f37b14140026dd74bf79a (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src')
-rw-r--r--src/controls/ComboBox.qml50
-rw-r--r--src/controls/Private/TabBar.qml5
-rw-r--r--src/controls/Private/qquickspinboxvalidator.cpp14
-rw-r--r--src/controls/Private/qquickspinboxvalidator_p.h3
-rw-r--r--src/controls/Private/qquickstyleitem.cpp6
-rw-r--r--src/controls/ScrollView.qml2
-rw-r--r--src/controls/Slider.qml6
-rw-r--r--src/controls/StatusBar.qml2
-rw-r--r--src/controls/Styles/Desktop/SliderStyle.qml1
-rw-r--r--src/controls/Styles/Desktop/TextAreaStyle.qml4
-rw-r--r--src/controls/ToolBar.qml2
11 files changed, 63 insertions, 32 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 00842a40e..3b636fab8 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -268,6 +268,28 @@ Control {
}
/*! \internal */
+ function __selectPrevItem() {
+ input.blockUpdate = true
+ if (currentIndex > 0) {
+ currentIndex--;
+ input.text = popup.currentText;
+ activated(currentIndex);
+ }
+ input.blockUpdate = false;
+ }
+
+ /*! \internal */
+ function __selectNextItem() {
+ input.blockUpdate = true;
+ if (currentIndex < popupItems.count - 1) {
+ currentIndex++;
+ input.text = popup.currentText;
+ activated(currentIndex);
+ }
+ input.blockUpdate = false;
+ }
+
+ /*! \internal */
property var __popup: popup
style: Qt.createComponent(Settings.style + "/ComboBoxStyle.qml", comboBox)
@@ -285,6 +307,13 @@ Control {
forceActiveFocus()
popup.show()
}
+ onWheel: {
+ if (wheel.angleDelta.y > 0) {
+ __selectPrevItem();
+ } else if (wheel.angleDelta.y < 0){
+ __selectNextItem();
+ }
+ }
}
Component.onCompleted: {
@@ -541,23 +570,6 @@ Control {
popup.show()
}
- Keys.onUpPressed: {
- input.blockUpdate = true
- if (currentIndex > 0) {
- currentIndex--;
- input.text = popup.currentText;
- activated(currentIndex);
- }
- input.blockUpdate = false;
- }
-
- Keys.onDownPressed: {
- input.blockUpdate = true;
- if (currentIndex < popupItems.count - 1) {
- currentIndex++;
- input.text = popup.currentText;
- activated(currentIndex);
- }
- input.blockUpdate = false;
- }
+ Keys.onUpPressed: __selectPrevItem()
+ Keys.onDownPressed: __selectNextItem()
}
diff --git a/src/controls/Private/TabBar.qml b/src/controls/Private/TabBar.qml
index 592ec3480..2e374f994 100644
--- a/src/controls/Private/TabBar.qml
+++ b/src/controls/Private/TabBar.qml
@@ -119,7 +119,10 @@ FocusScope {
interactive: false
focus: true
- width: Math.min(availableWidth, count ? contentWidth : availableWidth)
+ // Note this will silence the binding loop warnings caused by QTBUG-35038
+ // and should be removed when this issue is resolved.
+ property int contentWidthWorkaround: contentWidth > 0 ? contentWidth: 0
+ width: Math.min(availableWidth, count ? contentWidthWorkaround : availableWidth)
height: currentItem ? currentItem.height : 0
highlightMoveDuration: 0
diff --git a/src/controls/Private/qquickspinboxvalidator.cpp b/src/controls/Private/qquickspinboxvalidator.cpp
index 16db3f08b..342ae8c03 100644
--- a/src/controls/Private/qquickspinboxvalidator.cpp
+++ b/src/controls/Private/qquickspinboxvalidator.cpp
@@ -69,7 +69,7 @@ QQuickSpinBoxValidator::~QQuickSpinBoxValidator()
QString QQuickSpinBoxValidator::text() const
{
- return m_prefix + locale().toString(m_value, 'f', m_validator.decimals()) + m_suffix;
+ return textFromValue(m_value);
}
qreal QQuickSpinBoxValidator::value() const
@@ -178,7 +178,7 @@ void QQuickSpinBoxValidator::setSuffix(const QString &suffix)
void QQuickSpinBoxValidator::fixup(QString &input) const
{
- input.remove(locale().groupSeparator());
+ input = textFromValue(m_value).remove(locale().groupSeparator());
}
QValidator::State QQuickSpinBoxValidator::validate(QString &input, int &pos) const
@@ -207,8 +207,11 @@ QValidator::State QQuickSpinBoxValidator::validate(QString &input, int &pos) con
if (state == QValidator::Acceptable) {
bool ok = false;
qreal val = locale().toDouble(value, &ok);
- if (ok)
+ if (ok) {
const_cast<QQuickSpinBoxValidator *>(this)->setValue(val);
+ if (input != textFromValue(val))
+ state = QValidator::Intermediate;
+ }
}
return state;
}
@@ -229,4 +232,9 @@ void QQuickSpinBoxValidator::decrement()
setValue(m_value - m_step);
}
+QString QQuickSpinBoxValidator::textFromValue(qreal value) const
+{
+ return m_prefix + locale().toString(value, 'f', m_validator.decimals()) + m_suffix;
+}
+
QT_END_NAMESPACE
diff --git a/src/controls/Private/qquickspinboxvalidator_p.h b/src/controls/Private/qquickspinboxvalidator_p.h
index 09468fcea..2ffac73eb 100644
--- a/src/controls/Private/qquickspinboxvalidator_p.h
+++ b/src/controls/Private/qquickspinboxvalidator_p.h
@@ -107,6 +107,9 @@ Q_SIGNALS:
void suffixChanged();
void textChanged();
+protected:
+ QString textFromValue(qreal value) const;
+
private:
qreal m_value;
qreal m_step;
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index 4b8d71f20..bd1a3992a 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -211,6 +211,7 @@ QQuickStyleItem::QQuickStyleItem(QQuickItem *parent)
setFlag(QQuickItem::ItemHasContents, true);
setSmooth(false);
+ connect(this, SIGNAL(visibleChanged()), this, SLOT(updateItem()));
connect(this, SIGNAL(widthChanged()), this, SLOT(updateItem()));
connect(this, SIGNAL(heightChanged()), this, SLOT(updateItem()));
connect(this, SIGNAL(enabledChanged()), this, SLOT(updateItem()));
@@ -1616,7 +1617,10 @@ bool QQuickStyleItem::hasThemeIcon(const QString &icon) const
bool QQuickStyleItem::event(QEvent *ev)
{
if (ev->type() == QEvent::StyleAnimationUpdate) {
- polish();
+ if (isVisible()) {
+ ev->accept();
+ polish();
+ }
return true;
} else if (ev->type() == QEvent::StyleChange) {
if (m_itemType == ScrollBar)
diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml
index 6f1187ea5..7e6163922 100644
--- a/src/controls/ScrollView.qml
+++ b/src/controls/ScrollView.qml
@@ -60,7 +60,7 @@ import QtQuick.Controls.Styles 1.1
Example:
\code
ScrollView {
- Image { imageSource: "largeImage.png" }
+ Image { source: "largeImage.png" }
}
\endcode
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index d87bb526a..d31eb2c1e 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -181,8 +181,10 @@ Control {
style: Qt.createComponent(Settings.style + "/SliderStyle.qml", slider)
- Keys.onRightPressed: value += (maximumValue - minimumValue)/10.0
- Keys.onLeftPressed: value -= (maximumValue - minimumValue)/10.0
+ Keys.onRightPressed: if (__horizontal) value += (maximumValue - minimumValue)/10.0
+ Keys.onLeftPressed: if (__horizontal) value -= (maximumValue - minimumValue)/10.0
+ Keys.onUpPressed: if (!__horizontal) value += (maximumValue - minimumValue)/10.0
+ Keys.onDownPressed: if (!__horizontal) value -= (maximumValue - minimumValue)/10.0
RangeModel {
id: range
diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml
index cf41a2dc7..5993ce464 100644
--- a/src/controls/StatusBar.qml
+++ b/src/controls/StatusBar.qml
@@ -72,7 +72,7 @@ import QtQuick.Controls.Private 1.0
\endcode
*/
-Item {
+FocusScope {
id: statusbar
activeFocusOnTab: false
diff --git a/src/controls/Styles/Desktop/SliderStyle.qml b/src/controls/Styles/Desktop/SliderStyle.qml
index fd426e35b..022570b25 100644
--- a/src/controls/Styles/Desktop/SliderStyle.qml
+++ b/src/controls/Styles/Desktop/SliderStyle.qml
@@ -57,6 +57,7 @@ Style {
horizontal: control.orientation === Qt.Horizontal
enabled: control.enabled
hasFocus: control.activeFocus
+ hover: control.hovered
hints: control.styleHints
activeControl: control.tickmarksEnabled ? "ticks" : ""
property int handleWidth: 15
diff --git a/src/controls/Styles/Desktop/TextAreaStyle.qml b/src/controls/Styles/Desktop/TextAreaStyle.qml
index 3f2904a35..dbcd4dce3 100644
--- a/src/controls/Styles/Desktop/TextAreaStyle.qml
+++ b/src/controls/Styles/Desktop/TextAreaStyle.qml
@@ -43,17 +43,15 @@ import QtQuick.Controls.Private 1.0
ScrollViewStyle {
property font font: __styleitem.font
- property color textColor: __styleitem.textColor
+ property color textColor: __syspal.text
property color selectionColor: __syspal.highlight
property color selectedTextColor: __syspal.highlightedText
property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent"
property StyleItem __styleitem: StyleItem{
- property color textColor: styleHint("textColor")
elementType: "edit"
visible: false
active: control.activeFocus
- onActiveChanged: textColor = styleHint("textColor")
}
property int renderType: Text.NativeRendering
diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml
index 1a4c7cb65..caf1d46fd 100644
--- a/src/controls/ToolBar.qml
+++ b/src/controls/ToolBar.qml
@@ -76,7 +76,7 @@ import QtQuick.Controls.Private 1.0
\endcode
*/
-Item {
+FocusScope {
id: toolbar
activeFocusOnTab: false