5#ifndef QQUICKSTYLEITEM_P_H
6#define QQUICKSTYLEITEM_P_H
19#include <private/qqc2qnativestyle_p.h>
20#include <private/qqc2qstyle_p.h>
21#include <private/qqc2qstyleoption_p.h>
22#include <private/qquickcontrol_p.h>
23#include <private/qquickitem_p.h>
25#include <QtQml/qqml.h>
26#include <QtQml/qqmlinfo.h>
28#include <QtCore/qdebug.h>
29#include <QtCore/qpointer.h>
34#ifndef QML_NAMED_ELEMENT
35#define QML_NAMED_ELEMENT(NAME)
36#define QML_UNCREATABLE(NAME)
40#define qqc2Debug() if (m_debugFlags.testFlag(Debug)) qDebug() << __FUNCTION__ << ":"
41#define qqc2Info() if (m_debugFlags.testFlag(Info)) qDebug() << __FUNCTION__ << ":"
42#define qqc2InfoHeading(HEADING) if (m_debugFlags.testFlag(Info)) qDebug() << "--------" << HEADING << "--------"
44#define qqc2Debug() if (false) qDebug()
45#define qqc2Info() if (false) qDebug()
46#define qqc2InfoHeading(HEADING) if (false) qDebug()
57 Q_PROPERTY(
int left READ left())
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
142 Q_PROPERTY(QQuickItem *control MEMBER m_control NOTIFY controlChanged)
164 Q_DECLARE_FLAGS(DirtyFlags, DirtyFlag)
172 Q_ENUM(OverrideState)
221 QSGNode *
updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *updatePaintNodeData)
override;
222 void geometryChange(
const QRectF &newGeometry,
const QRectF &oldGeometry)
override;
223 void itemChange(ItemChange change,
const ItemChangeData &data)
override;
233 inline QSize contentSize()
const {
return QSize(qCeil(m_contentSize.width()), qCeil(m_contentSize.height())); }
236 template <
class T>
inline const T*
control()
const {
238 if (!
dynamic_cast<T *>(m_control.data())) {
239 qmlWarning(
this) <<
"control property is not of correct type";
243 return static_cast<T *>(m_control.data());
252 bool event(QEvent *event)
override;
253 inline void updateGeometry();
254 inline void paintControlToImage();
256 int dprAlignedSize(
const int size)
const;
263 QPointer<QQuickItem> m_control;
264 QImage m_paintedImage;
266 QSizeF m_contentSize;
269 bool m_useNinePatchImage =
true;
270 bool m_polishing =
false;
271 mutable QQuickWindow *m_connectedWindow =
nullptr;
276 int m_transitionDuration = 400;
286Q_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)
QDebug operator<<(QDebug debug, const StyleItemGeometry &cg)
static QWindow * effectiveWindow(QQuickWindow *window)
QDebug operator<<(QDebug debug, const QQuickStyleMargins &padding)
#define qqc2InfoHeading(HEADING)
QMargins ninePatchMargins