QLineEdit: don't hold SideWidgetEntry's in a QList

SideWidgetEntry is larger than a void*, so holding it in QList
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.

Fix by marking it movable, and holding in a QVector instead.

Change-Id: Ia87b9ac634ad9386bc667355e6e236bc3d56ab29
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2015-07-09 21:40:58 +02:00
parent 4a24de06f6
commit b3364cd8bf

View File

@ -111,7 +111,7 @@ public:
QAction *action;
int flags;
};
typedef QList<SideWidgetEntry> SideWidgetEntryList;
typedef QVector<SideWidgetEntry> SideWidgetEntryList;
QLineEditPrivate()
: control(0), frame(1), contextMenuEnabled(1), cursorVisible(0),
@ -225,6 +225,7 @@ private:
int lastTextSize;
mutable QSize m_iconSize;
};
Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetEntry, Q_PRIMITIVE_TYPE);
inline int QLineEditPrivate::effectiveLeftTextMargin() const
{