diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-02-21 13:25:43 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-03-06 09:19:58 +0000 |
commit | 51bec76d1041ef809aa0adeec041f14f6124b5ab (patch) | |
tree | d321bbff5e07f18a7812ae0c9066c2db31b7f2bb /src/widgets/widgets/qlineedit_p.h | |
parent | d5fe06a94ebbd2652034acfb64992ea4e744a1fe (diff) |
QLineEditPrivate: introduce SideWidgetLocation class
... as a replacement for QPair<enum, int>, and move some
repsonsibilities into it.
This avoids the repeated use of the magic number -1 to indicate
invalid locations and does away with the confusing .first and .second,
replacing them instead with proper names, .position and .index.
Change-Id: If904c5333cecf8ce3d5160ca4be9264a13a2b72a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/widgets/widgets/qlineedit_p.h')
-rw-r--r-- | src/widgets/widgets/qlineedit_p.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index a903c003e6..2d695f8411 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -235,15 +235,22 @@ public: int effectiveRightTextMargin() const; private: - typedef QPair<QLineEdit::ActionPosition, int> PositionIndexPair; + struct SideWidgetLocation { + QLineEdit::ActionPosition position; + int index; - PositionIndexPair findSideWidget(const QAction *a) const; + bool isValid() const { return index >= 0; } + }; + friend class QTypeInfo<SideWidgetLocation>; + + SideWidgetLocation findSideWidget(const QAction *a) const; SideWidgetEntryList leadingSideWidgets; SideWidgetEntryList trailingSideWidgets; int lastTextSize; }; Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetEntry, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetLocation, Q_PRIMITIVE_TYPE); #endif // QT_NO_LINEEDIT |