Skip to content

Commit b642722

Browse files
committedJan 29, 2013
upgraded to collapsible groupboxes
1 parent 45a5fe7 commit b642722

File tree

3 files changed

+48
-61
lines changed

3 files changed

+48
-61
lines changed
 

‎src/app/composer/qgscomposeritemwidget.cpp

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -140,46 +140,28 @@ void QgsComposerItemWidget::on_mOutlineWidthSpinBox_valueChanged( double d )
140140
mItem->endCommand();
141141
}
142142

143-
void QgsComposerItemWidget::on_mFrameCheckBox_stateChanged( int state )
143+
void QgsComposerItemWidget::on_mFrameGroupBox_toggled( bool state )
144144
{
145145
if ( !mItem )
146146
{
147147
return;
148148
}
149149

150150
mItem->beginCommand( tr( "Item frame toggled" ) );
151-
if ( state == Qt::Checked )
152-
{
153-
mFrameBox->setEnabled( true );
154-
mItem->setFrameEnabled( true );
155-
}
156-
else
157-
{
158-
mFrameBox->setEnabled( false );
159-
mItem->setFrameEnabled( false );
160-
}
151+
mItem->setFrameEnabled( state );
161152
mItem->update();
162153
mItem->endCommand();
163154
}
164155

165-
void QgsComposerItemWidget::on_mBackgroundCheckBox_stateChanged( int state )
156+
void QgsComposerItemWidget::on_mBackgroundGroupBox_toggled( bool state )
166157
{
167158
if ( !mItem )
168159
{
169160
return;
170161
}
171162

172163
mItem->beginCommand( tr( "Item background toggled" ) );
173-
if ( state == Qt::Checked )
174-
{
175-
mBackgroundBox->setEnabled( true );
176-
mItem->setBackgroundEnabled( true );
177-
}
178-
else
179-
{
180-
mBackgroundBox->setEnabled( false );
181-
mItem->setBackgroundEnabled( false );
182-
}
164+
mItem->setBackgroundEnabled( state );
183165
mItem->update();
184166
mItem->endCommand();
185167
}
@@ -193,26 +175,22 @@ void QgsComposerItemWidget::setValuesForGuiElements()
193175

194176
mOpacitySlider->blockSignals( true );
195177
mOutlineWidthSpinBox->blockSignals( true );
196-
mFrameCheckBox->blockSignals( true );
178+
mFrameGroupBox->blockSignals( true );
179+
mBackgroundGroupBox->blockSignals( true );
197180
mItemIdLineEdit->blockSignals( true );
198181
mOpacitySpinBox->blockSignals( true );
199182

200183
mOpacitySpinBox->setValue( mItem->brush().color().alpha() );
201184
mOpacitySlider->setValue( mItem->brush().color().alpha() );
202185
mOutlineWidthSpinBox->setValue( mItem->pen().widthF() );
203186
mItemIdLineEdit->setText( mItem->id() );
204-
if ( mItem->hasFrame() )
205-
{
206-
mFrameCheckBox->setCheckState( Qt::Checked );
207-
}
208-
else
209-
{
210-
mFrameCheckBox->setCheckState( Qt::Unchecked );
211-
}
212-
187+
mFrameGroupBox->setChecked( mItem->hasFrame() );
188+
mBackgroundGroupBox->setChecked( mItem->hasBackground() );
189+
213190
mOpacitySlider->blockSignals( false );
214191
mOutlineWidthSpinBox->blockSignals( false );
215-
mFrameCheckBox->blockSignals( false );
192+
mFrameGroupBox->blockSignals( false );
193+
mBackgroundGroupBox->blockSignals( false );
216194
mItemIdLineEdit->blockSignals( false );
217195
mOpacitySpinBox->blockSignals( false );
218196
}

‎src/app/composer/qgscomposeritemwidget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBa
3737
void on_mOpacitySlider_sliderReleased();
3838
void on_mOpacitySpinBox_valueChanged( int value );
3939
void on_mOutlineWidthSpinBox_valueChanged( double d );
40-
void on_mFrameCheckBox_stateChanged( int state );
41-
void on_mBackgroundCheckBox_stateChanged( int state );
40+
void on_mFrameGroupBox_toggled( bool state );
41+
void on_mBackgroundGroupBox_toggled( bool state );
4242
void on_mPositionButton_clicked();
4343
void on_mItemIdLineEdit_textChanged( const QString& text );
4444

‎src/ui/qgscomposeritemwidgetbase.ui

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,23 @@
1414
<string>Form</string>
1515
</property>
1616
<layout class="QFormLayout" name="formLayout_2">
17-
<item row="1" column="0">
18-
<widget class="QCheckBox" name="mFrameCheckBox">
17+
<property name="fieldGrowthPolicy">
18+
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
19+
</property>
20+
<item row="0" column="0" colspan="2">
21+
<widget class="QPushButton" name="mPositionButton">
1922
<property name="text">
20-
<string>Show frame</string>
23+
<string>Position and size...</string>
2124
</property>
2225
</widget>
2326
</item>
24-
<item row="2" column="0" colspan="2">
25-
<widget class="QGroupBox" name="mFrameBox">
27+
<item row="1" column="0" colspan="2">
28+
<widget class="QgsCollapsibleGroupBox" name="mFrameGroupBox">
2629
<property name="title">
27-
<string>Frame settings</string>
30+
<string>Show frame</string>
31+
</property>
32+
<property name="checkable">
33+
<bool>true</bool>
2834
</property>
2935
<layout class="QGridLayout" name="gridLayout_2">
3036
<item row="0" column="0" colspan="2">
@@ -53,17 +59,19 @@
5359
</layout>
5460
</widget>
5561
</item>
56-
<item row="3" column="0">
57-
<widget class="QCheckBox" name="mBackgroundCheckBox">
58-
<property name="text">
62+
<item row="2" column="0" colspan="2">
63+
<widget class="QgsCollapsibleGroupBox" name="mBackgroundGroupBox">
64+
<property name="title">
5965
<string>Show background</string>
6066
</property>
61-
</widget>
62-
</item>
63-
<item row="4" column="0" colspan="2">
64-
<widget class="QGroupBox" name="mBackgroundBox">
65-
<property name="title">
66-
<string>Background settings</string>
67+
<property name="flat">
68+
<bool>false</bool>
69+
</property>
70+
<property name="checkable">
71+
<bool>true</bool>
72+
</property>
73+
<property name="checked">
74+
<bool>true</bool>
6775
</property>
6876
<layout class="QGridLayout" name="gridLayout">
6977
<item row="0" column="0" colspan="3">
@@ -106,20 +114,20 @@
106114
</layout>
107115
</widget>
108116
</item>
109-
<item row="5" column="0" colspan="2">
117+
<item row="3" column="0" colspan="2">
110118
<layout class="QHBoxLayout" name="horizontalLayout"/>
111119
</item>
112-
<item row="7" column="0">
120+
<item row="5" column="0">
113121
<widget class="QLabel" name="mIdLabel">
114122
<property name="text">
115123
<string>Item ID</string>
116124
</property>
117125
</widget>
118126
</item>
119-
<item row="7" column="1">
127+
<item row="5" column="1">
120128
<widget class="QLineEdit" name="mItemIdLineEdit"/>
121129
</item>
122-
<item row="8" column="0" colspan="2">
130+
<item row="6" column="0" colspan="2">
123131
<spacer name="verticalSpacer">
124132
<property name="orientation">
125133
<enum>Qt::Vertical</enum>
@@ -132,15 +140,16 @@
132140
</property>
133141
</spacer>
134142
</item>
135-
<item row="0" column="0" colspan="2">
136-
<widget class="QPushButton" name="mPositionButton">
137-
<property name="text">
138-
<string>Position and size...</string>
139-
</property>
140-
</widget>
141-
</item>
142143
</layout>
143144
</widget>
145+
<customwidgets>
146+
<customwidget>
147+
<class>QgsCollapsibleGroupBox</class>
148+
<extends>QGroupBox</extends>
149+
<header>qgscollapsiblegroupbox.h</header>
150+
<container>1</container>
151+
</customwidget>
152+
</customwidgets>
144153
<resources/>
145154
<connections>
146155
<connection>

0 commit comments

Comments
 (0)
Please sign in to comment.