From eeb320bbd8763f3e72f79369cc3908e999a0da3c Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 2 Mar 2017 15:25:07 +0100 Subject: Delay the deletion of QSGTextures until all windows are synchronized With the 'basic' and the 'windows' render loop the scene graph context is shared. Because of this we cannot start deleting textures after the first window is synchronized as it may contain textures needed by the another window, which is not yet synchronized. QWindowPrivate::syncSceneGraph() is not calling endSync() anymore as it doesn't know whether it is the last window or not. Instead the renderloop is now responsible for calling endSync() once this is safe to do. Change-Id: Icb50ebfb447c928e38b41df7e26f3bfafdb4a811 Reviewed-by: Robert Griebl Reviewed-by: Gunnar Sletta --- src/quick/items/qquickrendercontrol.cpp | 3 +++ src/quick/items/qquickwindow.cpp | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index f2828bbedd..7e995936af 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -284,6 +284,7 @@ bool QQuickRenderControl::sync() QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window); cd->syncSceneGraph(); + d->rc->endSync(); // TODO: find out if the sync actually caused a scenegraph update. return true; @@ -383,6 +384,7 @@ QImage QQuickRenderControl::grab() QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window); cd->polishItems(); cd->syncSceneGraph(); + d->rc->endSync(); render(); grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false); if (QQuickRenderControl::renderWindowFor(d->window)) { @@ -402,6 +404,7 @@ QImage QQuickRenderControl::grab() softwareRenderer->markDirty(); cd->polishItems(); cd->syncSceneGraph(); + d->rc->endSync(); render(); softwareRenderer->setCurrentPaintDevice(prevDev); } diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index d30f1c3f78..433c5b25b1 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -432,10 +432,8 @@ void QQuickWindowPrivate::syncSceneGraph() emit q->afterSynchronizing(); runAndClearJobs(&afterSynchronizingJobs); - context->endSync(); } - void QQuickWindowPrivate::renderSceneGraph(const QSize &size) { QML_MEMORY_SCOPE_STRING("SceneGraph"); -- cgit v1.2.3 From 8635fb9e0ca9a8a2bb5d42785c53ac4b4eb363b1 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 21 Jun 2017 11:20:14 +0200 Subject: Fix typo in QQuickWindow::setRenderTarget warning Change-Id: Idc4521e142603ee37a71acdae63ec750fa970d71 Reviewed-by: Laszlo Agocs --- src/quick/items/qquickwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 433c5b25b1..31f367ed96 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -3428,7 +3428,7 @@ void QQuickWindow::setRenderTarget(QOpenGLFramebufferObject *fbo) { Q_D(QQuickWindow); if (d->context && QThread::currentThread() != d->context->thread()) { - qWarning("QQuickWindow::setRenderThread: Cannot set render target from outside the rendering thread"); + qWarning("QQuickWindow::setRenderTarget: Cannot set render target from outside the rendering thread"); return; } -- cgit v1.2.3 From 441e0b41bf5b700cdaa3b0ba2393c487ed4b9de5 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 30 Jun 2017 10:07:29 +0200 Subject: Expose "kerning" property for fonts For text where the content is known, it can be handy to be able to disable the kerning feature in OpenType to improve performance. [ChangeLog][Qt Quick][Text] Added "kerning" property to the font type to support disabling kerning on text. Task-number: QTBUG-56728 Change-Id: I2e447587a066a7e12c5d38967e0845eaad021014 Reviewed-by: Simon Hausmann --- src/quick/items/qquicktext.cpp | 13 +++++++++++++ src/quick/items/qquicktextedit.cpp | 13 +++++++++++++ src/quick/items/qquicktextinput.cpp | 13 +++++++++++++ 3 files changed, 39 insertions(+) (limited to 'src/quick/items') diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 080cc9412e..1bcfbd41f7 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -1499,6 +1499,19 @@ QQuickText::~QQuickText() Text { text: "Hello"; renderType: Text.NativeRendering; font.hintingPreference: Font.PreferVerticalHinting } \endqml */ + +/*! + \qmlproperty bool QtQuick::Text::font.kerning + \since 5.10 + + Enables or disables the kerning OpenType feature when shaping the text. This may improve performance + when creating or changing the text, at the expense of some cosmetic features. The default value + is true. + + \qml + Text { text: "OATS FLAVOUR WAY"; font.kerning: false } + \endqml +*/ QFont QQuickText::font() const { Q_D(const QQuickText); diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 61d610520f..aad380ca30 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -355,6 +355,19 @@ QString QQuickTextEdit::text() const \endqml */ +/*! + \qmlproperty bool QtQuick::TextEdit::font.kerning + \since 5.10 + + Enables or disables the kerning OpenType feature when shaping the text. This may improve performance + when creating or changing the text, at the expense of some cosmetic features. The default value + is true. + + \qml + Text { text: "OATS FLAVOUR WAY"; kerning: font.false } + \endqml +*/ + /*! \qmlproperty string QtQuick::TextEdit::text diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index a378359c95..d485083820 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -378,6 +378,19 @@ QString QQuickTextInputPrivate::realText() const TextInput { text: "Hello"; renderType: TextInput.NativeRendering; font.hintingPreference: Font.PreferVerticalHinting } \endqml */ + +/*! + \qmlproperty bool QtQuick::TextInput::font.kerning + \since 5.10 + + Enables or disables the kerning OpenType feature when shaping the text. This may improve performance + when creating or changing the text, at the expense of some cosmetic features. The default value + is true. + + \qml + Text { text: "OATS FLAVOUR WAY"; font.kerning: false } + \endqml +*/ QFont QQuickTextInput::font() const { Q_D(const QQuickTextInput); -- cgit v1.2.3 From 98a71c7739a91be03b73312253dd1291e0a1d96d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 1 Jul 2017 14:11:34 -0700 Subject: Suppress warning about QSignalMapper being deprecated It is since qtbase commit 29bcbeab90210da80234529905d17280374f9684. Change-Id: I8d96dea9955d4c749b99fffd14cd512a8ff88a74 Reviewed-by: Simon Hausmann --- src/quick/items/qquickgenericshadereffect.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickgenericshadereffect.cpp b/src/quick/items/qquickgenericshadereffect.cpp index b366071962..305ef7e778 100644 --- a/src/quick/items/qquickgenericshadereffect.cpp +++ b/src/quick/items/qquickgenericshadereffect.cpp @@ -546,7 +546,10 @@ void QQuickGenericShaderEffect::updateShaderVars(Shader shaderType) // Have a QSignalMapper that emits mapped() with an index+type on each property change notify signal. auto &sm(m_signalMappers[shaderType][i]); if (!sm.mapper) { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED sm.mapper = new QSignalMapper; +QT_WARNING_POP sm.mapper->setMapping(m_item, i | (shaderType << 16)); } sm.active = true; -- cgit v1.2.3 From fd295c5047095806db2015a978ed593a140ff373 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 4 Jul 2017 10:59:28 +0200 Subject: doc: Use correct class in docs for font.kerning Copy-pasted the docs for Text.font.kerning into TextEdit and TextInput and forgot to change the class name in the example. Amends 441e0b41bf5b700cdaa3b0ba2393c487ed4b9de5. Task-number: QTBUG-56728 Change-Id: Ieab27efb51fa702d83b891e3c7b7aeb5e4795fc5 Reviewed-by: Simon Hausmann --- src/quick/items/qquicktextedit.cpp | 2 +- src/quick/items/qquicktextinput.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index aad380ca30..aec8666dc4 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -364,7 +364,7 @@ QString QQuickTextEdit::text() const is true. \qml - Text { text: "OATS FLAVOUR WAY"; kerning: font.false } + TextEdit { text: "OATS FLAVOUR WAY"; kerning: font.false } \endqml */ diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index d485083820..49f574156a 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -388,7 +388,7 @@ QString QQuickTextInputPrivate::realText() const is true. \qml - Text { text: "OATS FLAVOUR WAY"; font.kerning: false } + TextInput { text: "OATS FLAVOUR WAY"; font.kerning: false } \endqml */ QFont QQuickTextInput::font() const -- cgit v1.2.3 From 6d471d6ec79c10e564f2c05bfac7ffab3560f54d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 4 Jul 2017 12:27:24 +0200 Subject: QQuickFBO: Keep devicePixelRatio qreal as long as possible Task-number: QTBUG-61686 Change-Id: I9637be13f701d32d87a42fc4ae0f013b8843503e Reviewed-by: Andy Shaw Reviewed-by: Allan Sandfeld Jensen --- src/quick/items/qquickframebufferobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp index 52b19d994c..3c00e956cc 100644 --- a/src/quick/items/qquickframebufferobject.cpp +++ b/src/quick/items/qquickframebufferobject.cpp @@ -260,7 +260,7 @@ public: bool renderPending; bool invalidatePending; - int devicePixelRatio; + qreal devicePixelRatio; }; static inline bool isOpenGL(QSGRenderContext *rc) -- cgit v1.2.3 From b9767f03bdfcc06dae49661150fbeb0f19a8547b Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 13 Jun 2017 16:34:07 +0200 Subject: Doc: explain ListView default Z values in detail This should save users some time when they are trying to figure out why the delegate items are rendered underneath the header when headerPositioning is set to ListView.OverlayHeader, for example. Task-number: QTBUG-61346 Change-Id: I490250f2a64a8bbda463b3a31be6f820d0cfe881 Reviewed-by: J-P Nurmi Reviewed-by: Robin Burchell --- src/quick/items/qquicklistview.cpp | 62 +++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 7 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 18f9b8512d..979a3557a1 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -1835,6 +1835,38 @@ bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte \snippet qml/listview/listview.qml flickBothDirections + \section1 Stacking Order in ListView + + The \l {QQuickItem::z}{Z value} of items determines whether they are + rendered above or below other items. ListView uses several different + default Z values, depending on what type of item is being created: + + \table + \header + \li Property + \li Default Z value + \row + \li \l delegate + \li 1 + \row + \li \l footer + \li 1 + \row + \li \l header + \li 1 + \row + \li \l highlight + \li 0 + \row + \li \l section.delegate + \li 2 + \endtable + + These default values are set if the Z value of the item is \c 0, so setting + the Z value of these items to \c 0 has no effect. Note that the Z value is + of type \l [QML] {real}, so it is possible to set fractional + values like \c 0.1. + \sa {QML Data Models}, GridView, PathView, {Qt Quick Examples - Views} */ QQuickListView::QQuickListView(QQuickItem *parent) @@ -1963,6 +1995,8 @@ QQuickListView::~QQuickListView() \note Delegates are instantiated as needed and may be destroyed at any time. They are parented to ListView's \l {Flickable::contentItem}{contentItem}, not to the view itself. State should \e never be stored in a delegate. + + \sa {Stacking Order in ListView} */ /*! \qmlproperty int QtQuick::ListView::currentIndex @@ -1990,7 +2024,7 @@ QQuickListView::~QQuickListView() The default \l {QQuickItem::z}{stacking order} of the highlight item is \c 0. - \sa highlight, highlightFollowsCurrentItem + \sa highlight, highlightFollowsCurrentItem, {Stacking Order in ListView} */ /*! @@ -2009,7 +2043,8 @@ QQuickListView::~QQuickListView() highlight item is \c 0. \sa highlightItem, highlightFollowsCurrentItem, - {Qt Quick Examples - Views#Highlight}{ListView highlight example} + {Qt Quick Examples - Views#Highlight}{ListView highlight example}, + {Stacking Order in ListView} */ /*! @@ -2352,7 +2387,8 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation) differing sections will result in a section header being created even if that section exists elsewhere. - \sa {Qt Quick Examples - Views}{ListView examples} + \sa {Qt Quick Examples - Views}{ListView examples}, + {Stacking Order in ListView} */ QQuickViewSection *QQuickListView::sectionCriteria() { @@ -2503,7 +2539,7 @@ void QQuickListView::setSnapMode(SnapMode mode) footer is positioned at the end of the view, after any items. The default \l {QQuickItem::z}{stacking order} of the footer is \c 1. - \sa header, footerItem + \sa header, footerItem, {Stacking Order in ListView} */ @@ -2515,7 +2551,7 @@ void QQuickListView::setSnapMode(SnapMode mode) header is positioned at the beginning of the view, before any items. The default \l {QQuickItem::z}{stacking order} of the header is \c 1. - \sa footer, headerItem + \sa footer, headerItem, {Stacking Order in ListView} */ /*! @@ -2526,7 +2562,7 @@ void QQuickListView::setSnapMode(SnapMode mode) header is positioned at the beginning of the view, before any items. The default \l {QQuickItem::z}{stacking order} of the header is \c 1. - \sa header, footerItem + \sa header, footerItem, {Stacking Order in ListView} */ /*! @@ -2537,7 +2573,7 @@ void QQuickListView::setSnapMode(SnapMode mode) footer is positioned at the end of the view, after any items. The default \l {QQuickItem::z}{stacking order} of the footer is \c 1. - \sa footer, headerItem + \sa footer, headerItem, {Stacking Order in ListView} */ /*! @@ -2555,6 +2591,12 @@ void QQuickListView::setSnapMode(SnapMode mode) The header can be pushed away by moving the content forwards, and pulled back by moving the content backwards. \endlist + + \note This property has no effect on the \l {QQuickItem::z}{stacking order} + of the header. For example, if the header should be shown above the + \l delegate items when using \c ListView.OverlayHeader, its Z value + should be set to a value higher than that of the delegates. For more + information, see \l {Stacking Order in ListView}. */ QQuickListView::HeaderPositioning QQuickListView::headerPositioning() const { @@ -2592,6 +2634,12 @@ void QQuickListView::setHeaderPositioning(QQuickListView::HeaderPositioning posi The footer can be pushed away by moving the content backwards, and pulled back by moving the content forwards. \endlist + + \note This property has no effect on the \l {QQuickItem::z}{stacking order} + of the footer. For example, if the footer should be shown above the + \l delegate items when using \c ListView.OverlayFooter, its Z value + should be set to a value higher than that of the delegates. For more + information, see \l {Stacking Order in ListView}. */ QQuickListView::FooterPositioning QQuickListView::footerPositioning() const { -- cgit v1.2.3 From 65ef4bab4ad0ef4a45ff56de3e143a588deac364 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 14 Jun 2017 13:15:45 +0200 Subject: QQuickText: don't clear the text formats on every layout In order to fix QTBUG-21919, 6ff9ba0 added a QTextLayout::clearFormats() call to QQuickTextPrivate::updateLayout(). This patch moves that logic to clearFormats(), called from setText() and setTextFormat() in order to avoid clearing the formats on every text layout update. This allows Qt Quick Controls 2 to extend QQuickText with support for mnenonics by adding a text format range to underline the appropriate piece of text in the internal QTextLayout. Task-number: QTBUG-61422 Change-Id: I646d53f0feeeaa3c106db94f187c7accabdc6a61 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/quick/items/qquicktext.cpp | 15 +++++++++++---- src/quick/items/qquicktext_p_p.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 1bcfbd41f7..2e66367e85 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -269,9 +269,6 @@ void QQuickTextPrivate::updateLayout() formatModifiesFontSize = fontSizeModified; multilengthEos = -1; } else { - layout.clearFormats(); - if (elideLayout) - elideLayout->clearFormats(); QString tmp = text; multilengthEos = tmp.indexOf(QLatin1Char('\x9c')); if (multilengthEos != -1) @@ -632,6 +629,13 @@ QString QQuickTextPrivate::elidedText(qreal lineWidth, const QTextLine &line, QT } } +void QQuickTextPrivate::clearFormats() +{ + layout.clearFormats(); + if (elideLayout) + elideLayout->clearFormats(); +} + /*! Lays out the QQuickTextPrivate::layout QTextLayout in the constraints of the QQuickText. @@ -1060,7 +1064,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) elideLayout = new QTextLayout; elideLayout->setCacheEnabled(true); } - if (styledText) { + QTextEngine *engine = layout.engine(); + if (engine && engine->hasFormats()) { QVector formats; switch (elideMode) { case QQuickText::ElideRight: @@ -1612,6 +1617,7 @@ void QQuickText::setText(const QString &n) d->extra->doc->setText(n); d->rightToLeftText = d->extra->doc->toPlainText().isRightToLeft(); } else { + d->clearFormats(); d->rightToLeftText = d->text.isRightToLeft(); } d->determineHorizontalAlignment(); @@ -2102,6 +2108,7 @@ void QQuickText::setTextFormat(TextFormat format) d->extra->doc->setText(d->text); d->rightToLeftText = d->extra->doc->toPlainText().isRightToLeft(); } else { + d->clearFormats(); d->rightToLeftText = d->text.isRightToLeft(); d->textHasChanged = true; } diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h index fde07eaf2e..957641ec0a 100644 --- a/src/quick/items/qquicktext_p_p.h +++ b/src/quick/items/qquicktext_p_p.h @@ -85,6 +85,7 @@ public: int lineHeightOffset() const; QString elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine = 0) const; void elideFormats(int start, int length, int offset, QVector *elidedFormats); + void clearFormats(); void processHoverEvent(QHoverEvent *event); -- cgit v1.2.3 From 286f14f1e29e7f4e2db4517d087dd5c92606f971 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 5 Jul 2017 12:53:01 +0200 Subject: Add QQuickItem::ItemEnabledHasChanged The itemChange() method has been very useful for Qt Quick Controls 2 to efficiently react to various item changes, but a notification for the enabled state was missing, so it always had to be handled as a special case using signals and slots. This change allows QQC2 to handle enabled state changes the same way e.g. visibility changes are handled. It's also nice to be able to update a control's internal state before the actual notifier signal is emitted. [ChangeLog][QtQuick][QQuickItem] Added a ItemEnabledHasChanged value to the ItemChange enum. QQuickItem::itemChange(ItemEnabledHasChanged) gets called when the item's effective enabled state has changed. The new enabled state is stored in ItemChangeData::boolValue. Change-Id: Iae96ec21f2b94f453632282473decd1c66097a75 Reviewed-by: Mitch Curtis Reviewed-by: Robin Burchell --- src/quick/items/qquickitem.cpp | 16 ++++++++++++++++ src/quick/items/qquickitem.h | 3 ++- src/quick/items/qquickitem_p.h | 3 ++- src/quick/items/qquickitemchangelistener_p.h | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index a8a862bb2f..1e71c20ff3 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2138,6 +2138,9 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) \value ItemAntialiasingHasChanged The antialiasing has changed. The current (boolean) value can be found in QQuickItem::antialiasing. + + \value ItemEnabledHasChanged The item's enabled state has changed. + ItemChangeData::boolValue contains the new enabled state. (since Qt 5.10) */ /*! @@ -5927,6 +5930,7 @@ void QQuickItemPrivate::setEffectiveEnableRecur(QQuickItem *scope, bool newEffec scope, q, Qt::OtherFocusReason, QQuickWindowPrivate::DontChangeFocusProperty | QQuickWindowPrivate::DontChangeSubFocusItem); } + itemChange(QQuickItem::ItemEnabledHasChanged, effectiveEnable); emit q->enabledChanged(); } @@ -6099,6 +6103,18 @@ void QQuickItemPrivate::itemChange(QQuickItem::ItemChange change, const QQuickIt } break; } + case QQuickItem::ItemEnabledHasChanged: { + q->itemChange(change, data); + if (!changeListeners.isEmpty()) { + const auto listeners = changeListeners; // NOTE: intentional copy (QTBUG-54732) + for (const QQuickItemPrivate::ChangeListener &change : listeners) { + if (change.types & QQuickItemPrivate::Enabled) { + change.listener->itemEnabledChanged(q); + } + } + } + break; + } case QQuickItem::ItemParentHasChanged: { q->itemChange(change, data); if (!changeListeners.isEmpty()) { diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index f58946d01d..4a832bbf6f 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -173,7 +173,8 @@ public: ItemActiveFocusHasChanged, // value.boolValue ItemRotationHasChanged, // value.realValue ItemAntialiasingHasChanged, // value.boolValue - ItemDevicePixelRatioHasChanged // value.realValue + ItemDevicePixelRatioHasChanged, // value.realValue + ItemEnabledHasChanged // value.boolValue }; union ItemChangeData { diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index e56d839de9..74d70da2bc 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -321,7 +321,8 @@ public: Children = 0x40, Rotation = 0x80, ImplicitWidth = 0x100, - ImplicitHeight = 0x200 + ImplicitHeight = 0x200, + Enabled = 0x400, }; Q_DECLARE_FLAGS(ChangeTypes, ChangeType) diff --git a/src/quick/items/qquickitemchangelistener_p.h b/src/quick/items/qquickitemchangelistener_p.h index 83c69a9330..cb0af75c4c 100644 --- a/src/quick/items/qquickitemchangelistener_p.h +++ b/src/quick/items/qquickitemchangelistener_p.h @@ -125,6 +125,7 @@ public: virtual void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF & /* oldGeometry */) {} virtual void itemSiblingOrderChanged(QQuickItem *) {} virtual void itemVisibilityChanged(QQuickItem *) {} + virtual void itemEnabledChanged(QQuickItem *) {} virtual void itemOpacityChanged(QQuickItem *) {} virtual void itemDestroyed(QQuickItem *) {} virtual void itemChildAdded(QQuickItem *, QQuickItem * /* child */ ) {} -- cgit v1.2.3 From c7b22fd4d3bc8e5e4ea17b5f101d5d062d7f5d62 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 11 Jul 2017 11:42:10 +0200 Subject: =?UTF-8?q?Doc:=20finish=20incomplete=20sentence=20in=20Loader?= =?UTF-8?q?=E2=80=99s=20detailed=20description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-61889 Change-Id: Ib6adcabc79b75fe2ee9a31fc4808a2a5f303df74 Reviewed-by: Topi Reiniƶ --- src/quick/items/qquickloader.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 5d5934bbd2..2c8f854d4d 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -270,6 +270,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const In some cases you may wish to use a Loader within a view delegate to improve delegate loading performance. This works well in most cases, but there is one important issue to + be aware of related to the \l{QtQml::Component#Creation Context}{creation context} of a Component. In the following example, the \c index context property inserted by the ListView into \c delegateComponent's context will be inaccessible to Text, as the Loader will use the creation context of \c myComponent as the parent -- cgit v1.2.3 From f812edbb5f3edc8a2349ce386139ad08144e665d Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 13 Jul 2017 09:48:05 +0200 Subject: Doc: link to Qt::WindowFlags in Window's flag doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0d5f03bcdcf9154431ed38eac2b41b622ad0c3d6 Reviewed-by: Topi Reiniƶ --- src/quick/items/qquickwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 31f367ed96..c124150b8d 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -4085,6 +4085,8 @@ void QQuickWindow::resetOpenGLState() The flags which you read from this property might differ from the ones that you set if the requested flags could not be fulfilled. + + \sa Qt::WindowFlags */ /*! -- cgit v1.2.3 From fd1612d9b640fa80c49d3de17f8707318df6640c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 17 Jul 2017 11:26:19 +0200 Subject: QQuickWindowQmlImpl: declare attached properties in the header QQuickWindowQmlImpl is inherited by QQuickApplicationWindow in Qt Quick Controls 2, which must register revisions (qmlRegisterRevision) in base classes to make revisioned base class members available in AppWindow. The fact that QQuickWindowQmlImpl provides attached properties must be declared in the header so that qmlRegisterRevision in Qt Quick Controls 2 does not lose the Window-attached properties. Task-number: QTBUG-61935 Change-Id: I634c8fe980b06279610953d9ded2c27d8627d5ea Reviewed-by: Simon Hausmann --- src/quick/items/qquickwindowmodule.cpp | 2 -- src/quick/items/qquickwindowmodule_p.h | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp index a5234d4f77..c1cc02568c 100644 --- a/src/quick/items/qquickwindowmodule.cpp +++ b/src/quick/items/qquickwindowmodule.cpp @@ -204,6 +204,4 @@ void QQuickWindowModule::defineModule() QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickWindowQmlImpl, QML_HAS_ATTACHED_PROPERTIES) - #include "moc_qquickwindowmodule_p.cpp" diff --git a/src/quick/items/qquickwindowmodule_p.h b/src/quick/items/qquickwindowmodule_p.h index 16130bc8a0..869d5b9a8e 100644 --- a/src/quick/items/qquickwindowmodule_p.h +++ b/src/quick/items/qquickwindowmodule_p.h @@ -54,10 +54,10 @@ #include #include #include +#include QT_BEGIN_NAMESPACE -class QQuickWindowAttached; class QQuickWindowQmlImplPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickWindowQmlImpl : public QQuickWindow, public QQmlParserStatus @@ -105,4 +105,7 @@ public: QT_END_NAMESPACE +QML_DECLARE_TYPE(QQuickWindowQmlImpl) +QML_DECLARE_TYPEINFO(QQuickWindowQmlImpl, QML_HAS_ATTACHED_PROPERTIES) + #endif -- cgit v1.2.3 From 65e52acf4027c6c6731942e8a67f8e30e26c9655 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 18 Jul 2017 16:17:23 +0200 Subject: Export QQuickWindowAttached fd1612d9 broke the qqc2 build: error: undefined reference to 'QQuickWindowAttached::staticMetaObject' Change-Id: Ia52f0e124fa81fecdee0ed006837a93636aa9622 Reviewed-by: Simon Hausmann --- src/quick/items/qquickwindowattached_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickwindowattached_p.h b/src/quick/items/qquickwindowattached_p.h index 3212508fd8..191f22137c 100644 --- a/src/quick/items/qquickwindowattached_p.h +++ b/src/quick/items/qquickwindowattached_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include #include #include @@ -59,7 +60,7 @@ QT_BEGIN_NAMESPACE class QQuickItem; class QQuickWindow; -class Q_AUTOTEST_EXPORT QQuickWindowAttached : public QObject +class Q_QUICK_PRIVATE_EXPORT QQuickWindowAttached : public QObject { Q_OBJECT -- cgit v1.2.3 From 264989606420f940cdab14f3f39362b9c82c3885 Mon Sep 17 00:00:00 2001 From: Wieland Hagen Date: Tue, 25 Jul 2017 12:46:38 +0200 Subject: Fix QQuickFramebufferObject::Renderer::invalidateFramebufferObject() invalidateFramebufferObject() sets the invalidatePending flag, which should then trigger the deletion of the old FBO and allocation via Renderer::createFramebufferObject(). This does only happen though, if the size has changed. Instead, always create a new FBO if invalidateFramebufferObject() has been called, regardless of whether the size changes or not. Change-Id: I849cb858afac89038343457c6362233c34956d58 Task-number: QTBUG-54434 Reviewed-by: Laszlo Agocs --- src/quick/items/qquickframebufferobject.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp index 3c00e956cc..042ee21aec 100644 --- a/src/quick/items/qquickframebufferobject.cpp +++ b/src/quick/items/qquickframebufferobject.cpp @@ -312,14 +312,12 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode n->devicePixelRatio = window()->effectiveDevicePixelRatio(); desiredFboSize *= n->devicePixelRatio; - if (n->fbo && (d->followsItemSize || n->invalidatePending)) { - if (n->fbo->size() != desiredFboSize) { - delete n->fbo; - n->fbo = 0; - delete n->msDisplayFbo; - n->msDisplayFbo = 0; - n->invalidatePending = false; - } + if (n->fbo && ((d->followsItemSize && n->fbo->size() != desiredFboSize) || n->invalidatePending)) { + delete n->fbo; + n->fbo = 0; + delete n->msDisplayFbo; + n->msDisplayFbo = 0; + n->invalidatePending = false; } if (!n->fbo) { -- cgit v1.2.3 From bb199cc8ad4111808260f6255312b08c7d81dcbc Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 4 Mar 2016 11:34:59 +0100 Subject: QQuickTextInput: Don't move the cursor after internalInsert() has done so internalInsert() will set the cursor to the right position which accounts for any input mask set on the control as well. Therefore it will already be placed at the next correct position and should not be changed again after that. Task-number: QTBUG-40943 Change-Id: Ic80193ee94d2aa002b5a14a88df719a5a2cf51b1 Reviewed-by: Mitch Curtis --- src/quick/items/qquicktextinput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/quick/items') diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index a378359c95..43899ba457 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -3407,10 +3407,10 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) if (!event->commitString().isEmpty()) { internalInsert(event->commitString()); cursorPositionChanged = true; + } else { + m_cursor = qBound(0, c, m_text.length()); } - m_cursor = qBound(0, c, m_text.length()); - for (int i = 0; i < event->attributes().size(); ++i) { const QInputMethodEvent::Attribute &a = event->attributes().at(i); if (a.type == QInputMethodEvent::Selection) { -- cgit v1.2.3 From 5e8347fdbab98d721f031634a9f6c8b217072d34 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 28 Jul 2017 11:54:44 +0200 Subject: Move shapes-related shaders to under the shapes plugin Do not leave them in quick/items' qrc. Change-Id: I12360a54caa368219a7a80645f92af66aa9de9ba Reviewed-by: Mitch Curtis --- src/quick/items/items.qrc | 4 ---- src/quick/items/shaders/lineargradient.frag | 9 --------- src/quick/items/shaders/lineargradient.vert | 15 --------------- src/quick/items/shaders/lineargradient_core.frag | 12 ------------ src/quick/items/shaders/lineargradient_core.vert | 17 ----------------- 5 files changed, 57 deletions(-) delete mode 100644 src/quick/items/shaders/lineargradient.frag delete mode 100644 src/quick/items/shaders/lineargradient.vert delete mode 100644 src/quick/items/shaders/lineargradient_core.frag delete mode 100644 src/quick/items/shaders/lineargradient_core.vert (limited to 'src/quick/items') diff --git a/src/quick/items/items.qrc b/src/quick/items/items.qrc index da9bf0c828..6aaf757c29 100644 --- a/src/quick/items/items.qrc +++ b/src/quick/items/items.qrc @@ -8,9 +8,5 @@ shaders/shadereffect_core.vert shaders/shadereffectfallback_core.frag shaders/shadereffectfallback_core.vert - shaders/lineargradient.vert - shaders/lineargradient.frag - shaders/lineargradient_core.vert - shaders/lineargradient_core.frag diff --git a/src/quick/items/shaders/lineargradient.frag b/src/quick/items/shaders/lineargradient.frag deleted file mode 100644 index 7f4a739109..0000000000 --- a/src/quick/items/shaders/lineargradient.frag +++ /dev/null @@ -1,9 +0,0 @@ -uniform sampler2D gradTabTexture; -uniform highp float opacity; - -varying highp float gradTabIndex; - -void main() -{ - gl_FragColor = texture2D(gradTabTexture, vec2(gradTabIndex, 0.5)) * opacity; -} diff --git a/src/quick/items/shaders/lineargradient.vert b/src/quick/items/shaders/lineargradient.vert deleted file mode 100644 index eb21b8886b..0000000000 --- a/src/quick/items/shaders/lineargradient.vert +++ /dev/null @@ -1,15 +0,0 @@ -attribute vec4 vertexCoord; -attribute vec4 vertexColor; - -uniform mat4 matrix; -uniform vec2 gradStart; -uniform vec2 gradEnd; - -varying float gradTabIndex; - -void main() -{ - vec2 gradVec = gradEnd - gradStart; - gradTabIndex = dot(gradVec, vertexCoord.xy - gradStart) / (gradVec.x * gradVec.x + gradVec.y * gradVec.y); - gl_Position = matrix * vertexCoord; -} diff --git a/src/quick/items/shaders/lineargradient_core.frag b/src/quick/items/shaders/lineargradient_core.frag deleted file mode 100644 index 5908acfa67..0000000000 --- a/src/quick/items/shaders/lineargradient_core.frag +++ /dev/null @@ -1,12 +0,0 @@ -#version 150 core - -uniform sampler2D gradTabTexture; -uniform float opacity; - -in float gradTabIndex; -out vec4 fragColor; - -void main() -{ - fragColor = texture(gradTabTexture, vec2(gradTabIndex, 0.5)) * opacity; -} diff --git a/src/quick/items/shaders/lineargradient_core.vert b/src/quick/items/shaders/lineargradient_core.vert deleted file mode 100644 index 60b56f38e3..0000000000 --- a/src/quick/items/shaders/lineargradient_core.vert +++ /dev/null @@ -1,17 +0,0 @@ -#version 150 core - -in vec4 vertexCoord; -in vec4 vertexColor; - -uniform mat4 matrix; -uniform vec2 gradStart; -uniform vec2 gradEnd; - -out float gradTabIndex; - -void main() -{ - vec2 gradVec = gradEnd - gradStart; - gradTabIndex = dot(gradVec, vertexCoord.xy - gradStart) / (gradVec.x * gradVec.x + gradVec.y * gradVec.y); - gl_Position = matrix * vertexCoord; -} -- cgit v1.2.3 From 6f3108b7b14a7a2844539b61ab357f8ee6d3c5d4 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Thu, 8 Jun 2017 11:26:10 +0200 Subject: Add tabStopDistance property to QQuickTextEdit This change adds a new property to QQuickTextEdit, tabStopDistance, to control the distance between tab stops in the underlying QTextDocument. [ChangeLog][QtQuick][QQuickTextEdit] Added tabStopDistance property Change-Id: Ib75838e9765e44c74e5055a738d2a0464a341509 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/quick/items/qquicktextedit.cpp | 26 ++++++++++++++++++++++++++ src/quick/items/qquicktextedit_p.h | 5 +++++ 2 files changed, 31 insertions(+) (limited to 'src/quick/items') diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index aec8666dc4..f22c5f00be 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -3050,6 +3050,32 @@ void QQuickTextEdit::resetBottomPadding() d->setBottomPadding(0, true); } +/*! + \qmlproperty real QtQuick::TextEdit::tabStopDistance + \since 5.10 + + The default distance, in device units, between tab stops. + + \sa QTextOption::setTabStop() +*/ +int QQuickTextEdit::tabStopDistance() const +{ + Q_D(const QQuickTextEdit); + return d->document->defaultTextOption().tabStop(); +} + +void QQuickTextEdit::setTabStopDistance(qreal distance) +{ + Q_D(QQuickTextEdit); + QTextOption textOptions = d->document->defaultTextOption(); + if (textOptions.tabStop() == distance) + return; + + textOptions.setTabStop(distance); + d->document->setDefaultTextOption(textOptions); + emit tabStopDistanceChanged(distance); +} + /*! \qmlmethod QtQuick::TextEdit::clear() \since 5.7 diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h index c8d3515be1..23033edb88 100644 --- a/src/quick/items/qquicktextedit_p.h +++ b/src/quick/items/qquicktextedit_p.h @@ -111,6 +111,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged REVISION 6) Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged REVISION 6) Q_PROPERTY(QString preeditText READ preeditText NOTIFY preeditTextChanged REVISION 7) + Q_PROPERTY(qreal tabStopDistance READ tabStopDistance WRITE setTabStopDistance NOTIFY tabStopDistanceChanged REVISION 10) public: QQuickTextEdit(QQuickItem *parent=0); @@ -296,6 +297,9 @@ public: void setBottomPadding(qreal padding); void resetBottomPadding(); + int tabStopDistance() const; + void setTabStopDistance(qreal distance); + Q_SIGNALS: void textChanged(); Q_REVISION(7) void preeditTextChanged(); @@ -340,6 +344,7 @@ Q_SIGNALS: Q_REVISION(6) void leftPaddingChanged(); Q_REVISION(6) void rightPaddingChanged(); Q_REVISION(6) void bottomPaddingChanged(); + Q_REVISION(10) void tabStopDistanceChanged(qreal distance); public Q_SLOTS: void selectAll(); -- cgit v1.2.3