Clean up data members and initialization in QAbstractSpinBox
Group the bit flags together and generally order roughly by size to give the compiler better packing options. Change-Id: I9468d5aaef96e115ad363c59222e626d792a0edc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
bb5171fb54
commit
d2e3f00367
@ -1425,15 +1425,9 @@ void QAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate()
|
QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate()
|
||||||
: edit(nullptr), type(QMetaType::UnknownType), spinClickTimerId(-1),
|
: pendingEmit(false), readOnly(false), wrapping(false),
|
||||||
spinClickTimerInterval(100), spinClickThresholdTimerId(-1), spinClickThresholdTimerInterval(-1),
|
ignoreCursorPositionChanged(false), frame(true), accelerate(false), keyboardTracking(true),
|
||||||
effectiveSpinRepeatRate(1), buttonState(None), keyboardModifiers{}, cachedText(QLatin1String("\x01")),
|
cleared(false), ignoreUpdateEdit(false), showGroupSeparator(false)
|
||||||
cachedState(QValidator::Invalid), pendingEmit(false), readOnly(false), wrapping(false),
|
|
||||||
ignoreCursorPositionChanged(false), frame(true), accelerate(false), keyboardTracking(true),
|
|
||||||
cleared(false), ignoreUpdateEdit(false), correctionMode(QAbstractSpinBox::CorrectToPreviousValue),
|
|
||||||
stepModifier(Qt::ControlModifier), acceleration(0), hoverControl(QStyle::SC_None),
|
|
||||||
buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(nullptr), showGroupSeparator(0),
|
|
||||||
wheelDeltaRemainder(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,18 +124,32 @@ public:
|
|||||||
|
|
||||||
virtual QVariant calculateAdaptiveDecimalStep(int steps) const;
|
virtual QVariant calculateAdaptiveDecimalStep(int steps) const;
|
||||||
|
|
||||||
QLineEdit *edit;
|
|
||||||
QString prefix, suffix, specialValueText;
|
QString prefix, suffix, specialValueText;
|
||||||
QVariant value, minimum, maximum, singleStep;
|
QVariant value, minimum, maximum, singleStep;
|
||||||
QMetaType::Type type;
|
QRect hoverRect;
|
||||||
int spinClickTimerId, spinClickTimerInterval, spinClickThresholdTimerId, spinClickThresholdTimerInterval;
|
|
||||||
int effectiveSpinRepeatRate;
|
mutable QString cachedText = QLatin1String("\x01");
|
||||||
uint buttonState;
|
|
||||||
Qt::KeyboardModifiers keyboardModifiers;
|
|
||||||
mutable QString cachedText;
|
|
||||||
mutable QVariant cachedValue;
|
mutable QVariant cachedValue;
|
||||||
mutable QValidator::State cachedState;
|
|
||||||
mutable QSize cachedSizeHint, cachedMinimumSizeHint;
|
mutable QSize cachedSizeHint, cachedMinimumSizeHint;
|
||||||
|
QLineEdit *edit = nullptr;
|
||||||
|
QSpinBoxValidator *validator = nullptr;
|
||||||
|
QMetaType::Type type = QMetaType::UnknownType;
|
||||||
|
int spinClickTimerId = -1;
|
||||||
|
int spinClickTimerInterval = 100;
|
||||||
|
int spinClickThresholdTimerId = -1;
|
||||||
|
int spinClickThresholdTimerInterval = -1;
|
||||||
|
int effectiveSpinRepeatRate = 1;
|
||||||
|
int acceleration = 0;
|
||||||
|
int wheelDeltaRemainder = 0;
|
||||||
|
|
||||||
|
Qt::KeyboardModifiers keyboardModifiers = Qt::NoModifier;
|
||||||
|
Qt::KeyboardModifier stepModifier = Qt::ControlModifier;
|
||||||
|
QAbstractSpinBox::CorrectionMode correctionMode = QAbstractSpinBox::CorrectToPreviousValue;
|
||||||
|
QAbstractSpinBox::StepType stepType = QAbstractSpinBox::StepType::DefaultStepType;
|
||||||
|
QAbstractSpinBox::ButtonSymbols buttonSymbols = QAbstractSpinBox::UpDownArrows;
|
||||||
|
QStyle::SubControl hoverControl = QStyle::SC_None;
|
||||||
|
mutable QValidator::State cachedState = QValidator::Invalid;
|
||||||
|
uint buttonState = None;
|
||||||
uint pendingEmit : 1;
|
uint pendingEmit : 1;
|
||||||
uint readOnly : 1;
|
uint readOnly : 1;
|
||||||
uint wrapping : 1;
|
uint wrapping : 1;
|
||||||
@ -145,16 +159,7 @@ public:
|
|||||||
uint keyboardTracking : 1;
|
uint keyboardTracking : 1;
|
||||||
uint cleared : 1;
|
uint cleared : 1;
|
||||||
uint ignoreUpdateEdit : 1;
|
uint ignoreUpdateEdit : 1;
|
||||||
QAbstractSpinBox::CorrectionMode correctionMode;
|
|
||||||
QAbstractSpinBox::StepType stepType = QAbstractSpinBox::StepType::DefaultStepType;
|
|
||||||
Qt::KeyboardModifier stepModifier = Qt::ControlModifier;
|
|
||||||
int acceleration;
|
|
||||||
QStyle::SubControl hoverControl;
|
|
||||||
QRect hoverRect;
|
|
||||||
QAbstractSpinBox::ButtonSymbols buttonSymbols;
|
|
||||||
QSpinBoxValidator *validator;
|
|
||||||
uint showGroupSeparator : 1;
|
uint showGroupSeparator : 1;
|
||||||
int wheelDeltaRemainder;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class QSpinBoxValidator : public QValidator
|
class QSpinBoxValidator : public QValidator
|
||||||
|
Loading…
x
Reference in New Issue
Block a user