diff options
author | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-07-26 21:50:00 +0200 |
---|---|---|
committer | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-07-26 21:50:00 +0200 |
commit | 134ab4bd5ad895fbc7c2ca0324348519d33e19ba (patch) | |
tree | 1f23eaede274fb0708ef940a22d09aa99e68b925 /src | |
parent | 46e758e985798ca659c79d39683ab000cf870354 (diff) | |
parent | d5b4e460bde0c152da5b872ac8ed6f675bf227a9 (diff) |
Merge remote-tracking branch 'origin/release' into stable
Change-Id: Ibb0e597c0cd02732bae3ef0ccc31c3ef36c75584
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/dialogs/DefaultColorDialog.qml | 27 | ||||
-rw-r--r-- | src/imports/dialogs/qquickabstractcolordialog_p.h | 8 | ||||
-rw-r--r-- | src/qml/doc/src/external-resources.qdoc | 4 | ||||
-rw-r--r-- | src/qml/doc/src/javascript/date.qdoc | 3 | ||||
-rw-r--r-- | src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc | 2 | ||||
-rw-r--r-- | src/qml/doc/src/qmltypereference.qdoc | 10 | ||||
-rw-r--r-- | src/qml/doc/src/qtqml.qdoc | 5 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 5 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp | 6 |
9 files changed, 47 insertions, 23 deletions
diff --git a/src/imports/dialogs/DefaultColorDialog.qml b/src/imports/dialogs/DefaultColorDialog.qml index 8636259957..44af99bf18 100644 --- a/src/imports/dialogs/DefaultColorDialog.qml +++ b/src/imports/dialogs/DefaultColorDialog.qml @@ -45,11 +45,23 @@ import "qml" AbstractColorDialog { id: root + property bool _valueSet: true // guard to prevent binding loops + function _setControlsFromColor() { + _valueSet = false + hueSlider.value = root.hue + saturationSlider.value = root.saturation + lightnessSlider.value = root.lightness + alphaSlider.value = root.alpha + crosshairs.x = root.lightness * paletteMap.width + crosshairs.y = (1.0 - root.saturation) * paletteMap.height + _valueSet = true + } + onColorChanged: _setControlsFromColor() Rectangle { id: content property int maxSize: 0.9 * Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight) - implicitHeight: Math.max(maxSize, Screen.logicalPixelDensity * (usePaletteMap ? 10 : 5)) + implicitHeight: Math.min(maxSize, Screen.logicalPixelDensity * (usePaletteMap ? 100 : 50)) implicitWidth: usePaletteMap ? implicitHeight - bottomMinHeight : implicitHeight * 1.5 color: palette.window property real bottomMinHeight: sliders.height + buttonRow.height + outerSpacing * 3 @@ -62,12 +74,6 @@ AbstractColorDialog { SystemPalette { id: palette } - Binding { - target: root - property: "color" - value: Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value) - } - Item { id: paletteFrame visible: content.usePaletteMap @@ -83,6 +89,7 @@ AbstractColorDialog { id: paletteMap x: (parent.width - width) / 2 width: height + onWidthChanged: root._setControlsFromColor() height: parent.height source: "images/checkers.png" fillMode: Image.Tile @@ -197,6 +204,7 @@ AbstractColorDialog { ColorSlider { id: hueSlider value: 0.5 + onValueChanged: if (_valueSet) root.color = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value) text: qsTr("Hue") trackDelegate: Rectangle { rotation: -90 @@ -217,6 +225,7 @@ AbstractColorDialog { id: saturationSlider visible: !content.usePaletteMap value: 0.5 + onValueChanged: if (_valueSet) root.color = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value) text: qsTr("Saturation") trackDelegate: Rectangle { rotation: -90 @@ -232,6 +241,7 @@ AbstractColorDialog { id: lightnessSlider visible: !content.usePaletteMap value: 0.5 + onValueChanged: if (_valueSet) root.color = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value) text: qsTr("Luminosity") trackDelegate: Rectangle { rotation: -90 @@ -249,6 +259,7 @@ AbstractColorDialog { minimum: 0.0 maximum: 1.0 value: 1.0 + onValueChanged: if (_valueSet) root.color = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value) text: qsTr("Alpha") visible: root.showAlphaChannel trackDelegate: Item { @@ -273,7 +284,7 @@ AbstractColorDialog { Item { id: buttonRow - height: buttonsOnly.height + height: Math.max(buttonsOnly.height, copyIcon.height) width: parent.width anchors { left: parent.left diff --git a/src/imports/dialogs/qquickabstractcolordialog_p.h b/src/imports/dialogs/qquickabstractcolordialog_p.h index 46f0f84acb..bd23e0d1a4 100644 --- a/src/imports/dialogs/qquickabstractcolordialog_p.h +++ b/src/imports/dialogs/qquickabstractcolordialog_p.h @@ -66,6 +66,10 @@ class QQuickAbstractColorDialog : public QQuickAbstractDialog Q_OBJECT Q_PROPERTY(bool showAlphaChannel READ showAlphaChannel WRITE setShowAlphaChannel NOTIFY showAlphaChannelChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) + Q_PROPERTY(qreal hue READ hue NOTIFY colorChanged) + Q_PROPERTY(qreal saturation READ saturation NOTIFY colorChanged) + Q_PROPERTY(qreal lightness READ lightness NOTIFY colorChanged) + Q_PROPERTY(qreal alpha READ alpha NOTIFY colorChanged) public: QQuickAbstractColorDialog(QObject *parent = 0); @@ -74,6 +78,10 @@ public: virtual QString title() const; bool showAlphaChannel() const; QColor color() const { return m_color; } + qreal hue() const { return m_color.hslHueF(); } + qreal saturation() const { return m_color.hslSaturationF(); } + qreal lightness() const { return m_color.lightnessF(); } + qreal alpha() const { return m_color.alphaF(); } public Q_SLOTS: void setVisible(bool v); diff --git a/src/qml/doc/src/external-resources.qdoc b/src/qml/doc/src/external-resources.qdoc index 0832564660..671246d7ab 100644 --- a/src/qml/doc/src/external-resources.qdoc +++ b/src/qml/doc/src/external-resources.qdoc @@ -35,3 +35,7 @@ \title W3Schools JavaScript Reference */ +/*! + \externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date + \title Mozilla Developer Network Date Reference +*/
\ No newline at end of file diff --git a/src/qml/doc/src/javascript/date.qdoc b/src/qml/doc/src/javascript/date.qdoc index 7da24d4092..085d988377 100644 --- a/src/qml/doc/src/javascript/date.qdoc +++ b/src/qml/doc/src/javascript/date.qdoc @@ -30,7 +30,8 @@ \inqmlmodule QtQml 2 \brief Provides date functions - The QML Date object extends the JS Date object with + The QML Date object extends the + \l{Mozilla Developer Network Date Reference}{JS Date object} with locale aware functions. Functions that accept a locale format may be either an enumeration diff --git a/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc index 7d2d662e4e..1d24acc31a 100644 --- a/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc +++ b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc @@ -70,6 +70,8 @@ QML modules may extend the QML language with more basic types. For example, the basic types provided by the \c QtQuick module are listed below: \annotatedlist qtquickbasictypes +The \l{QtQml::Qt}{Qt} global object provides useful functions for manipulating values of basic types. + Currently only QML modules which are provided by Qt may provide their own basic types, however this may change in future releases of Qt QML. In order to use types provided by a particular QML module, clients diff --git a/src/qml/doc/src/qmltypereference.qdoc b/src/qml/doc/src/qmltypereference.qdoc index 3def3209cc..0b363d424e 100644 --- a/src/qml/doc/src/qmltypereference.qdoc +++ b/src/qml/doc/src/qmltypereference.qdoc @@ -104,14 +104,10 @@ When integrating with C++, note that any QDate value \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically converted into a \c date value, and vice-versa. -Note that the date type has comparison semantics which match -those of the JavaScript Date object. To compare the value -of two date properties, you should compare their "toString()" -values. +This basic type is provided by the QML language. It can be implicitly converted +to a \l{QtQml2::Date}{Date} object. -This basic type is provided by the QML language. - -\sa {QML Basic Types} +\sa {QtQml2::Date}{QML Date object}, {QML Basic Types} */ /*! diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc index 26e4867bbc..a260a3d785 100644 --- a/src/qml/doc/src/qtqml.qdoc +++ b/src/qml/doc/src/qtqml.qdoc @@ -75,7 +75,7 @@ The Qt QML module contains the QML framework and important QML types used in applications. The constructs of QML are described in the \l{The QML Reference}. In addition to the \l{QML Basic Types}, the module comes with -various QML object types: +the following QML object types: \list \li \l Component \li \l QtObject @@ -84,6 +84,9 @@ various QML object types: \li \l Timer \endlist +The \l{QtQml::Qt}{Qt} global object provides useful enums and functions +for various QML types. + \section2 Lists and Models New in Qt 5.1, the model types are moved to a submodule, \c QtQml.Models. The diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 5a7a9f1928..fef3dd21fe 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -278,11 +278,8 @@ QQmlImageProviderBase::~QQmlImageProviderBase() \inqmlmodule QtQml 2 \instantiates QQmlEnginePrivate \ingroup qml-utility-elements -\brief The QML global Qt object provides useful enums and functions from Qt. - \keyword QmlGlobalQtObject - -\brief The \c Qt object provides useful enums and functions from Qt, for use in all QML files. +\brief Provides a global object with useful enums and functions from Qt. The \c Qt object is a global object with utility functions, properties and enums. diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp index afea96b35c..4652a2241e 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp @@ -172,7 +172,8 @@ void QSGDefaultDistanceFieldGlyphCache::storeGlyphs(const QHash<glyph_t, QImage> } } - glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, glyph.width(), glyph.height(), GL_ALPHA, GL_UNSIGNED_BYTE, glyph.constBits()); + for (int i = 0; i < glyph.height(); ++i) + glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, glyph.width(), 1, GL_ALPHA, GL_UNSIGNED_BYTE, glyph.scanLine(i)); } QHash<TextureInfo *, QVector<glyph_t> >::const_iterator i; @@ -242,7 +243,8 @@ void QSGDefaultDistanceFieldGlyphCache::resizeTexture(TextureInfo *texInfo, int updateTexture(oldTexture, texInfo->texture, texInfo->size); if (useWorkaround()) { - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, texInfo->image.constBits()); + for (int i = 0; i < oldHeight; ++i) + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, i, oldWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, texInfo->image.scanLine(i)); texInfo->image = texInfo->image.copy(0, 0, width, height); glDeleteTextures(1, &oldTexture); return; |