4#ifndef QQUICKSTYLEITEM_H
5#define QQUICKSTYLEITEM_H
7#include <QtCore/qdebug.h>
9#include <QtQml/qqmlinfo.h>
10#include <QtQuick/private/qquickitem_p.h>
11#include <QtQuickTemplates2/private/qquickcontrol_p.h>
14#include "qquickstyle.h"
17#include <QtCore/qpointer.h>
22#ifndef QML_NAMED_ELEMENT
23#define QML_NAMED_ELEMENT(NAME)
24#define QML_UNCREATABLE(NAME)
28#define qqc2Debug() if (m_debugFlags.testFlag(Debug)) qDebug() << __FUNCTION__ << ":"
29#define qqc2Info() if (m_debugFlags.testFlag(Info)) qDebug() << __FUNCTION__ << ":"
30#define qqc2InfoHeading(HEADING) if (m_debugFlags.testFlag(Info)) qDebug() << "--------" << HEADING << "--------"
32#define qqc2Debug() if (false) qDebug()
33#define qqc2Info() if (false) qDebug()
34#define qqc2InfoHeading(HEADING) if (false) qDebug()
45 Q_PROPERTY(
int left READ left())
83
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
130 Q_PROPERTY(QQuickItem *control MEMBER m_control NOTIFY controlChanged)
152 Q_DECLARE_FLAGS(DirtyFlags, DirtyFlag)
160 Q_ENUM(OverrideState)
209 QSGNode *
updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *updatePaintNodeData)
override;
210 void geometryChange(
const QRectF &newGeometry,
const QRectF &oldGeometry)
override;
211 void itemChange(ItemChange change,
const ItemChangeData &data)
override;
221 inline QSize contentSize()
const {
return QSize(qCeil(m_contentSize.width()), qCeil(m_contentSize.height())); }
222 inline static QStyle *
style() {
return QQuickNativeStyle::style(); }
224 template <
class T>
inline const T*
control()
const {
226 if (!
dynamic_cast<T *>(m_control.data())) {
227 qmlWarning(
this) <<
"control property is not of correct type";
231 return static_cast<T *>(m_control.data());
240 bool event(QEvent *event)
override;
241 inline void updateGeometry();
242 inline void paintControlToImage();
244 int dprAlignedSize(
const int size)
const;
251 QPointer<QQuickItem> m_control;
252 QImage m_paintedImage;
254 QSizeF m_contentSize;
257 bool m_useNinePatchImage =
true;
258 bool m_polishing =
false;
259 mutable QQuickWindow *m_connectedWindow =
nullptr;
264 int m_transitionDuration = 400;
274Q_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
Combined button and popup list for selecting options.
#define QML_UNCREATABLE(REASON)
#define QML_NAMED_ELEMENT(NAME)
static QWindow * effectiveWindow(QQuickWindow *window)
#define qqc2InfoHeading(HEADING)
QMargins ninePatchMargins