aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquicktextfield_p_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquicktextfield_p_p.h')
-rw-r--r--src/quicktemplates2/qquicktextfield_p_p.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquicktextfield_p_p.h b/src/quicktemplates2/qquicktextfield_p_p.h
index e863a92d..3389d3dc 100644
--- a/src/quicktemplates2/qquicktextfield_p_p.h
+++ b/src/quicktemplates2/qquicktextfield_p_p.h
@@ -50,6 +50,7 @@
#include <QtQml/private/qlazilyallocated_p.h>
#include <QtQuick/private/qquicktextinput_p_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQuickTemplates2/private/qquickpresshandler_p_p.h>
#include <QtQuickTemplates2/private/qquickdeferredpointer_p_p.h>
@@ -61,7 +62,7 @@
QT_BEGIN_NAMESPACE
-class QQuickTextFieldPrivate : public QQuickTextInputPrivate
+class QQuickTextFieldPrivate : public QQuickTextInputPrivate, public QQuickItemChangeListener
#if QT_CONFIG(accessibility)
, public QAccessible::ActivationObserver
#endif
@@ -75,6 +76,17 @@ public:
static QQuickTextFieldPrivate *get(QQuickTextField *item) {
return static_cast<QQuickTextFieldPrivate *>(QObjectPrivate::get(item)); }
+ inline QMarginsF getInset() const { return QMarginsF(getLeftInset(), getTopInset(), getRightInset(), getBottomInset()); }
+ inline qreal getTopInset() const { return extra.isAllocated() ? extra->topInset : 0; }
+ inline qreal getLeftInset() const { return extra.isAllocated() ? extra->leftInset : 0; }
+ inline qreal getRightInset() const { return extra.isAllocated() ? extra->rightInset : 0; }
+ inline qreal getBottomInset() const { return extra.isAllocated() ? extra->bottomInset : 0; }
+
+ void setTopInset(qreal value, bool reset = false);
+ void setLeftInset(qreal value, bool reset = false);
+ void setRightInset(qreal value, bool reset = false);
+ void setBottomInset(qreal value, bool reset = false);
+
void resizeBackground();
void resolveFont();
@@ -116,20 +128,37 @@ public:
void cancelBackground();
void executeBackground(bool complete = false);
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+ void itemDestroyed(QQuickItem *item) override;
+
#if QT_CONFIG(quicktemplates2_hover)
bool hovered = false;
bool explicitHoverEnabled = false;
#endif
struct ExtraData {
+ bool hasTopInset = false;
+ bool hasLeftInset = false;
+ bool hasRightInset = false;
+ bool hasBottomInset = false;
+ bool hasBackgroundWidth = false;
+ bool hasBackgroundHeight = false;
+ qreal topInset = 0;
+ qreal leftInset = 0;
+ qreal rightInset = 0;
+ qreal bottomInset = 0;
QFont requestedFont;
QPalette requestedPalette;
};
QLazilyAllocated<ExtraData> extra;
+ bool resizingBackground = false;
QPalette resolvedPalette;
QQuickDeferredPointer<QQuickItem> background;
QString placeholder;
+ QColor placeholderColor;
Qt::FocusReason focusReason = Qt::OtherFocusReason;
QQuickPressHandler pressHandler;
};