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()
59 const int left = inner.left() - outer.left();
60 const int top = inner.top() - outer.top();
61 const int right = outer.right() - inner.right();
62 const int bottom = outer.bottom() - inner.bottom();
172 InputContentSize = 0x040,
173 DontUseNinePatchImage = 0x080,
174 NinePatchMargins = 0x100,
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());
235 DebugFlags m_debugFlags = NoDebug;
241 inline void updateGeometry();
242 inline void paintControlToImage();
244 int dprAlignedSize(
const int size)
const;
251 QPointer<QQuickItem> m_control;
257 bool m_useNinePatchImage =
true;
258 bool m_polishing =
false;
262 int m_transitionDuration = 150;
264 int m_transitionDuration = 400;
constexpr int bottom() const noexcept
Returns the bottom margin.
constexpr int left() const noexcept
Returns the left margin.
constexpr int right() const noexcept
Returns the right margin.
constexpr int top() const noexcept
Returns the top margin.
The QPainter class performs low-level painting on widgets and other paint devices.
T * data() const noexcept
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QQuickItem * parent
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
virtual void connectToControl() const
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void layoutMarginsChanged()
QQuickStyleMargins contentPadding
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()
virtual Q_INVOKABLE QFont styleFont(QQuickItem *control) const
OverrideState overrideState
minimumSizeChangedint transitionDuration
layoutMarginsChangedQSize minimumSize
QSize contentSize() const
void updatePolish() override
This function should perform any layout as required for this item.
void setContentHeight(qreal contentHeight)
~QQuickStyleItem() override
void contentPaddingChanged()
static QStyle::State controlSize(QQuickItem *item)
contentPaddingChangedQQuickStyleMargins layoutMargins
void setContentWidth(qreal contentWidth)
void initStyleOptionBase(QStyleOption &styleOption) const
QQuickStyleItem(QQuickItem *parent=nullptr)
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...
QQuickStyleMargins(const QMargins &margins)
bool operator!=(const QQuickStyleMargins &other) const
void operator=(const QQuickStyleMargins &other)
QQuickStyleMargins(const QQuickStyleMargins &other)
bool operator==(const QQuickStyleMargins &other) const
QQuickStyleMargins(const QRect &outer, const QRect &inner)
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
Combined button and popup list for selecting options.
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble top
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
#define QML_UNCREATABLE(NAME)
QDebug operator<<(QDebug debug, const QQuickStyleMargins &padding)
#define QML_NAMED_ELEMENT(NAME)
QMargins ninePatchMargins