Skip to content

Commit f150fb8

Browse files
committedJan 29, 2013
UI enable/disable works
1 parent 94491b8 commit f150fb8

File tree

4 files changed

+182
-79
lines changed

4 files changed

+182
-79
lines changed
 

‎src/app/composer/qgscomposerlabelwidget.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,53 @@ QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QWidg
3232
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, label );
3333
toolBox->addItem( itemPropertiesWidget, tr( "General options" ) );
3434

35+
3536
if ( mComposerLabel )
3637
{
3738
setGuiElementValues();
3839
connect( mComposerLabel, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );
3940
}
4041
}
4142

43+
void QgsComposerLabelWidget::on_mHtmlCheckBox_stateChanged( int state )
44+
{
45+
if ( mComposerLabel )
46+
{
47+
if (state)
48+
{
49+
mFontButton->setEnabled( false );
50+
mFontColorButton->setEnabled( false );
51+
mHorizontalAlignementGroup->setEnabled( false );
52+
mVerticalAlignementGroup->setEnabled( false );
53+
mMarginDoubleSpinBox->setEnabled( false );
54+
mRotationSpinBox->setEnabled( false );
55+
mComposerLabel->beginCommand( tr( "Label text HTML state changed" ), QgsComposerMergeCommand::ComposerLabelSetText );
56+
mComposerLabel->blockSignals( true );
57+
//mComposerLabel->setHtml(state);
58+
mComposerLabel->setText( mTextEdit->toPlainText() );
59+
mComposerLabel->update();
60+
mComposerLabel->blockSignals( false );
61+
mComposerLabel->endCommand();
62+
}
63+
else
64+
{
65+
mFontButton->setEnabled( true );
66+
mFontColorButton->setEnabled( true );
67+
mHorizontalAlignementGroup->setEnabled( true );
68+
mVerticalAlignementGroup->setEnabled( true );
69+
mMarginDoubleSpinBox->setEnabled( true );
70+
mRotationSpinBox->setEnabled( true );
71+
mComposerLabel->beginCommand( tr( "Label text HTML state changed" ), QgsComposerMergeCommand::ComposerLabelSetText );
72+
mComposerLabel->blockSignals( true );
73+
//mComposerLabel->setHtml(state);
74+
mComposerLabel->setText( mTextEdit->toPlainText() );
75+
mComposerLabel->update();
76+
mComposerLabel->blockSignals( false );
77+
mComposerLabel->endCommand();
78+
}
79+
}
80+
}
81+
4282
void QgsComposerLabelWidget::on_mTextEdit_textChanged()
4383
{
4484
if ( mComposerLabel )

‎src/app/composer/qgscomposerlabelwidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class QgsComposerLabelWidget: public QWidget, private Ui::QgsComposerLabelWidget
3232
QgsComposerLabelWidget( QgsComposerLabel* label );
3333

3434
public slots:
35+
void on_mHtmlCheckBox_stateChanged( int i );
3536
void on_mTextEdit_textChanged();
3637
void on_mFontButton_clicked();
3738
void on_mInsertExpressionButton_clicked();

‎src/ui/qgscomposerhtmlwidgetbase.ui

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>243</width>
10-
<height>116</height>
10+
<height>153</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -24,41 +24,54 @@
2424
<rect>
2525
<x>0</x>
2626
<y>0</y>
27-
<width>225</width>
28-
<height>72</height>
27+
<width>221</width>
28+
<height>100</height>
2929
</rect>
3030
</property>
3131
<attribute name="label">
3232
<string>HTML</string>
3333
</attribute>
3434
<layout class="QGridLayout" name="gridLayout">
35-
<item row="1" column="2">
35+
<item row="2" column="2">
3636
<widget class="QToolButton" name="mFileToolButton">
3737
<property name="text">
3838
<string>...</string>
3939
</property>
4040
</widget>
4141
</item>
42-
<item row="1" column="1">
42+
<item row="2" column="1">
4343
<widget class="QLineEdit" name="mUrlLineEdit"/>
4444
</item>
45-
<item row="1" column="0">
45+
<item row="2" column="0">
4646
<widget class="QLabel" name="mUrlLabel">
4747
<property name="text">
4848
<string>URL</string>
4949
</property>
5050
</widget>
5151
</item>
52+
<item row="0" column="1" colspan="2">
53+
<widget class="QComboBox" name="mResizeModeComboBox"/>
54+
</item>
55+
<item row="3" column="1">
56+
<spacer name="verticalSpacer">
57+
<property name="orientation">
58+
<enum>Qt::Vertical</enum>
59+
</property>
60+
<property name="sizeHint" stdset="0">
61+
<size>
62+
<width>20</width>
63+
<height>40</height>
64+
</size>
65+
</property>
66+
</spacer>
67+
</item>
5268
<item row="0" column="0">
5369
<widget class="QLabel" name="mResizeModeLabel">
5470
<property name="text">
5571
<string>Resize mode</string>
5672
</property>
5773
</widget>
5874
</item>
59-
<item row="0" column="1" colspan="2">
60-
<widget class="QComboBox" name="mResizeModeComboBox"/>
61-
</item>
6275
</layout>
6376
</widget>
6477
</widget>

‎src/ui/qgscomposerlabelwidgetbase.ui

Lines changed: 119 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>307</width>
10-
<height>525</height>
9+
<width>443</width>
10+
<height>550</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -30,7 +30,7 @@
3030
<rect>
3131
<x>0</x>
3232
<y>0</y>
33-
<width>276</width>
33+
<width>400</width>
3434
<height>503</height>
3535
</rect>
3636
</property>
@@ -43,47 +43,117 @@
4343
<property name="lineWrapMode">
4444
<enum>QTextEdit::WidgetWidth</enum>
4545
</property>
46+
<property name="html">
47+
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
48+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
49+
p, li { white-space: pre-wrap; }
50+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;&quot;&gt;
51+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
52+
</property>
4653
</widget>
4754
</item>
48-
<item row="3" column="0" colspan="2">
49-
<widget class="QPushButton" name="mFontColorButton">
55+
<item row="7" column="1">
56+
<widget class="QDoubleSpinBox" name="mMarginDoubleSpinBox">
57+
<property name="prefix">
58+
<string/>
59+
</property>
60+
<property name="suffix">
61+
<string> mm</string>
62+
</property>
63+
</widget>
64+
</item>
65+
<item row="8" column="0">
66+
<widget class="QLabel" name="mRotationLabel">
67+
<property name="sizePolicy">
68+
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
69+
<horstretch>0</horstretch>
70+
<verstretch>0</verstretch>
71+
</sizepolicy>
72+
</property>
5073
<property name="text">
51-
<string>Font color...</string>
74+
<string>Rotation</string>
75+
</property>
76+
<property name="wordWrap">
77+
<bool>true</bool>
78+
</property>
79+
<property name="buddy">
80+
<cstring>mRotationSpinBox</cstring>
81+
</property>
82+
</widget>
83+
</item>
84+
<item row="8" column="1">
85+
<widget class="QDoubleSpinBox" name="mRotationSpinBox">
86+
<property name="suffix">
87+
<string> °</string>
88+
</property>
89+
<property name="maximum">
90+
<double>360.000000000000000</double>
91+
</property>
92+
</widget>
93+
</item>
94+
<item row="1" column="0" colspan="2">
95+
<widget class="QPushButton" name="mInsertExpressionButton">
96+
<property name="text">
97+
<string>Insert an expression</string>
98+
</property>
99+
</widget>
100+
</item>
101+
<item row="2" column="0" colspan="2">
102+
<widget class="QCheckBox" name="mHtmlCheckBox">
103+
<property name="text">
104+
<string>Render as HTML</string>
105+
</property>
106+
</widget>
107+
</item>
108+
<item row="7" column="0">
109+
<widget class="QLabel" name="mMarginLabel">
110+
<property name="text">
111+
<string>Margin</string>
52112
</property>
53113
</widget>
54114
</item>
55-
<item row="4" column="0" colspan="2">
56-
<widget class="QGroupBox" name="buttonGroup1">
115+
<item row="6" column="0" colspan="2">
116+
<widget class="QGroupBox" name="mVerticalAlignementGroup">
57117
<property name="title">
58-
<string>Horizontal Alignment:</string>
118+
<string>Vertical Alignment:</string>
59119
</property>
60-
<layout class="QHBoxLayout" name="horizontalLayout">
61-
<property name="sizeConstraint">
62-
<enum>QLayout::SetMinimumSize</enum>
63-
</property>
120+
<layout class="QHBoxLayout" name="horizontalLayout_2">
64121
<item>
65-
<widget class="QRadioButton" name="mLeftRadioButton">
122+
<spacer name="horizontalSpacer_3">
123+
<property name="orientation">
124+
<enum>Qt::Horizontal</enum>
125+
</property>
126+
<property name="sizeHint" stdset="0">
127+
<size>
128+
<width>40</width>
129+
<height>20</height>
130+
</size>
131+
</property>
132+
</spacer>
133+
</item>
134+
<item>
135+
<widget class="QRadioButton" name="mTopRadioButton">
66136
<property name="text">
67-
<string>Left</string>
137+
<string>Top</string>
68138
</property>
69139
</widget>
70140
</item>
71141
<item>
72-
<widget class="QRadioButton" name="mCenterRadioButton">
142+
<widget class="QRadioButton" name="mMiddleRadioButton">
73143
<property name="text">
74-
<string>Center</string>
144+
<string>Middle</string>
75145
</property>
76146
</widget>
77147
</item>
78148
<item>
79-
<widget class="QRadioButton" name="mRightRadioButton">
149+
<widget class="QRadioButton" name="mBottomRadioButton">
80150
<property name="text">
81-
<string>Right</string>
151+
<string>Bottom</string>
82152
</property>
83153
</widget>
84154
</item>
85155
<item>
86-
<spacer name="horizontalSpacer">
156+
<spacer name="horizontalSpacer_4">
87157
<property name="orientation">
88158
<enum>Qt::Horizontal</enum>
89159
</property>
@@ -99,29 +169,45 @@
99169
</widget>
100170
</item>
101171
<item row="5" column="0" colspan="2">
102-
<widget class="QGroupBox" name="buttonGroup2">
172+
<widget class="QGroupBox" name="mHorizontalAlignementGroup">
103173
<property name="title">
104-
<string>Vertical Alignment:</string>
174+
<string>Horizontal Alignment:</string>
105175
</property>
106-
<layout class="QHBoxLayout" name="horizontalLayout_2">
176+
<layout class="QHBoxLayout" name="horizontalLayout">
177+
<property name="sizeConstraint">
178+
<enum>QLayout::SetMinimumSize</enum>
179+
</property>
107180
<item>
108-
<widget class="QRadioButton" name="mTopRadioButton">
181+
<spacer name="horizontalSpacer">
182+
<property name="orientation">
183+
<enum>Qt::Horizontal</enum>
184+
</property>
185+
<property name="sizeHint" stdset="0">
186+
<size>
187+
<width>40</width>
188+
<height>20</height>
189+
</size>
190+
</property>
191+
</spacer>
192+
</item>
193+
<item>
194+
<widget class="QRadioButton" name="mLeftRadioButton">
109195
<property name="text">
110-
<string>Top</string>
196+
<string>Left</string>
111197
</property>
112198
</widget>
113199
</item>
114200
<item>
115-
<widget class="QRadioButton" name="mMiddleRadioButton">
201+
<widget class="QRadioButton" name="mCenterRadioButton">
116202
<property name="text">
117-
<string>Middle</string>
203+
<string>Center</string>
118204
</property>
119205
</widget>
120206
</item>
121207
<item>
122-
<widget class="QRadioButton" name="mBottomRadioButton">
208+
<widget class="QRadioButton" name="mRightRadioButton">
123209
<property name="text">
124-
<string>Bottom</string>
210+
<string>Right</string>
125211
</property>
126212
</widget>
127213
</item>
@@ -141,43 +227,14 @@
141227
</layout>
142228
</widget>
143229
</item>
144-
<item row="6" column="0" colspan="2">
145-
<widget class="QDoubleSpinBox" name="mMarginDoubleSpinBox">
146-
<property name="prefix">
147-
<string>Margin </string>
148-
</property>
149-
<property name="suffix">
150-
<string>mm</string>
151-
</property>
152-
</widget>
153-
</item>
154-
<item row="7" column="0">
155-
<widget class="QLabel" name="mRotationLabel">
156-
<property name="sizePolicy">
157-
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
158-
<horstretch>0</horstretch>
159-
<verstretch>0</verstretch>
160-
</sizepolicy>
161-
</property>
230+
<item row="3" column="1">
231+
<widget class="QPushButton" name="mFontColorButton">
162232
<property name="text">
163-
<string>Rotation</string>
164-
</property>
165-
<property name="wordWrap">
166-
<bool>true</bool>
167-
</property>
168-
<property name="buddy">
169-
<cstring>mRotationSpinBox</cstring>
170-
</property>
171-
</widget>
172-
</item>
173-
<item row="7" column="1">
174-
<widget class="QDoubleSpinBox" name="mRotationSpinBox">
175-
<property name="maximum">
176-
<double>360.000000000000000</double>
233+
<string>Font color...</string>
177234
</property>
178235
</widget>
179236
</item>
180-
<item row="2" column="0" colspan="2">
237+
<item row="3" column="0">
181238
<widget class="QPushButton" name="mFontButton">
182239
<property name="sizePolicy">
183240
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -190,13 +247,6 @@
190247
</property>
191248
</widget>
192249
</item>
193-
<item row="1" column="0" colspan="2">
194-
<widget class="QPushButton" name="mInsertExpressionButton">
195-
<property name="text">
196-
<string>Insert an expression</string>
197-
</property>
198-
</widget>
199-
</item>
200250
</layout>
201251
</widget>
202252
</widget>
@@ -207,7 +257,6 @@
207257
<tabstops>
208258
<tabstop>mTextEdit</tabstop>
209259
<tabstop>mFontButton</tabstop>
210-
<tabstop>mFontColorButton</tabstop>
211260
<tabstop>mMarginDoubleSpinBox</tabstop>
212261
</tabstops>
213262
<resources/>

0 commit comments

Comments
 (0)
Please sign in to comment.