5#ifndef QQUICKSTYLEITEM_H
6#define QQUICKSTYLEITEM_H
8#include <QtCore/qdebug.h>
10#include <QtQml/qqmlinfo.h>
11#include <QtQuick/private/qquickitem_p.h>
12#include <QtQuickTemplates2/private/qquickcontrol_p.h>
15#include "qquickstyle.h"
18#include <QtCore/qpointer.h>
23#ifndef QML_NAMED_ELEMENT
24#define QML_NAMED_ELEMENT(NAME)
25#define QML_UNCREATABLE(NAME)
29#define qqc2Debug() if (m_debugFlags.testFlag(Debug)) qDebug() << __FUNCTION__ << ":"
30#define qqc2Info() if (m_debugFlags.testFlag(Info)) qDebug() << __FUNCTION__ << ":"
31#define qqc2InfoHeading(HEADING) if (m_debugFlags.testFlag(Info)) qDebug() << "--------" << HEADING << "--------"
33#define qqc2Debug() if (false) qDebug()
34#define qqc2Info() if (false) qDebug()
35#define qqc2InfoHeading(HEADING) if (false) qDebug()
46 Q_PROPERTY(
int left READ left())
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
131 Q_PROPERTY(QQuickItem *control MEMBER m_control NOTIFY controlChanged)
153 Q_DECLARE_FLAGS(DirtyFlags, DirtyFlag)
161 Q_ENUM(OverrideState)
210 QSGNode *
updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *updatePaintNodeData)
override;
211 void geometryChange(
const QRectF &newGeometry,
const QRectF &oldGeometry)
override;
212 void itemChange(ItemChange change,
const ItemChangeData &data)
override;
222 inline QSize contentSize()
const {
return QSize(qCeil(m_contentSize.width()), qCeil(m_contentSize.height())); }
223 inline static QStyle *
style() {
return QQuickNativeStyle::style(); }
225 template <
class T>
inline const T*
control()
const {
227 if (!
dynamic_cast<T *>(m_control.data())) {
228 qmlWarning(
this) <<
"control property is not of correct type";
232 return static_cast<T *>(m_control.data());
241 bool event(QEvent *event)
override;
242 inline void updateGeometry();
243 inline void paintControlToImage();
245 int dprAlignedSize(
const int size)
const;
252 QPointer<QQuickItem> m_control;
253 QImage m_paintedImage;
255 QSizeF m_contentSize;
258 bool m_useNinePatchImage =
true;
259 bool m_polishing =
false;
260 mutable QQuickWindow *m_connectedWindow =
nullptr;
265 int m_transitionDuration = 400;
275Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickStyleItem::DebugFlags)
virtual void connectToControl() const
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void layoutMarginsChanged()
qreal focusFrameRadius() const
virtual StyleItemGeometry calculateGeometry()=0
OverrideState m_overrideState
virtual void paintEvent(QPainter *painter) const =0
void itemChange(ItemChange change, const ItemChangeData &data) override
Called when change occurs for this item.
const T * control() const
void minimumSizeChanged()
QSize contentSize() const
void updatePolish() override
This function should perform any layout as required for this item.
void setContentHeight(qreal contentHeight)
QQuickStyleMargins contentPadding() const
~QQuickStyleItem() override
QQuickStyleMargins layoutMargins() const
void contentPaddingChanged()
QSize minimumSize() const
static QStyle::State controlSize(QQuickItem *item)
void setContentWidth(qreal contentWidth)
void initStyleOptionBase(QStyleOption &styleOption) const
QSGNode * updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *updatePaintNodeData) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
bool event(QEvent *event) override
\reimp
#define QML_UNCREATABLE(REASON)
#define QML_NAMED_ELEMENT(NAME)
static QWindow * effectiveWindow(QQuickWindow *window)
#define qqc2InfoHeading(HEADING)
QMargins ninePatchMargins