Commit bbf6214 1 parent 287f822 commit bbf6214 Copy full SHA for bbf6214
File tree 7 files changed +38
-2
lines changed
7 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,13 @@ Defines if the clear value should be the minimum or maximum values of the widget
117
117
Returns the value used when clear() is called.
118
118
119
119
.. seealso:: :py:func:`setClearValue`
120
+ %End
121
+
122
+ void setLineEditAlignment( Qt::Alignment alignment );
123
+ %Docstring
124
+ Set alignment in the embedded line edit widget
125
+
126
+ :param alignment:
120
127
%End
121
128
122
129
virtual double valueFromText( const QString &text ) const;
Original file line number Diff line number Diff line change @@ -117,6 +117,13 @@ Defines if the clear value should be the minimum or maximum values of the widget
117
117
Returns the value used when clear() is called.
118
118
119
119
.. seealso:: :py:func:`setClearValue`
120
+ %End
121
+
122
+ void setLineEditAlignment( Qt::Alignment alignment );
123
+ %Docstring
124
+ Set alignment in the embedded line edit widget
125
+
126
+ :param alignment:
120
127
%End
121
128
122
129
virtual int valueFromText( const QString &text ) const;
Original file line number Diff line number Diff line change @@ -34,7 +34,6 @@ QgsDoubleSpinBox::QgsDoubleSpinBox( QWidget *parent )
34
34
// By default, group separator is off
35
35
setLocale ( QLocale ( QgsApplication::locale ( ) ) );
36
36
setLineEdit ( mLineEdit );
37
- mLineEdit ->setAlignment ( Qt::AlignRight );
38
37
39
38
QSize msz = minimumSizeHint ();
40
39
setMinimumSize ( msz.width () + CLEAR_ICON_SIZE + 9 + frameWidth () * 2 + 2 ,
@@ -137,6 +136,11 @@ double QgsDoubleSpinBox::clearValue() const
137
136
return mCustomClearValue ;
138
137
}
139
138
139
+ void QgsDoubleSpinBox::setLineEditAlignment ( Qt::Alignment alignment )
140
+ {
141
+ mLineEdit ->setAlignment ( alignment );
142
+ }
143
+
140
144
QString QgsDoubleSpinBox::stripped ( const QString &originalText ) const
141
145
{
142
146
// adapted from QAbstractSpinBoxPrivate::stripped
Original file line number Diff line number Diff line change @@ -126,6 +126,12 @@ class GUI_EXPORT QgsDoubleSpinBox : public QDoubleSpinBox
126
126
*/
127
127
double clearValue () const ;
128
128
129
+ /* *
130
+ * Set alignment in the embedded line edit widget
131
+ * \param alignment
132
+ */
133
+ void setLineEditAlignment ( Qt::Alignment alignment );
134
+
129
135
double valueFromText ( const QString &text ) const override ;
130
136
QValidator::State validate ( QString &input, int &pos ) const override ;
131
137
void paintEvent ( QPaintEvent *e ) override ;
Original file line number Diff line number Diff line change @@ -47,12 +47,14 @@ QWidget *QgsRangeWidgetWrapper::createWidget( QWidget *parent )
47
47
case QVariant::Double:
48
48
{
49
49
editor = new QgsDoubleSpinBox ( parent );
50
+ static_cast <QgsDoubleSpinBox *>( editor )->setLineEditAlignment ( Qt::AlignRight );
50
51
break ;
51
52
}
52
53
case QVariant::Int:
53
54
case QVariant::LongLong:
54
55
default :
55
56
editor = new QgsSpinBox ( parent );
57
+ static_cast <QgsSpinBox *>( editor )->setLineEditAlignment ( Qt::AlignRight );
56
58
break ;
57
59
}
58
60
}
Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ QgsSpinBox::QgsSpinBox( QWidget *parent )
30
30
: QSpinBox( parent )
31
31
{
32
32
mLineEdit = new QgsSpinBoxLineEdit ();
33
- mLineEdit ->setAlignment ( Qt::AlignRight );
34
33
setLineEdit ( mLineEdit );
35
34
36
35
QSize msz = minimumSizeHint ();
@@ -133,6 +132,11 @@ int QgsSpinBox::clearValue() const
133
132
return mCustomClearValue ;
134
133
}
135
134
135
+ void QgsSpinBox::setLineEditAlignment ( Qt::Alignment alignment )
136
+ {
137
+ mLineEdit ->setAlignment ( alignment );
138
+ }
139
+
136
140
int QgsSpinBox::valueFromText ( const QString &text ) const
137
141
{
138
142
if ( !mExpressionsEnabled )
Original file line number Diff line number Diff line change @@ -126,6 +126,12 @@ class GUI_EXPORT QgsSpinBox : public QSpinBox
126
126
*/
127
127
int clearValue () const ;
128
128
129
+ /* *
130
+ * Set alignment in the embedded line edit widget
131
+ * \param alignment
132
+ */
133
+ void setLineEditAlignment ( Qt::Alignment alignment );
134
+
129
135
int valueFromText ( const QString &text ) const override ;
130
136
QValidator::State validate ( QString &input, int &pos ) const override ;
131
137
You can’t perform that action at this time.
0 commit comments