From 4862b2b46741b93789cd9e4cf990f2a4c44079a9 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Fri, 2 Feb 2024 14:13:33 +0100 Subject: [PATCH] QskQuickItem shortened to QskItem --- doc/classes/QskControl.dox | 10 +- doc/classes/{QskQuickItem.dox => QskItem.dox} | 156 +++++++-------- doc/classes/QskPlacementPolicy.dox | 4 +- .../gallery/progressbar/ProgressBarPage.cpp | 2 +- examples/iotdashboard/StorageBar.cpp | 2 +- examples/iotdashboard/StorageBar.h | 2 +- examples/iotdashboard/main.cpp | 2 +- examples/mycontrols/main.cpp | 2 +- examples/thumbnails/main.cpp | 2 +- qmlexport/QskQml.cpp | 4 +- src/CMakeLists.txt | 8 +- src/controls/QskControl.cpp | 2 +- src/controls/QskControl.h | 6 +- src/controls/QskControlPrivate.h | 6 +- src/controls/QskDirtyItemFilter.cpp | 6 +- .../{QskQuickItem.cpp => QskItem.cpp} | 186 +++++++++--------- src/controls/{QskQuickItem.h => QskItem.h} | 30 +-- ...uickItemPrivate.cpp => QskItemPrivate.cpp} | 42 ++-- ...QskQuickItemPrivate.h => QskItemPrivate.h} | 16 +- src/controls/QskQuick.cpp | 2 +- src/controls/QskSetup.cpp | 32 +-- src/controls/QskSetup.h | 12 +- src/controls/QskSkinlet.cpp | 6 +- src/nodes/QskTreeNode.h | 2 +- support/SkinnyShortcut.cpp | 2 +- 25 files changed, 272 insertions(+), 272 deletions(-) rename doc/classes/{QskQuickItem.dox => QskItem.dox} (83%) rename src/controls/{QskQuickItem.cpp => QskItem.cpp} (84%) rename src/controls/{QskQuickItem.h => QskItem.h} (88%) rename src/controls/{QskQuickItemPrivate.cpp => QskItemPrivate.cpp} (83%) rename src/controls/{QskQuickItemPrivate.h => QskItemPrivate.h} (81%) diff --git a/doc/classes/QskControl.dox b/doc/classes/QskControl.dox index f8a39834..4bd545b0 100644 --- a/doc/classes/QskControl.dox +++ b/doc/classes/QskControl.dox @@ -8,7 +8,7 @@ what is needed to support a layout system, that is on par with what is known from Qt/Widgets. - \todo Explain: QskQuickItem::geometry(), QskQuickItem::rect(), + \todo Explain: QskItem::geometry(), QskItem::rect(), QQuickItem::boundingRect(), layoutRect(), contentsRect(), subControlRect(), focusIndicatorRect(), QQuickItem::clipRect(), QQuickItem::contains() @@ -22,7 +22,7 @@ A state bit that is set, when QQuickItem::isEnabled() == false. \extends QskAspect::State - \sa QskQuickItem::setDisabled() + \sa QskItem::setDisabled() \saqt QQuickItem::enabled \var QskControl::Hovered @@ -71,7 +71,7 @@ \accessors autoLayoutChildren(), setAutoLayoutChildren() \sa layoutRect(), layoutHints(), layoutAlignmentHint(), - QskQuickItem::transparentForPositioners + QskItem::transparentForPositioners \saqt QQuickItem::updatePolish() \note Auto layouting is similar to what happens when putting several items @@ -274,7 +274,7 @@ \aspect QskControl::Background | QskAspect::Color \sa setBackground() - \sa QskQuickItem::DebugForceBackground + \sa QskItem::DebugForceBackground */ /*! @@ -554,7 +554,7 @@ A control has an impact on the layout calutaions, when: - isTransparentForPositioner() is false - - QskQuickItem::isVisibleToParent() is true, or RetainSizeWhenHidden is set + - QskItem::isVisibleToParent() is true, or RetainSizeWhenHidden is set \sa isVisibleToParent(), RetainSizeWhenHidden */ diff --git a/doc/classes/QskQuickItem.dox b/doc/classes/QskItem.dox similarity index 83% rename from doc/classes/QskQuickItem.dox rename to doc/classes/QskItem.dox index d7e46616..488e071c 100644 --- a/doc/classes/QskQuickItem.dox +++ b/doc/classes/QskItem.dox @@ -1,25 +1,25 @@ /*! - \class QskQuickItem QskQuickItem.h + \class QskItem QskItem.h \ingroup Framework - QskQuickItem completes the C++ API of QQuickItem and re-establishs basic + QskItem completes the C++ API of QQuickItem and re-establishs basic concepts like events. It also offers better control over the operations happening in the update cycle. */ /*! - \enum QskQuickItem::UpdateFlag + \enum QskItem::UpdateFlag Qt/Quick classes have a tendency to update items too early and too often. To avoid processing of unwanted operations - QskQuickItem implements a couple of modifications, that + QskItem implements a couple of modifications, that can be en/disabled individually. \sa updateFlags(), resetUpdateFlags() testUpdateFlag(), setUpdateFlag(), resetUpdateFlag() - \var QskQuickItem::UpdateFlag QskQuickItem::DeferredUpdate + \var QskItem::UpdateFlag QskItem::DeferredUpdate Creating of scene graph nodes is blocked when being invisible. @@ -37,7 +37,7 @@ such as viewport frustrum culling (i.e. hiding items outside of the window geometry). - \var QskQuickItem::UpdateFlag QskQuickItem::DeferredPolish + \var QskItem::UpdateFlag QskItem::DeferredPolish Polishing an item is blocked when being invisible. F.e for all items being derived from QskControl the layout calculations @@ -45,7 +45,7 @@ \saqt QQuickItem::updatePolish(), QQuickItem::polish() - \var QskQuickItem::UpdateFlag QskQuickItem::DeferredLayout + \var QskItem::UpdateFlag QskItem::DeferredLayout Recalculations of the implicitSize are blocked until being explicitly requested. @@ -54,15 +54,15 @@ without recalculating the actual size hints ( f.e the implicitSize ). When having layout code that relies on binding the implicit width/height - the QskQuickItem::DeferredLayout flag needs to be disabled. + the QskItem::DeferredLayout flag needs to be disabled. \note All layout classes offered by the Qt/Quick modules of the Qt Company ( f.e anchors ) do require immediate updates of the implicit size. - \sa QskQuickItem::resetImplicitSize() + \sa QskItem::resetImplicitSize() \saqt QQuickItem::implicitSize() - \var QskQuickItem::UpdateFlag QskQuickItem::CleanupOnVisibility + \var QskItem::UpdateFlag QskItem::CleanupOnVisibility Delete scene graph nodes, when the item becomes hidden. Enabling this mode will reduce the memory footprint, but comes at the cost @@ -70,12 +70,12 @@ \saqt QQuickItem::isVisible() - \var QskQuickItem::UpdateFlag QskQuickItem::PreferRasterForTextures + \var QskItem::UpdateFlag QskItem::PreferRasterForTextures When creating textures from QskGraphic, prefer the raster paint engine over the OpenGL paint engine. - \var QskQuickItem::UpdateFlag QskQuickItem::DebugForceBackground + \var QskItem::UpdateFlag QskItem::DebugForceBackground Always fill the background of the item with a random color. @@ -84,7 +84,7 @@ */ /*! - \property QskQuickItem::geometry + \property QskItem::geometry This property holds the geometry of the item relative to its parent item. When changing the geometry, the item receives a QskEvent::GeometryChange event. @@ -93,7 +93,7 @@ */ /*! - \property QskQuickItem::rect + \property QskItem::rect This property returns the internal geometry of the item. It equals QRect(0, 0, width(), height() ). @@ -102,7 +102,7 @@ */ /*! - \var QskQuickItem::transparentForPositioners + \var QskItem::transparentForPositioners When transparentForPositioners is set the item indicates, that it should be excluded from any layout calculations. This flag is actually a concept of QQuickItem, that @@ -112,7 +112,7 @@ */ /*! - \property QskQuickItem::tabFence + \property QskItem::tabFence The tabFence flag can be used to create local tab focus chains. It is usually used in combination with QQuickItem::ItemIsFocusScope. @@ -125,7 +125,7 @@ */ /*! - \property QskQuickItem::visibleToParent + \property QskItem::visibleToParent Flag indicating if an item would become visible if its parentItem() is shown. The implementation relies on the internal explicitVisible flag, that has not @@ -142,7 +142,7 @@ */ /*! - \property QskQuickItem::polishOnResize + \property QskItem::polishOnResize When polishOnResize is set QQuickItem::polish() will be called automatically whenever the size of the item has been changed. This is usually necessary @@ -153,7 +153,7 @@ */ /*! - \property QskQuickItem::initiallyPainted + \property QskItem::initiallyPainted Status flag indicating that there has already been a call of QQuickItem::updatePaintNode() since the item has become visible. @@ -165,7 +165,7 @@ */ /*! - \property QskQuickItem::hasChildItems + \property QskItem::hasChildItems A property indicating if the item has child items. @@ -173,40 +173,40 @@ */ /*! - \property QskQuickItem::updateFlags + \property QskItem::updateFlags - QskQuickItem offers several tweaks to the Qt/Quick update cycle, + QskItem offers several tweaks to the Qt/Quick update cycle, that can be en/disabled individually. The flags are a combination from bits that have been explicitly set by setUpdateFlag() and those being derived from the aapplication wide default settings, that can be set with QskSetup. - \sa QskQuickItem::UpdateFlag, QskQuickItem::updateFlags(), QskSetup::itemUpdateFlags() + \sa QskItem::UpdateFlag, QskItem::updateFlags(), QskSetup::itemUpdateFlags() */ /*! - \fn QskQuickItem::QskQuickItem + \fn QskItem::QskItem Sets the QQuickItem::ItemHasContents flag to true. */ *! - \fn QskQuickItem::~QskQuickItem + \fn QskItem::~QskItem Sets the componentComplete to false, so that its about-to-delete state is known when detaching it from parent/window. */ /*! - \fn QskQuickItem::className + \fn QskItem::className A convenience wrapper for metaObject()->className() \return Class name */ /*! - \fn QskQuickItem::isVisibleTo + \fn QskItem::isVisibleTo The true case occurs if neither the item itself nor any parent up to but excluding ancestor has been explicitly hidden. @@ -218,7 +218,7 @@ */ /*! - \fn QskQuickItem::isVisibleToParent + \fn QskItem::isVisibleToParent An item might be invisible because it has been explicitly hidden or one of its ancestors has been hidden. isVisibleToParent() indicates @@ -231,14 +231,14 @@ */ /*! - \fn QskQuickItem::hasChildItems() const + \fn QskItem::hasChildItems() const \return true, if the item has child items \sa hasChildItems */ /*! - \fn QskQuickItem::setGeometry( qreal, qreal, qreal, qreal ) + \fn QskItem::setGeometry( qreal, qreal, qreal, qreal ) Set the position and the size of an item @@ -252,7 +252,7 @@ */ /*! - \fn QskQuickItem::setGeometry( const QPointF &, const QSizeF & ) + \fn QskItem::setGeometry( const QPointF &, const QSizeF & ) Set the position and the size of an item @@ -261,7 +261,7 @@ */ /*! - \fn QskQuickItem::setGeometry( const QRectF& ) + \fn QskItem::setGeometry( const QRectF& ) Set the position and the size of an item @@ -272,14 +272,14 @@ */ /*! - \fn QskQuickItem::geometry() const + \fn QskItem::geometry() const \return Position and size relative to the parent item \sa geometry, setGeometry() */ /*! - \fn QskQuickItem::geometryChange + \fn QskItem::geometryChange This overloaded notifier calls QQuickItem::polish() depending on the polishOnResize() flag and forwards the notification to the event queue. @@ -288,14 +288,14 @@ */ /*! - \fn QskQuickItem::rect() const + \fn QskItem::rect() const \return Internal geometry of the item, where the position is always at ( 0, 0 ) \sa geometry */ /*! - \fn QskQuickItem::implicitSize + \fn QskItem::implicitSize Qt/Quick offers an oversimplified layout system that is based on the property bindings of implicit width and height. QSkinny restablishs a layout @@ -308,56 +308,56 @@ \return Implicit size, \note Layout code that relies on property bindings of the implicit width a height - needs to disable the QskQuickItem::DeferredLayout flag + needs to disable the QskItem::DeferredLayout flag \sa QskControl::preferredSize(), QskControl::sizeHint() \saqt QQuickItem::implicitWidth(), QQuickItem::implicitHeight() */ /*! - \fn QskQuickItem::setPolishOnResize + \fn QskItem::setPolishOnResize Set or clear the polishOnResize flag. \sa polishOnResize */ /*! - \fn QskQuickItem::polishOnResize() const + \fn QskItem::polishOnResize() const \return Value of the polishOnResize flag \sa setPolishOnResize() */ /*! - \fn QskQuickItem::setTransparentForPositioner + \fn QskItem::setTransparentForPositioner Set or clear the transparentForPositioner flag \sa isTransparentForPositioner() */ /*! - \fn QskQuickItem::isTransparentForPositioner + \fn QskItem::isTransparentForPositioner \return Value of the transparentForPositioner flag \sa transparentForPositioner */ /*! - \fn QskQuickItem::setTabFence + \fn QskItem::setTabFence Set or clear the tabFence property \sa isTabFence() */ /*! - \fn QskQuickItem::isTabFence + \fn QskItem::isTabFence \return Value of the tabFence property \sa setTransparentForPositioner() */ /*! - \fn QskQuickItem::setLayoutMirroring + \fn QskItem::setLayoutMirroring Change the direction how the content is laid out horizontally. @@ -373,7 +373,7 @@ */ /*! - \fn QskQuickItem::resetLayoutMirroring + \fn QskItem::resetLayoutMirroring Clear the layoutMirroring property @@ -381,7 +381,7 @@ */ /*! - \fn QskQuickItem::layoutMirroring() const + \fn QskItem::layoutMirroring() const Direction how the content is layed out horizontally. @@ -402,7 +402,7 @@ */ /*! - \fn QskQuickItem::resetUpdateFlags + \fn QskItem::resetUpdateFlags Reset all flags to the default settings @@ -410,16 +410,16 @@ */ /*! - \fn QskQuickItem::updateFlags() const + \fn QskItem::updateFlags() const \return Flags affecting the item update process \sa testUpdateFlag(), setUpdateFlag(), updateFlags */ /*! - \fn QskQuickItem::setUpdateFlag + \fn QskItem::setUpdateFlag - QskQuickItem offers several tweaks to the Qt/Quick update cycle, + QskItem offers several tweaks to the Qt/Quick update cycle, that can be en/disables individually. The default settings for these flags are taken from QskSetup::itemUpdateFlags() @@ -434,7 +434,7 @@ */ /*! - \fn QskQuickItem::resetUpdateFlag + \fn QskItem::resetUpdateFlag Reset the value for flag to the default settings from QskSetup. Future changes of the corresponding bit with QskSetup::setItemUpdateFlag() will affect @@ -445,7 +445,7 @@ */ /*! - \fn QskQuickItem::testUpdateFlag + \fn QskItem::testUpdateFlag \param Flag affecting the item update process \return true, when the corresponding bit is effective @@ -454,7 +454,7 @@ */ /*! - \fn QskQuickItem::updateFlagsChanged + \fn QskItem::updateFlagsChanged Signal indicating, that the effective update flags have changed @@ -463,7 +463,7 @@ */ /*! - \fn QskQuickItem::classBegin + \fn QskItem::classBegin The QML engine initializes an item as being incomplete by explicitly calling classBegin(). Once the item @@ -481,7 +481,7 @@ */ /*! - \fn QskQuickItem::componentComplete + \fn QskItem::componentComplete The QML engine initilizes an item as being incomplete by explicitly calling QQuickItem::classBegin(). Once the item @@ -499,7 +499,7 @@ */ /*! - \fn QskQuickItem::releaseResources + \fn QskItem::releaseResources This specific hook is called, when the item is about to be removed from the window it was previously rendering to. @@ -510,7 +510,7 @@ */ /*! - \fn QskQuickItem::isPolishScheduled + \fn QskItem::isPolishScheduled \return True, if the item will be polished in the next scene graph update cycle. @@ -519,21 +519,21 @@ */ /*! - \fn QskQuickItem::isUpdateNodeScheduled + \fn QskItem::isUpdateNodeScheduled \return True, if the item will update the paint node in the next scene graph update cycle */ /*! - \fn QskQuickItem::isInitiallyPainted + \fn QskItem::isInitiallyPainted \return Value of the initiallyPainted property \sa initiallyPainted */ /*! - \fn QskQuickItem::maybeUnresized + \fn QskItem::maybeUnresized Flag indicating a potential state, where the item is waiting to be sized by the layout system. @@ -547,7 +547,7 @@ */ /*! - \fn QskQuickItem::itemFlagsChanged + \fn QskItem::itemFlagsChanged Signal indicating that at least one if the following attributes has changed: @@ -557,7 +557,7 @@ */ /*! - \fn QskQuickItem::show + \fn QskItem::show An alternative way to call setVisible( true ). Useful for signal/slot connections @@ -567,7 +567,7 @@ */ /*! - \fn QskQuickItem::hide + \fn QskItem::hide An alternative way to call setVisible( false ). Useful for signal/slot connections @@ -577,7 +577,7 @@ */ /*! - \fn QskQuickItem::setHidden + \fn QskItem::setHidden Convenience function, equivalent to setVisible( !on ). @@ -586,19 +586,19 @@ */ /*! - \fn QskQuickItem::setDisabled + \fn QskItem::setDisabled Convenience function, equivalent to setEnabled( !on ). \saqt QQuickItem::setEnabled() */ /*! - \fn QskQuickItem::resetImplicitSize + \fn QskItem::resetImplicitSize Notifies the layout system that attributes affecting the layout system have changed. - If the QskQuickItem::DeferredLayout flag is enabled ( = default ) + If the QskItem::DeferredLayout flag is enabled ( = default ) the cached implicitSize() gets invalidated and a QEvent::LayoutRequest is sent to the parent item ( like QWidget::updateGeometry ). @@ -607,13 +607,13 @@ */ /*! - \fn QskQuickItem::event + \fn QskItem::event - QskQuickItem handles the additional type of events. + QskItem handles the additional type of events. For some reason the QQuick classes introduced proprietory notfier hooks instead of using the well established and powerful concept of events. - QskQuickItem tries to revert this decision by mapping notifications + QskItem tries to revert this decision by mapping notifications to events, when possible. The following notification events are added by QSkinny - usually with a @@ -633,7 +633,7 @@ */ /*! - \fn QskQuickItem::changeEvent + \fn QskItem::changeEvent This event handler can be reimplemented to handle certain state changes: @@ -649,12 +649,12 @@ */ /*! - \fn QskQuickItem::geometryChangeEvent + \fn QskItem::geometryChangeEvent For no known reason QQuickItem propagates changes of position and size by calling QQuickItem::geometryChange(), instead of using events. - QskQuickItem reestablished the more powerful concept of events by sending/posting + QskItem reestablished the more powerful concept of events by sending/posting events, that can be preprocessed by event filtering. \param event Event indicating the geometry change @@ -664,7 +664,7 @@ */ /*! - \fn QskQuickItem::windowChangeEvent + \fn QskItem::windowChangeEvent This event handler can be reimplemented to handle situations, where an item is added, removed or transferred between windows. It corresponds @@ -677,7 +677,7 @@ */ /*! - \fn QskQuickItem::itemChange + \fn QskItem::itemChange For no obvious reason Qt/Quick has introduced an additional callback mechanism beside events and signals. @@ -698,7 +698,7 @@ */ /*! - \fn QskQuickItem::aboutToShow + \fn QskItem::aboutToShow A specific hook that is intended to be overloaded by controls that need to do some specific operations, when an item is painted the first time @@ -711,7 +711,7 @@ */ /*! - \fn QskQuickItem::mouseUngrabEvent + \fn QskItem::mouseUngrabEvent Notification, that is overloaded for debuging purposes, without doing anything beside calling the base class. @@ -720,7 +720,7 @@ */ /*! - \fn QskQuickItem::touchUngrabEvent + \fn QskItem::touchUngrabEvent Notification, that is overloaded for debuging purposes, without doing anything beside calling the base class. diff --git a/doc/classes/QskPlacementPolicy.dox b/doc/classes/QskPlacementPolicy.dox index e618d4ec..1be2de9b 100644 --- a/doc/classes/QskPlacementPolicy.dox +++ b/doc/classes/QskPlacementPolicy.dox @@ -53,7 +53,7 @@ The default value \accessors visiblePolicy(), setVisiblePolicy() - \sa hiddenPolicy, QskQuickItem::isVisibleToParent(), qskIsVisibleToParent() + \sa hiddenPolicy, QskItem::isVisibleToParent(), qskIsVisibleToParent() \note QskPlacementPolicy::Ignore is stored in the transparentForPositioner bit in QQuickItem and might have an impact on Qt/Quick layout code. @@ -78,7 +78,7 @@ Sometimes an item wants to have its proper size even when being hidden. \accessors hiddenPolicy(), setHiddenPolicy() - \sa visiblePolicy, QskQuickItem::isVisibleToParent(), qskIsVisibleToParent() + \sa visiblePolicy, QskItem::isVisibleToParent(), qskIsVisibleToParent() \note QskPlacementPolicy::Ignore is stored in the transparentForPositioner bit in QQuickItem and might have an impact on Qt/Quick layout code. diff --git a/examples/gallery/progressbar/ProgressBarPage.cpp b/examples/gallery/progressbar/ProgressBarPage.cpp index 668f4996..fe0e7b07 100644 --- a/examples/gallery/progressbar/ProgressBarPage.cpp +++ b/examples/gallery/progressbar/ProgressBarPage.cpp @@ -178,7 +178,7 @@ void ProgressBarPage::populate() } } - connect( this, &QskQuickItem::windowChanged, this, [this, determinateIndicators]( QQuickWindow* window ) + connect( this, &QskItem::windowChanged, this, [this, determinateIndicators]( QQuickWindow* window ) { if( window ) { diff --git a/examples/iotdashboard/StorageBar.cpp b/examples/iotdashboard/StorageBar.cpp index c717e1f7..2bc1213b 100644 --- a/examples/iotdashboard/StorageBar.cpp +++ b/examples/iotdashboard/StorageBar.cpp @@ -18,7 +18,7 @@ QSK_SUBCONTROL( StorageBar, Free ) using S = StorageBar; -StorageBar::StorageBar( QskQuickItem* const parent ) +StorageBar::StorageBar( QskItem* const parent ) : Inherited( parent ) { static constexpr qreal size = 16.0; diff --git a/examples/iotdashboard/StorageBar.h b/examples/iotdashboard/StorageBar.h index b8773b34..ba841227 100644 --- a/examples/iotdashboard/StorageBar.h +++ b/examples/iotdashboard/StorageBar.h @@ -20,7 +20,7 @@ class StorageBar final : public QskControl public: QSK_SUBCONTROLS( Pictures, Music, Videos, Documents, Others, Free ) - explicit StorageBar( QskQuickItem* parent = nullptr ); + explicit StorageBar( QskItem* parent = nullptr ); qreal pictures() const; void setPictures( qreal newPictures ); diff --git a/examples/iotdashboard/main.cpp b/examples/iotdashboard/main.cpp index bbd0ddaa..46fa8cc4 100644 --- a/examples/iotdashboard/main.cpp +++ b/examples/iotdashboard/main.cpp @@ -28,7 +28,7 @@ int main( int argc, char* argv[] ) QGuiApplication app( argc, argv ); - qskSetup->setItemUpdateFlag( QskQuickItem::PreferRasterForTextures, true ); + qskSetup->setItemUpdateFlag( QskItem::PreferRasterForTextures, true ); qskSkinManager->setSkin( new Skin() ); Qsk::addGraphicProvider( QString(), new GraphicProvider() ); diff --git a/examples/mycontrols/main.cpp b/examples/mycontrols/main.cpp index 425c953c..028fb6a0 100644 --- a/examples/mycontrols/main.cpp +++ b/examples/mycontrols/main.cpp @@ -139,7 +139,7 @@ int main( int argc, char* argv[] ) qskSkinManager->registerFactory( QStringLiteral( "MySkinFactory" ), new MySkinFactory() ); - qskSetup->setItemUpdateFlag( QskQuickItem::PreferRasterForTextures, true ); + qskSetup->setItemUpdateFlag( QskItem::PreferRasterForTextures, true ); Window window; window.resize( 480, 360 ); diff --git a/examples/thumbnails/main.cpp b/examples/thumbnails/main.cpp index 98e0f78a..f19eca4d 100644 --- a/examples/thumbnails/main.cpp +++ b/examples/thumbnails/main.cpp @@ -138,7 +138,7 @@ class IconGrid : public QskLinearBox When having too many nodes, the scene graph becomes horribly slow. So we explicitely hide all items outside the visible area ( see updateVisibilities below ) and make use of the DeferredUpdate and - CleanupOnVisibility features of QskQuickItem. + CleanupOnVisibility features of QskItem. */ setSize( sizeConstraint() ); updateLayout(); // so that every item has its initial geometry diff --git a/qmlexport/QskQml.cpp b/qmlexport/QskQml.cpp index e5581aad..0b86c448 100644 --- a/qmlexport/QskQml.cpp +++ b/qmlexport/QskQml.cpp @@ -243,8 +243,8 @@ void QskQml::registerTypes() QSK_VERSION_MAJOR, QSK_VERSION_MINOR, "Skin", QString() ); #endif - QSK_REGISTER_FLAGS( QskQuickItem::UpdateFlag ); - QSK_REGISTER_FLAGS( QskQuickItem::UpdateFlags ); + QSK_REGISTER_FLAGS( QskItem::UpdateFlag ); + QSK_REGISTER_FLAGS( QskItem::UpdateFlags ); QSK_REGISTER_FLAGS( QskSizePolicy::Policy ); QSK_REGISTER_FLAGS( QskDialog::Actions ); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 29aca47d..36d7e106 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -219,6 +219,7 @@ list(APPEND HEADERS controls/QskGraphicLabel.h controls/QskGraphicLabelSkinlet.h controls/QskHintAnimator.h + controls/QskItem.h controls/QskInputGrabber.h controls/QskListView.h controls/QskListViewSkinlet.h @@ -239,7 +240,6 @@ list(APPEND HEADERS controls/QskPushButton.h controls/QskPushButtonSkinlet.h controls/QskQuick.h - controls/QskQuickItem.h controls/QskRadioBox.h controls/QskRadioBoxSkinlet.h controls/QskScrollArea.h @@ -291,7 +291,7 @@ list(APPEND HEADERS list(APPEND PRIVATE_HEADERS controls/QskDirtyItemFilter.h controls/QskControlPrivate.h - controls/QskQuickItemPrivate.h + controls/QskItemPrivate.h ) list(APPEND SOURCES @@ -324,6 +324,8 @@ list(APPEND SOURCES controls/QskGraphicLabelSkinlet.cpp controls/QskHintAnimator.cpp controls/QskInputGrabber.cpp + controls/QskItem.cpp + controls/QskItemPrivate.cpp controls/QskListView.cpp controls/QskListViewSkinlet.cpp controls/QskMenuSkinlet.cpp @@ -343,8 +345,6 @@ list(APPEND SOURCES controls/QskPushButton.cpp controls/QskPushButtonSkinlet.cpp controls/QskQuick.cpp - controls/QskQuickItem.cpp - controls/QskQuickItemPrivate.cpp controls/QskScrollArea.cpp controls/QskScrollBox.cpp controls/QskScrollView.cpp diff --git a/src/controls/QskControl.cpp b/src/controls/QskControl.cpp index fc25f8cf..066e9308 100644 --- a/src/controls/QskControl.cpp +++ b/src/controls/QskControl.cpp @@ -47,7 +47,7 @@ static inline bool qskMaybeGesture( QQuickItem* item, } QskControl::QskControl( QQuickItem* parent ) - : QskQuickItem( *( new QskControlPrivate() ), parent ) + : QskItem( *( new QskControlPrivate() ), parent ) { if ( parent ) { diff --git a/src/controls/QskControl.h b/src/controls/QskControl.h index 906d915d..fc87e6f5 100644 --- a/src/controls/QskControl.h +++ b/src/controls/QskControl.h @@ -6,7 +6,7 @@ #ifndef QSK_CONTROL_H #define QSK_CONTROL_H -#include "QskQuickItem.h" +#include "QskItem.h" #include "QskSkinnable.h" #include "QskAspect.h" #include "QskGradient.h" @@ -19,7 +19,7 @@ class QskControlPrivate; class QskGestureEvent; -class QSK_EXPORT QskControl : public QskQuickItem, public QskSkinnable +class QSK_EXPORT QskControl : public QskItem, public QskSkinnable { Q_OBJECT @@ -49,7 +49,7 @@ class QSK_EXPORT QskControl : public QskQuickItem, public QskSkinnable Q_PROPERTY( QSizeF preferredSize READ preferredSize WRITE setPreferredSize ) Q_PROPERTY( QSizeF sizeConstraint READ sizeConstraint ) - using Inherited = QskQuickItem; + using Inherited = QskItem; public: QSK_SUBCONTROLS( Background ) diff --git a/src/controls/QskControlPrivate.h b/src/controls/QskControlPrivate.h index 9e39d8ad..0bf9c2b3 100644 --- a/src/controls/QskControlPrivate.h +++ b/src/controls/QskControlPrivate.h @@ -8,11 +8,11 @@ #include "QskGlobal.h" #include "QskControl.h" -#include "QskQuickItemPrivate.h" +#include "QskItemPrivate.h" -class QskControlPrivate : public QskQuickItemPrivate +class QskControlPrivate : public QskItemPrivate { - using Inherited = QskQuickItemPrivate; + using Inherited = QskItemPrivate; public: static bool inheritLocale( QskControl*, const QLocale& ); diff --git a/src/controls/QskDirtyItemFilter.cpp b/src/controls/QskDirtyItemFilter.cpp index 416f0253..f1189424 100644 --- a/src/controls/QskDirtyItemFilter.cpp +++ b/src/controls/QskDirtyItemFilter.cpp @@ -4,7 +4,7 @@ *****************************************************************************/ #include "QskDirtyItemFilter.h" -#include "QskQuickItem.h" +#include "QskItem.h" QSK_QT_PRIVATE_BEGIN #include @@ -15,8 +15,8 @@ static inline bool qskIsUpdateBlocked( const QQuickItem* item ) { if ( !item->isVisible() ) { - if ( auto qskItem = qobject_cast< const QskQuickItem* >( item ) ) - return qskItem->testUpdateFlag( QskQuickItem::DeferredUpdate ); + if ( auto qskItem = qobject_cast< const QskItem* >( item ) ) + return qskItem->testUpdateFlag( QskItem::DeferredUpdate ); } #if 0 diff --git a/src/controls/QskQuickItem.cpp b/src/controls/QskItem.cpp similarity index 84% rename from src/controls/QskQuickItem.cpp rename to src/controls/QskItem.cpp index 53ca1f74..5f0b08bc 100644 --- a/src/controls/QskQuickItem.cpp +++ b/src/controls/QskItem.cpp @@ -3,8 +3,8 @@ * SPDX-License-Identifier: BSD-3-Clause *****************************************************************************/ -#include "QskQuickItem.h" -#include "QskQuickItemPrivate.h" +#include "QskItem.h" +#include "QskItemPrivate.h" #include "QskQuick.h" #include "QskEvent.h" #include "QskSetup.h" @@ -44,9 +44,9 @@ static inline void qskSendEventTo( QObject* object, QEvent::Type type ) } static inline void qskApplyUpdateFlags( - QskQuickItem::UpdateFlags flags, QskQuickItem* item ) + QskItem::UpdateFlags flags, QskItem* item ) { - auto d = static_cast< QskQuickItemPrivate* >( QskQuickItemPrivate::get( item ) ); + auto d = static_cast< QskItemPrivate* >( QskItemPrivate::get( item ) ); d->applyUpdateFlags( flags ); } @@ -61,10 +61,10 @@ static inline void qskFilterWindow( QQuickWindow* window ) namespace { - class QskQuickItemRegistry + class QskItemRegistry { public: - QskQuickItemRegistry() + QskItemRegistry() { /* Its faster and saves some memory to have this registry instead @@ -84,12 +84,12 @@ namespace qskSkinManager, [ this ] { updateSkin(); } ); } - inline void insert( QskQuickItem* item ) + inline void insert( QskItem* item ) { m_items.insert( item ); } - inline void remove( QskQuickItem* item ) + inline void remove( QskItem* item ) { m_items.erase( item ); } @@ -114,7 +114,7 @@ namespace } private: - std::unordered_set< QskQuickItem* > m_items; + std::unordered_set< QskItem* > m_items; }; } @@ -164,22 +164,22 @@ namespace }; } -Q_GLOBAL_STATIC( QskQuickItemRegistry, qskRegistry ) +Q_GLOBAL_STATIC( QskItemRegistry, qskRegistry ) Q_GLOBAL_STATIC( QskWindowStore, qskReleasedWindowCounter ) -QskQuickItem::QskQuickItem( QskQuickItemPrivate& dd, QQuickItem* parent ) +QskItem::QskItem( QskItemPrivate& dd, QQuickItem* parent ) : QQuickItem( dd, parent ) { setFlag( QQuickItem::ItemHasContents, true ); Inherited::setActiveFocusOnTab( false ); - if ( dd.updateFlags & QskQuickItem::DeferredUpdate ) + if ( dd.updateFlags & QskItem::DeferredUpdate ) qskFilterWindow( window() ); qskRegistry->insert( this ); } -QskQuickItem::~QskQuickItem() +QskItem::~QskItem() { /* We set componentComplete to false, so that operations @@ -197,24 +197,24 @@ QskQuickItem::~QskQuickItem() qskRegistry->remove( this ); } -const char* QskQuickItem::className() const +const char* QskItem::className() const { return metaObject()->className(); } -void QskQuickItem::classBegin() +void QskItem::classBegin() { Inherited::classBegin(); } -void QskQuickItem::componentComplete() +void QskItem::componentComplete() { #if defined( QT_DEBUG ) - if ( d_func()->updateFlags & QskQuickItem::DeferredLayout ) + if ( d_func()->updateFlags & QskItem::DeferredLayout ) { if ( qobject_cast< const QQuickBasePositioner* >( parent() ) ) { - qWarning( "QskQuickItem in DeferredLayout mode under control of a positioner" ); + qWarning( "QskItem in DeferredLayout mode under control of a positioner" ); } } #endif @@ -222,7 +222,7 @@ void QskQuickItem::componentComplete() Inherited::componentComplete(); } -void QskQuickItem::releaseResources() +void QskItem::releaseResources() { Inherited::releaseResources(); @@ -235,37 +235,37 @@ void QskQuickItem::releaseResources() qskReleasedWindowCounter->setWindow( window() ); } -void QskQuickItem::setDisabled( bool on ) +void QskItem::setDisabled( bool on ) { Inherited::setEnabled( !on ); } -void QskQuickItem::setHidden( bool on ) +void QskItem::setHidden( bool on ) { Inherited::setVisible( !on ); } -void QskQuickItem::show() +void QskItem::show() { Inherited::setVisible( true ); } -void QskQuickItem::hide() +void QskItem::hide() { Inherited::setVisible( false ); } -bool QskQuickItem::isVisibleTo( const QQuickItem* ancestor ) const +bool QskItem::isVisibleTo( const QQuickItem* ancestor ) const { return qskIsVisibleTo( this, ancestor ); } -bool QskQuickItem::isVisibleToParent() const +bool QskItem::isVisibleToParent() const { return d_func()->explicitVisible; } -void QskQuickItem::setGeometry( qreal x, qreal y, qreal width, qreal height ) +void QskItem::setGeometry( qreal x, qreal y, qreal width, qreal height ) { // QQuickItem does not even offer changing the geometry // in one call - what leads to 2 calls of the updateGeometry @@ -323,19 +323,19 @@ void QskQuickItem::setGeometry( qreal x, qreal y, qreal width, qreal height ) } } -QRectF QskQuickItem::rect() const +QRectF QskItem::rect() const { Q_D( const QQuickItem ); return QRectF( 0, 0, d->width, d->height ); } -QRectF QskQuickItem::geometry() const +QRectF QskItem::geometry() const { Q_D( const QQuickItem ); return QRectF( d->x, d->y, d->width, d->height ); } -void QskQuickItem::setTabFence( bool on ) +void QskItem::setTabFence( bool on ) { Q_D( QQuickItem ); if ( on != d->isTabFence ) @@ -345,12 +345,12 @@ void QskQuickItem::setTabFence( bool on ) } } -bool QskQuickItem::isTabFence() const +bool QskItem::isTabFence() const { return d_func()->isTabFence; } -void QskQuickItem::setFocusPolicy( Qt::FocusPolicy policy ) +void QskItem::setFocusPolicy( Qt::FocusPolicy policy ) { /* Qt::FocusPolicy has always been there with widgets, got lost with @@ -358,7 +358,7 @@ void QskQuickItem::setFocusPolicy( Qt::FocusPolicy policy ) Unfortunately this was done by adding code on top instead of fixing the foundation. */ - Q_D( QskQuickItem ); + Q_D( QskItem ); if ( policy != d->focusPolicy ) { d->focusPolicy = ( policy & ~Qt::TabFocus ); @@ -381,7 +381,7 @@ void QskQuickItem::setFocusPolicy( Qt::FocusPolicy policy ) } } -Qt::FocusPolicy QskQuickItem::focusPolicy() const +Qt::FocusPolicy QskItem::focusPolicy() const { uint policy = d_func()->focusPolicy; if ( Inherited::activeFocusOnTab() ) @@ -390,9 +390,9 @@ Qt::FocusPolicy QskQuickItem::focusPolicy() const return static_cast< Qt::FocusPolicy >( policy ); } -void QskQuickItem::setWheelEnabled( bool on ) +void QskItem::setWheelEnabled( bool on ) { - Q_D( QskQuickItem ); + Q_D( QskItem ); if ( on != d->wheelEnabled ) { d->wheelEnabled = on; @@ -400,14 +400,14 @@ void QskQuickItem::setWheelEnabled( bool on ) } } -bool QskQuickItem::isWheelEnabled() const +bool QskItem::isWheelEnabled() const { return d_func()->wheelEnabled; } -void QskQuickItem::setPolishOnResize( bool on ) +void QskItem::setPolishOnResize( bool on ) { - Q_D( QskQuickItem ); + Q_D( QskItem ); if ( on != d->polishOnResize ) { d->polishOnResize = on; @@ -417,12 +417,12 @@ void QskQuickItem::setPolishOnResize( bool on ) } } -bool QskQuickItem::polishOnResize() const +bool QskItem::polishOnResize() const { return d_func()->polishOnResize; } -bool QskQuickItem::layoutMirroring() const +bool QskItem::layoutMirroring() const { #if 1 /* @@ -436,7 +436,7 @@ bool QskQuickItem::layoutMirroring() const #endif } -void QskQuickItem::setLayoutMirroring( bool on, bool childrenInherit ) +void QskItem::setLayoutMirroring( bool on, bool childrenInherit ) { // Again we have to deal with an existing API made for QML, // that is weired for C++: LayoutMirroring/QQuickLayoutMirroringAttached @@ -464,7 +464,7 @@ void QskQuickItem::setLayoutMirroring( bool on, bool childrenInherit ) } } -void QskQuickItem::resetLayoutMirroring() +void QskItem::resetLayoutMirroring() { Q_D( QQuickItem ); @@ -476,27 +476,27 @@ void QskQuickItem::resetLayoutMirroring() } } -bool QskQuickItem::isPolishScheduled() const +bool QskItem::isPolishScheduled() const { return d_func()->polishScheduled; } -bool QskQuickItem::isUpdateNodeScheduled() const +bool QskItem::isUpdateNodeScheduled() const { - Q_D( const QskQuickItem ); + Q_D( const QskItem ); return ( d->dirtyAttributes & QQuickItemPrivate::ContentUpdateMask ) && ( d->flags & QQuickItem::ItemHasContents ); } -bool QskQuickItem::isInitiallyPainted() const +bool QskItem::isInitiallyPainted() const { return d_func()->initiallyPainted; } -bool QskQuickItem::maybeUnresized() const +bool QskItem::maybeUnresized() const { - Q_D( const QskQuickItem ); + Q_D( const QskItem ); if ( d->width <= 0.0 && d->height <= 0.0 ) { @@ -514,23 +514,23 @@ bool QskQuickItem::maybeUnresized() const return false; } -QskQuickItem::UpdateFlags QskQuickItem::updateFlags() const +QskItem::UpdateFlags QskItem::updateFlags() const { return UpdateFlags( d_func()->updateFlags ); } -void QskQuickItem::resetUpdateFlags() +void QskItem::resetUpdateFlags() { - Q_D( QskQuickItem ); + Q_D( QskItem ); // clear all bits in the mask d->updateFlagsMask = 0; d->applyUpdateFlags( qskSetup->itemUpdateFlags() ); } -void QskQuickItem::setUpdateFlag( UpdateFlag flag, bool on ) +void QskItem::setUpdateFlag( UpdateFlag flag, bool on ) { - Q_D( QskQuickItem ); + Q_D( QskItem ); d->updateFlagsMask |= flag; @@ -541,9 +541,9 @@ void QskQuickItem::setUpdateFlag( UpdateFlag flag, bool on ) } } -void QskQuickItem::resetUpdateFlag( UpdateFlag flag ) +void QskItem::resetUpdateFlag( UpdateFlag flag ) { - Q_D( QskQuickItem ); + Q_D( QskItem ); d->updateFlagsMask &= ~flag; @@ -556,14 +556,14 @@ void QskQuickItem::resetUpdateFlag( UpdateFlag flag ) } } -bool QskQuickItem::testUpdateFlag( UpdateFlag flag ) const +bool QskItem::testUpdateFlag( UpdateFlag flag ) const { return d_func()->updateFlags & flag; } -void QskQuickItem::applyUpdateFlag( UpdateFlag flag, bool on ) +void QskItem::applyUpdateFlag( UpdateFlag flag, bool on ) { - Q_D( QskQuickItem ); + Q_D( QskItem ); if ( testUpdateFlag( flag ) == on ) return; @@ -575,7 +575,7 @@ void QskQuickItem::applyUpdateFlag( UpdateFlag flag, bool on ) switch ( flag ) { - case QskQuickItem::DeferredUpdate: + case QskItem::DeferredUpdate: { if ( on ) { @@ -589,14 +589,14 @@ void QskQuickItem::applyUpdateFlag( UpdateFlag flag, bool on ) break; } - case QskQuickItem::DeferredPolish: + case QskItem::DeferredPolish: { if ( !on && d->blockedPolish ) polish(); break; } - case QskQuickItem::DeferredLayout: + case QskItem::DeferredLayout: { if ( !on ) { @@ -613,14 +613,14 @@ void QskQuickItem::applyUpdateFlag( UpdateFlag flag, bool on ) break; } - case QskQuickItem::CleanupOnVisibility: + case QskItem::CleanupOnVisibility: { if ( on && !isVisible() ) d->cleanupNodes(); break; } - case QskQuickItem::DebugForceBackground: + case QskItem::DebugForceBackground: { // no need to mark it dirty if ( flags() & QQuickItem::ItemHasContents ) @@ -632,11 +632,11 @@ void QskQuickItem::applyUpdateFlag( UpdateFlag flag, bool on ) } } -void QskQuickItem::resetImplicitSize() +void QskItem::resetImplicitSize() { - Q_D( QskQuickItem ); + Q_D( QskItem ); - if ( d->updateFlags & QskQuickItem::DeferredLayout ) + if ( d->updateFlags & QskItem::DeferredLayout ) { d->blockedImplicitSize = true; d->layoutConstraintChanged(); @@ -647,7 +647,7 @@ void QskQuickItem::resetImplicitSize() } } -bool QskQuickItem::event( QEvent* event ) +bool QskItem::event( QEvent* event ) { const int eventType = event->type(); const bool hasContents = flags() & QQuickItem::ItemHasContents; @@ -762,19 +762,19 @@ bool QskQuickItem::event( QEvent* event ) return Inherited::event( event ); } -void QskQuickItem::windowChangeEvent( QskWindowChangeEvent* ) +void QskItem::windowChangeEvent( QskWindowChangeEvent* ) { } -void QskQuickItem::geometryChangeEvent( QskGeometryChangeEvent* ) +void QskItem::geometryChangeEvent( QskGeometryChangeEvent* ) { } -void QskQuickItem::changeEvent( QEvent* ) +void QskItem::changeEvent( QEvent* ) { } -void QskQuickItem::itemChange( QQuickItem::ItemChange change, +void QskItem::itemChange( QQuickItem::ItemChange change, const QQuickItem::ItemChangeData& changeData ) { switch ( change ) @@ -783,8 +783,8 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change, { if ( changeData.window ) { - Q_D( const QskQuickItem ); - if ( d->updateFlags & QskQuickItem::DeferredUpdate ) + Q_D( const QskItem ); + if ( d->updateFlags & QskItem::DeferredUpdate ) qskFilterWindow( changeData.window ); } @@ -824,7 +824,7 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change, #if 1 if ( changeData.window == nullptr ) { - Q_D( QskQuickItem ); + Q_D( QskItem ); if( d->focus ) { @@ -854,7 +854,7 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change, } case QQuickItem::ItemVisibleHasChanged: { - Q_D( QskQuickItem ); + Q_D( QskItem ); #if 1 /* ~QQuickItem sends QQuickItem::ItemVisibleHasChanged recursively @@ -868,7 +868,7 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change, if ( d->blockedPolish ) polish(); - if ( d->updateFlags & QskQuickItem::DeferredUpdate ) + if ( d->updateFlags & QskItem::DeferredUpdate ) { if ( d->dirtyAttributes && ( d->flags & QQuickItem::ItemHasContents ) ) update(); @@ -876,7 +876,7 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change, } else { - if ( d->updateFlags & QskQuickItem::CleanupOnVisibility ) + if ( d->updateFlags & QskItem::CleanupOnVisibility ) d->cleanupNodes(); d->initiallyPainted = false; @@ -923,7 +923,7 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change, #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) -void QskQuickItem::geometryChanged( +void QskItem::geometryChanged( const QRectF& newGeometry, const QRectF& oldGeometry ) { geometryChange( newGeometry, oldGeometry ); @@ -931,7 +931,7 @@ void QskQuickItem::geometryChanged( #endif -void QskQuickItem::geometryChange( +void QskItem::geometryChange( const QRectF& newGeometry, const QRectF& oldGeometry ) { #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) @@ -940,7 +940,7 @@ void QskQuickItem::geometryChange( Inherited::geometryChange( newGeometry, oldGeometry ); #endif - Q_D( const QskQuickItem ); + Q_D( const QskItem ); if ( !d->polishScheduled && d->polishOnResize ) { if ( newGeometry.size() != oldGeometry.size() ) @@ -951,30 +951,30 @@ void QskQuickItem::geometryChange( QCoreApplication::sendEvent( this, &event ); } -void QskQuickItem::mouseUngrabEvent() +void QskItem::mouseUngrabEvent() { Inherited::mouseUngrabEvent(); } -void QskQuickItem::touchUngrabEvent() +void QskItem::touchUngrabEvent() { Inherited::touchUngrabEvent(); } #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) -void QskQuickItem::windowDeactivateEvent() +void QskItem::windowDeactivateEvent() { Inherited::windowDeactivateEvent(); } #endif -void QskQuickItem::updatePolish() +void QskItem::updatePolish() { - Q_D( QskQuickItem ); + Q_D( QskItem ); - if ( d->updateFlags & QskQuickItem::DeferredPolish ) + if ( d->updateFlags & QskItem::DeferredPolish ) { if ( !isVisible() ) { @@ -998,21 +998,21 @@ void QskQuickItem::updatePolish() updateItemPolish(); } -void QskQuickItem::aboutToShow() +void QskItem::aboutToShow() { } -void QskQuickItem::updateItemPolish() +void QskItem::updateItemPolish() { } -QSGNode* QskQuickItem::updatePaintNode( QSGNode* node, UpdatePaintNodeData* data ) +QSGNode* QskItem::updatePaintNode( QSGNode* node, UpdatePaintNodeData* data ) { Q_UNUSED( data ) - Q_D( QskQuickItem ); + Q_D( QskItem ); - Q_ASSERT( isVisible() || !( d->updateFlags & QskQuickItem::DeferredUpdate ) ); + Q_ASSERT( isVisible() || !( d->updateFlags & QskItem::DeferredUpdate ) ); d->initiallyPainted = true; @@ -1040,9 +1040,9 @@ QSGNode* QskQuickItem::updatePaintNode( QSGNode* node, UpdatePaintNodeData* data return updateItemPaintNode( node ); } -QSGNode* QskQuickItem::updateItemPaintNode( QSGNode* node ) +QSGNode* QskItem::updateItemPaintNode( QSGNode* node ) { return node; } -#include "moc_QskQuickItem.cpp" +#include "moc_QskItem.cpp" diff --git a/src/controls/QskQuickItem.h b/src/controls/QskItem.h similarity index 88% rename from src/controls/QskQuickItem.h rename to src/controls/QskItem.h index 5fdfe10c..7d9e90f2 100644 --- a/src/controls/QskQuickItem.h +++ b/src/controls/QskItem.h @@ -3,17 +3,17 @@ * SPDX-License-Identifier: BSD-3-Clause *****************************************************************************/ -#ifndef QSK_QUICK_ITEM_H -#define QSK_QUICK_ITEM_H +#ifndef QSK_ITEM_H +#define QSK_ITEM_H #include "QskGlobal.h" #include -class QskQuickItemPrivate; +class QskItemPrivate; class QskGeometryChangeEvent; class QskWindowChangeEvent; -class QSK_EXPORT QskQuickItem : public QQuickItem +class QSK_EXPORT QskItem : public QQuickItem { Q_OBJECT @@ -56,7 +56,7 @@ class QSK_EXPORT QskQuickItem : public QQuickItem Q_ENUM( UpdateFlag ) Q_DECLARE_FLAGS( UpdateFlags, UpdateFlag ) - ~QskQuickItem() override; + ~QskItem() override; const char* className() const; @@ -136,7 +136,7 @@ class QSK_EXPORT QskQuickItem : public QQuickItem #endif protected: - QskQuickItem( QskQuickItemPrivate&, QQuickItem* = nullptr ); + QskItem( QskItemPrivate&, QQuickItem* = nullptr ); bool event( QEvent* ) override; @@ -182,40 +182,40 @@ class QSK_EXPORT QskQuickItem : public QQuickItem void updatePolish() override final; virtual void updateItemPolish(); - Q_DECLARE_PRIVATE( QskQuickItem ) + Q_DECLARE_PRIVATE( QskItem ) }; -inline bool QskQuickItem::hasChildItems() const +inline bool QskItem::hasChildItems() const { return !childItems().isEmpty(); } -inline void QskQuickItem::setGeometry( const QPointF& pos, const QSizeF& size ) +inline void QskItem::setGeometry( const QPointF& pos, const QSizeF& size ) { setGeometry( pos.x(), pos.y(), size.width(), size.height() ); } -inline void QskQuickItem::setGeometry( const QRectF& rect ) +inline void QskItem::setGeometry( const QRectF& rect ) { setGeometry( rect.x(), rect.y(), rect.width(), rect.height() ); } -inline void QskQuickItem::setPosition( qreal x, qreal y ) +inline void QskItem::setPosition( qreal x, qreal y ) { QQuickItem::setPosition( QPointF( x, y ) ); } -inline void QskQuickItem::setSize( qreal width, qreal height ) +inline void QskItem::setSize( qreal width, qreal height ) { QQuickItem::setSize( QSizeF( width, height ) ); } -inline QSizeF QskQuickItem::implicitSize() const +inline QSizeF QskItem::implicitSize() const { return QSizeF( implicitWidth(), implicitHeight() ); } -Q_DECLARE_OPERATORS_FOR_FLAGS( QskQuickItem::UpdateFlags ) -Q_DECLARE_METATYPE( QskQuickItem::UpdateFlags ) +Q_DECLARE_OPERATORS_FOR_FLAGS( QskItem::UpdateFlags ) +Q_DECLARE_METATYPE( QskItem::UpdateFlags ) #endif diff --git a/src/controls/QskQuickItemPrivate.cpp b/src/controls/QskItemPrivate.cpp similarity index 83% rename from src/controls/QskQuickItemPrivate.cpp rename to src/controls/QskItemPrivate.cpp index 2310f359..6887a47c 100644 --- a/src/controls/QskQuickItemPrivate.cpp +++ b/src/controls/QskItemPrivate.cpp @@ -3,7 +3,7 @@ * SPDX-License-Identifier: BSD-3-Clause *****************************************************************************/ -#include "QskQuickItemPrivate.h" +#include "QskItemPrivate.h" #include "QskTreeNode.h" #include "QskSetup.h" @@ -13,7 +13,7 @@ static inline void qskSendEventTo( QObject* object, QEvent::Type type ) QCoreApplication::sendEvent( object, &event ); } -QskQuickItemPrivate::QskQuickItemPrivate() +QskItemPrivate::QskItemPrivate() : updateFlags( qskSetup->itemUpdateFlags() ) , updateFlagsMask( 0 ) , polishOnResize( false ) @@ -24,7 +24,7 @@ QskQuickItemPrivate::QskQuickItemPrivate() , wheelEnabled( false ) , focusPolicy( Qt::NoFocus ) { - if ( updateFlags & QskQuickItem::DeferredLayout ) + if ( updateFlags & QskItem::DeferredLayout ) { /* In general the geometry of an item should be the job of @@ -49,16 +49,16 @@ QskQuickItemPrivate::QskQuickItemPrivate() } } -QskQuickItemPrivate::~QskQuickItemPrivate() +QskItemPrivate::~QskItemPrivate() { } -void QskQuickItemPrivate::mirrorChange() +void QskItemPrivate::mirrorChange() { qskSendEventTo( q_func(), QEvent::LayoutDirectionChange ); } -void QskQuickItemPrivate::applyUpdateFlags( QskQuickItem::UpdateFlags flags ) +void QskItemPrivate::applyUpdateFlags( QskItem::UpdateFlags flags ) { /* Replace all flags, that have not been set explicitely by the @@ -70,12 +70,12 @@ void QskQuickItemPrivate::applyUpdateFlags( QskQuickItem::UpdateFlags flags ) if ( flags == oldFlags ) return; - Q_Q( QskQuickItem ); + Q_Q( QskItem ); Q_STATIC_ASSERT( sizeof( updateFlags ) == 1 ); for ( uint i = 0; i < 8; i++ ) { - const auto flag = static_cast< QskQuickItem::UpdateFlag >( 1 << i ); + const auto flag = static_cast< QskItem::UpdateFlag >( 1 << i ); if ( !( this->updateFlagsMask & flag ) ) q->applyUpdateFlag( flag, flags & flag ); @@ -85,40 +85,40 @@ void QskQuickItemPrivate::applyUpdateFlags( QskQuickItem::UpdateFlags flags ) Q_EMIT q->updateFlagsChanged( q->updateFlags() ); } -void QskQuickItemPrivate::layoutConstraintChanged() +void QskItemPrivate::layoutConstraintChanged() { if ( auto item = q_func()->parentItem() ) qskSendEventTo( item, QEvent::LayoutRequest ); } -void QskQuickItemPrivate::implicitSizeChanged() +void QskItemPrivate::implicitSizeChanged() { layoutConstraintChanged(); } -qreal QskQuickItemPrivate::getImplicitWidth() const +qreal QskItemPrivate::getImplicitWidth() const { if ( blockedImplicitSize ) { - auto that = const_cast< QskQuickItemPrivate* >( this ); + auto that = const_cast< QskItemPrivate* >( this ); that->updateImplicitSize( false ); } return implicitWidth; } -qreal QskQuickItemPrivate::getImplicitHeight() const +qreal QskItemPrivate::getImplicitHeight() const { if ( blockedImplicitSize ) { - auto that = const_cast< QskQuickItemPrivate* >( this ); + auto that = const_cast< QskItemPrivate* >( this ); that->updateImplicitSize( false ); } return implicitHeight; } -void QskQuickItemPrivate::updateImplicitSize( bool doNotify ) +void QskItemPrivate::updateImplicitSize( bool doNotify ) { blockedImplicitSize = false; @@ -126,7 +126,7 @@ void QskQuickItemPrivate::updateImplicitSize( bool doNotify ) setImplicitSize( hint.width(), hint.height(), doNotify ); } -void QskQuickItemPrivate::setImplicitSize( qreal w, qreal h, bool doNotify ) +void QskItemPrivate::setImplicitSize( qreal w, qreal h, bool doNotify ) { const bool doWidth = ( w != implicitWidth ); const bool doHeight = ( h != implicitHeight ); @@ -162,7 +162,7 @@ void QskQuickItemPrivate::setImplicitSize( qreal w, qreal h, bool doNotify ) const QRectF oldRect( x, y, oldWidth, oldHeight ); const QRectF newRect( x, y, width, height ); - Q_Q( QskQuickItem ); + Q_Q( QskItem ); q->geometryChange( newRect, oldRect ); } } @@ -181,7 +181,7 @@ void QskQuickItemPrivate::setImplicitSize( qreal w, qreal h, bool doNotify ) In case of the application interferes by calling setImplicitWidth or setImplicitHeight manually: */ -void QskQuickItemPrivate::implicitWidthChanged() +void QskItemPrivate::implicitWidthChanged() { Inherited::implicitWidthChanged(); @@ -189,7 +189,7 @@ void QskQuickItemPrivate::implicitWidthChanged() implicitSizeChanged(); } -void QskQuickItemPrivate::implicitHeightChanged() +void QskItemPrivate::implicitHeightChanged() { Inherited::implicitWidthChanged(); @@ -197,7 +197,7 @@ void QskQuickItemPrivate::implicitHeightChanged() implicitSizeChanged(); } -void QskQuickItemPrivate::cleanupNodes() +void QskItemPrivate::cleanupNodes() { if ( itemNodeInstance == nullptr ) return; @@ -243,7 +243,7 @@ void QskQuickItemPrivate::cleanupNodes() } } -QSGTransformNode* QskQuickItemPrivate::createTransformNode() +QSGTransformNode* QskItemPrivate::createTransformNode() { return new QskItemNode(); } diff --git a/src/controls/QskQuickItemPrivate.h b/src/controls/QskItemPrivate.h similarity index 81% rename from src/controls/QskQuickItemPrivate.h rename to src/controls/QskItemPrivate.h index 8fff90c9..6d7b8d54 100644 --- a/src/controls/QskQuickItemPrivate.h +++ b/src/controls/QskItemPrivate.h @@ -3,26 +3,26 @@ * SPDX-License-Identifier: BSD-3-Clause *****************************************************************************/ -#ifndef QSK_QUICK_ITEM_PRIVATE_H -#define QSK_QUICK_ITEM_PRIVATE_H +#ifndef QSK_ITEM_PRIVATE_H +#define QSK_ITEM_PRIVATE_H #include "QskGlobal.h" -#include "QskQuickItem.h" +#include "QskItem.h" QSK_QT_PRIVATE_BEGIN #include QSK_QT_PRIVATE_END -class QskQuickItemPrivate : public QQuickItemPrivate +class QskItemPrivate : public QQuickItemPrivate { using Inherited = QQuickItemPrivate; protected: - QskQuickItemPrivate(); - ~QskQuickItemPrivate() override; + QskItemPrivate(); + ~QskItemPrivate() override; public: - void applyUpdateFlags( QskQuickItem::UpdateFlags ); + void applyUpdateFlags( QskItem::UpdateFlags ); QSGTransformNode* createTransformNode() override; protected: @@ -45,7 +45,7 @@ class QskQuickItemPrivate : public QQuickItemPrivate virtual QSizeF implicitSizeHint() const = 0; private: - Q_DECLARE_PUBLIC( QskQuickItem ) + Q_DECLARE_PUBLIC( QskItem ) quint8 updateFlags; quint8 updateFlagsMask; diff --git a/src/controls/QskQuick.cpp b/src/controls/QskQuick.cpp index 3c153188..9b97db41 100644 --- a/src/controls/QskQuick.cpp +++ b/src/controls/QskQuick.cpp @@ -65,7 +65,7 @@ bool qskIsItemInDestructor( const QQuickItem* item ) return d->inDestructor; #else /* - QskQuickItem sets componentComplete to false in its destructor, + QskItem sets componentComplete to false in its destructor, but for other items we will will return the wrong information */ return !d->componentComplete; diff --git a/src/controls/QskSetup.cpp b/src/controls/QskSetup.cpp index f70c657f..f779d0f2 100644 --- a/src/controls/QskSetup.cpp +++ b/src/controls/QskSetup.cpp @@ -23,29 +23,29 @@ static inline bool qskHasEnvironment( const char* env ) return !result.isEmpty() && result != "false"; } -static inline const QskQuickItem::UpdateFlags qskEnvironmentUpdateFlags() +static inline const QskItem::UpdateFlags qskEnvironmentUpdateFlags() { - QskQuickItem::UpdateFlags flags; + QskItem::UpdateFlags flags; if ( qskHasEnvironment( "QSK_PREFER_RASTER" ) ) - flags |= QskQuickItem::PreferRasterForTextures; + flags |= QskItem::PreferRasterForTextures; if ( qskHasEnvironment( "QSK_FORCE_BACKGROUND" ) ) - flags |= QskQuickItem::DebugForceBackground; + flags |= QskItem::DebugForceBackground; return flags; } -static inline QskQuickItem::UpdateFlags qskDefaultUpdateFlags() +static inline QskItem::UpdateFlags qskDefaultUpdateFlags() { - static QskQuickItem::UpdateFlags flags; + static QskItem::UpdateFlags flags; if ( flags == 0 ) { - flags |= QskQuickItem::DeferredUpdate; - flags |= QskQuickItem::DeferredPolish; - flags |= QskQuickItem::DeferredLayout; - flags |= QskQuickItem::CleanupOnVisibility; + flags |= QskItem::DeferredUpdate; + flags |= QskItem::DeferredPolish; + flags |= QskItem::DeferredLayout; + flags |= QskItem::CleanupOnVisibility; flags |= qskEnvironmentUpdateFlags(); } @@ -69,7 +69,7 @@ class QskSetup::PrivateData } QskGraphicProviderMap graphicProviders; - QskQuickItem::UpdateFlags itemUpdateFlags; + QskItem::UpdateFlags itemUpdateFlags; }; QskSetup::QskSetup() @@ -94,7 +94,7 @@ void QskSetup::cleanup() s_instance = nullptr; } -void QskSetup::setItemUpdateFlags( QskQuickItem::UpdateFlags flags ) +void QskSetup::setItemUpdateFlags( QskItem::UpdateFlags flags ) { if ( m_data->itemUpdateFlags != flags ) { @@ -103,7 +103,7 @@ void QskSetup::setItemUpdateFlags( QskQuickItem::UpdateFlags flags ) } } -QskQuickItem::UpdateFlags QskSetup::itemUpdateFlags() const +QskItem::UpdateFlags QskSetup::itemUpdateFlags() const { return m_data->itemUpdateFlags; } @@ -113,7 +113,7 @@ void QskSetup::resetItemUpdateFlags() setItemUpdateFlags( qskDefaultUpdateFlags() ); } -void QskSetup::setItemUpdateFlag( QskQuickItem::UpdateFlag flag, bool on ) +void QskSetup::setItemUpdateFlag( QskItem::UpdateFlag flag, bool on ) { if ( m_data->itemUpdateFlags.testFlag( flag ) != on ) { @@ -126,12 +126,12 @@ void QskSetup::setItemUpdateFlag( QskQuickItem::UpdateFlag flag, bool on ) } } -void QskSetup::resetItemUpdateFlag( QskQuickItem::UpdateFlag flag ) +void QskSetup::resetItemUpdateFlag( QskItem::UpdateFlag flag ) { setItemUpdateFlag( flag, flag & qskDefaultUpdateFlags() ); } -bool QskSetup::testItemUpdateFlag( QskQuickItem::UpdateFlag flag ) +bool QskSetup::testItemUpdateFlag( QskItem::UpdateFlag flag ) { return m_data->itemUpdateFlags.testFlag( flag ); } diff --git a/src/controls/QskSetup.h b/src/controls/QskSetup.h index 85d3a5af..371b5f9b 100644 --- a/src/controls/QskSetup.h +++ b/src/controls/QskSetup.h @@ -7,7 +7,7 @@ #define QSK_SETUP_H #include "QskGlobal.h" -#include "QskQuickItem.h" +#include "QskItem.h" #include #include @@ -29,13 +29,13 @@ class QSK_EXPORT QskSetup : public QObject static QskSetup* instance(); - void setItemUpdateFlags( QskQuickItem::UpdateFlags ); + void setItemUpdateFlags( QskItem::UpdateFlags ); void resetItemUpdateFlags(); - QskQuickItem::UpdateFlags itemUpdateFlags() const; + QskItem::UpdateFlags itemUpdateFlags() const; - void setItemUpdateFlag( QskQuickItem::UpdateFlag, bool on = true ); - void resetItemUpdateFlag( QskQuickItem::UpdateFlag ); - bool testItemUpdateFlag( QskQuickItem::UpdateFlag ); + void setItemUpdateFlag( QskItem::UpdateFlag, bool on = true ); + void resetItemUpdateFlag( QskItem::UpdateFlag ); + bool testItemUpdateFlag( QskItem::UpdateFlag ); void addGraphicProvider( const QString& providerId, QskGraphicProvider* ); QskGraphicProvider* graphicProvider( const QString& providerId ) const; diff --git a/src/controls/QskSkinlet.cpp b/src/controls/QskSkinlet.cpp index 93b86dce..5a5ca395 100644 --- a/src/controls/QskSkinlet.cpp +++ b/src/controls/QskSkinlet.cpp @@ -126,10 +126,10 @@ static inline QSGNode* qskUpdateGraphicNode( if ( graphicNode == nullptr ) graphicNode = new QskGraphicNode(); - const auto flag = QskQuickItem::PreferRasterForTextures; + const auto flag = QskItem::PreferRasterForTextures; bool useRaster = qskSetup->testItemUpdateFlag( flag ); - if ( auto qItem = qobject_cast< const QskQuickItem* >( item ) ) + if ( auto qItem = qobject_cast< const QskItem* >( item ) ) useRaster = qItem->testUpdateFlag( flag ); graphicNode->setRenderHint( useRaster ? QskPaintedNode::Raster : QskPaintedNode::OpenGL ); @@ -345,7 +345,7 @@ void QskSkinlet::updateNode( QskSkinnable* skinnable, QSGNode* parentNode ) cons oldNode = findChildNode( parentNode, DebugRole ); newNode = nullptr; - if ( control->testUpdateFlag( QskQuickItem::DebugForceBackground ) ) + if ( control->testUpdateFlag( QskItem::DebugForceBackground ) ) newNode = updateDebugNode( control, oldNode ); replaceChildNode( DebugRole, parentNode, oldNode, newNode ); diff --git a/src/nodes/QskTreeNode.h b/src/nodes/QskTreeNode.h index ad50ad83..78d31ffa 100644 --- a/src/nodes/QskTreeNode.h +++ b/src/nodes/QskTreeNode.h @@ -32,7 +32,7 @@ QSK_EXPORT QskTreeNode* qskTreeNodeCast( QSGNode* ); QSK_EXPORT const QskTreeNode* qskTreeNodeCast( const QSGNode* ); /* - Used by all QskQuickItem as root node ( = itemNode ) of its subtree + Used by QskItem as root node ( = itemNode ) of its subtree ( see qskItemNode in QskQuick.h ) */ class QSK_EXPORT QskItemNode final : public QSGTransformNode diff --git a/support/SkinnyShortcut.cpp b/support/SkinnyShortcut.cpp index 006a69bd..989f93b6 100644 --- a/support/SkinnyShortcut.cpp +++ b/support/SkinnyShortcut.cpp @@ -111,7 +111,7 @@ void SkinnyShortcut::showBackground() scengraphDebugMode = sgDebugModes[ id - 2 ]; } - qskSetup->setItemUpdateFlag( QskQuickItem::DebugForceBackground, forceBackground ); + qskSetup->setItemUpdateFlag( QskItem::DebugForceBackground, forceBackground ); const auto windows = QGuiApplication::topLevelWindows(); for ( auto window : windows )