Skip to content

Commit c6eced8

Browse files
author
timlinux
committed
Hello from Wroclaw QGIS Hackfest November 2010! Tidy up for vector symbology dialog
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14556 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 31d828f commit c6eced8

File tree

2 files changed

+117
-59
lines changed

2 files changed

+117
-59
lines changed

src/gui/symbology-ng/qgssymbolv2selectordialog.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ QgsSymbolV2SelectorDialog::QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsSt
3535
}
3636

3737
connect( btnSymbolProperties, SIGNAL( clicked() ), this, SLOT( changeSymbolProperties() ) );
38+
connect( lblPreview, SIGNAL( clicked() ), this, SLOT( changeSymbolProperties() ) );
3839
connect( btnStyleManager, SIGNAL( clicked() ), SLOT( openStyleManager() ) );
3940

4041
QStandardItemModel* model = new QStandardItemModel( viewSymbols );
4142
viewSymbols->setModel( model );
4243
connect( viewSymbols, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( setSymbolFromStyle( const QModelIndex & ) ) );
43-
44+
lblSymbolName->setText("");
4445
populateSymbolView();
4546
updateSymbolPreview();
4647
updateSymbolInfo();
@@ -81,7 +82,9 @@ void QgsSymbolV2SelectorDialog::populateSymbolView()
8182

8283
QStandardItemModel* model = qobject_cast<QStandardItemModel*>( viewSymbols->model() );
8384
if ( !model )
85+
{
8486
return;
87+
}
8588
model->clear();
8689

8790
QStringList names = mStyle->symbolNames();
@@ -94,6 +97,8 @@ void QgsSymbolV2SelectorDialog::populateSymbolView()
9497
continue;
9598
}
9699
QStandardItem* item = new QStandardItem( names[i] );
100+
item->setData( names[i], Qt::UserRole ); //so we can show a label when it is clicked
101+
item->setText(""); //set the text to nothing and show in label when clicked rather
97102
item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
98103
// create preview icon
99104
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( s, previewSize );
@@ -106,7 +111,8 @@ void QgsSymbolV2SelectorDialog::populateSymbolView()
106111

107112
void QgsSymbolV2SelectorDialog::setSymbolFromStyle( const QModelIndex & index )
108113
{
109-
QString symbolName = index.data().toString();
114+
QString symbolName = index.data( Qt::UserRole ).toString();
115+
lblSymbolName->setText( symbolName );
110116
// get new instance of symbol from style
111117
QgsSymbolV2* s = mStyle->symbol( symbolName );
112118
// remove all symbol layers from original symbol
@@ -264,7 +270,7 @@ void QgsSymbolV2SelectorDialog::on_mTransparencySlider_valueChanged( int value )
264270
void QgsSymbolV2SelectorDialog::displayTransparency( double alpha )
265271
{
266272
double transparencyPercent = ( 1 - alpha ) * 100;
267-
mTransparencyLabel->setText( tr( "Transparency: %1%" ).arg(( int ) transparencyPercent ) );
273+
mTransparencyLabel->setText( tr( "Transparency %1%" ).arg(( int ) transparencyPercent ) );
268274
}
269275

270276
QMenu* QgsSymbolV2SelectorDialog::advancedMenu()

src/ui/qgssymbolv2selectordialogbase.ui

Lines changed: 108 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,49 @@
1313
<property name="windowTitle">
1414
<string>Symbol selector</string>
1515
</property>
16-
<layout class="QGridLayout" name="gridLayout_5">
16+
<layout class="QGridLayout" name="gridLayout_6">
1717
<item row="0" column="0">
18-
<widget class="QLabel" name="lblPreview">
19-
<property name="sizePolicy">
20-
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
21-
<horstretch>0</horstretch>
22-
<verstretch>0</verstretch>
23-
</sizepolicy>
24-
</property>
25-
<property name="minimumSize">
26-
<size>
27-
<width>100</width>
28-
<height>100</height>
29-
</size>
30-
</property>
31-
<property name="frameShape">
32-
<enum>QFrame::StyledPanel</enum>
33-
</property>
34-
<property name="frameShadow">
35-
<enum>QFrame::Sunken</enum>
36-
</property>
37-
<property name="text">
38-
<string/>
39-
</property>
40-
<property name="alignment">
41-
<set>Qt::AlignCenter</set>
42-
</property>
43-
</widget>
44-
</item>
45-
<item row="0" column="1">
4618
<layout class="QVBoxLayout" name="verticalLayout">
4719
<item>
20+
<widget class="QLabel" name="lblPreview">
21+
<property name="sizePolicy">
22+
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
23+
<horstretch>0</horstretch>
24+
<verstretch>0</verstretch>
25+
</sizepolicy>
26+
</property>
27+
<property name="minimumSize">
28+
<size>
29+
<width>100</width>
30+
<height>100</height>
31+
</size>
32+
</property>
33+
<property name="frameShape">
34+
<enum>QFrame::StyledPanel</enum>
35+
</property>
36+
<property name="frameShadow">
37+
<enum>QFrame::Sunken</enum>
38+
</property>
39+
<property name="text">
40+
<string/>
41+
</property>
42+
<property name="alignment">
43+
<set>Qt::AlignCenter</set>
44+
</property>
45+
</widget>
46+
</item>
47+
<item>
48+
<widget class="QPushButton" name="btnSymbolProperties">
49+
<property name="text">
50+
<string>Change...</string>
51+
</property>
52+
</widget>
53+
</item>
54+
</layout>
55+
</item>
56+
<item row="0" column="1">
57+
<layout class="QGridLayout" name="gridLayout_5">
58+
<item row="0" column="0" colspan="2">
4859
<layout class="QGridLayout" name="gridLayout_3">
4960
<item row="0" column="0">
5061
<widget class="QLabel" name="mSymbolUnitLabel">
@@ -115,16 +126,19 @@
115126
</item>
116127
</layout>
117128
</item>
118-
<item>
129+
<item row="0" column="2" colspan="2">
119130
<widget class="QStackedWidget" name="stackedWidget">
131+
<property name="sizePolicy">
132+
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
133+
<horstretch>0</horstretch>
134+
<verstretch>0</verstretch>
135+
</sizepolicy>
136+
</property>
120137
<property name="currentIndex">
121138
<number>2</number>
122139
</property>
123140
<widget class="QWidget" name="pageMarker">
124141
<layout class="QGridLayout" name="gridLayout">
125-
<property name="margin">
126-
<number>0</number>
127-
</property>
128142
<item row="0" column="0">
129143
<widget class="QLabel" name="label_2">
130144
<property name="text">
@@ -168,21 +182,31 @@
168182
</property>
169183
</widget>
170184
</item>
185+
<item row="2" column="0" colspan="2">
186+
<spacer name="horizontalSpacer_3">
187+
<property name="orientation">
188+
<enum>Qt::Horizontal</enum>
189+
</property>
190+
<property name="sizeHint" stdset="0">
191+
<size>
192+
<width>178</width>
193+
<height>20</height>
194+
</size>
195+
</property>
196+
</spacer>
197+
</item>
171198
</layout>
172199
</widget>
173200
<widget class="QWidget" name="pageLine">
174201
<layout class="QGridLayout" name="gridLayout_2">
175-
<property name="margin">
176-
<number>0</number>
177-
</property>
178202
<item row="0" column="0">
179203
<widget class="QLabel" name="label_4">
180204
<property name="text">
181205
<string>Width</string>
182206
</property>
183207
</widget>
184208
</item>
185-
<item row="0" column="1">
209+
<item row="0" column="2">
186210
<widget class="QDoubleSpinBox" name="spinWidth">
187211
<property name="decimals">
188212
<number>2</number>
@@ -195,6 +219,32 @@
195219
</property>
196220
</widget>
197221
</item>
222+
<item row="1" column="1">
223+
<spacer name="horizontalSpacer_4">
224+
<property name="orientation">
225+
<enum>Qt::Horizontal</enum>
226+
</property>
227+
<property name="sizeHint" stdset="0">
228+
<size>
229+
<width>37</width>
230+
<height>20</height>
231+
</size>
232+
</property>
233+
</spacer>
234+
</item>
235+
<item row="2" column="1">
236+
<spacer name="horizontalSpacer_5">
237+
<property name="orientation">
238+
<enum>Qt::Horizontal</enum>
239+
</property>
240+
<property name="sizeHint" stdset="0">
241+
<size>
242+
<width>37</width>
243+
<height>20</height>
244+
</size>
245+
</property>
246+
</spacer>
247+
</item>
198248
</layout>
199249
</widget>
200250
<widget class="QWidget" name="pageFill">
@@ -206,18 +256,7 @@
206256
</widget>
207257
</widget>
208258
</item>
209-
</layout>
210-
</item>
211-
<item row="1" column="0" colspan="2">
212-
<layout class="QHBoxLayout" name="horizontalLayout">
213-
<item>
214-
<widget class="QPushButton" name="btnSymbolProperties">
215-
<property name="text">
216-
<string>Properties</string>
217-
</property>
218-
</widget>
219-
</item>
220-
<item>
259+
<item row="1" column="0">
221260
<spacer name="horizontalSpacer">
222261
<property name="orientation">
223262
<enum>Qt::Horizontal</enum>
@@ -230,35 +269,35 @@
230269
</property>
231270
</spacer>
232271
</item>
233-
<item>
272+
<item row="1" column="1" colspan="2">
234273
<widget class="QPushButton" name="btnAdvanced">
235274
<property name="text">
236275
<string>Advanced</string>
237276
</property>
238277
</widget>
239278
</item>
240-
<item>
279+
<item row="1" column="3">
241280
<widget class="QPushButton" name="btnAddToStyle">
242281
<property name="text">
243-
<string>Add to style</string>
282+
<string>Save as style</string>
244283
</property>
245284
</widget>
246285
</item>
247286
</layout>
248287
</item>
249-
<item row="2" column="0" colspan="2">
288+
<item row="1" column="0" colspan="2">
250289
<widget class="Line" name="line">
251290
<property name="orientation">
252291
<enum>Qt::Horizontal</enum>
253292
</property>
254293
</widget>
255294
</item>
256-
<item row="3" column="0" colspan="2">
295+
<item row="2" column="0" colspan="2">
257296
<layout class="QGridLayout" name="gridLayout_4">
258297
<item row="0" column="0">
259298
<widget class="QLabel" name="label">
260299
<property name="text">
261-
<string>Symbols from style</string>
300+
<string>Saved styles</string>
262301
</property>
263302
</widget>
264303
</item>
@@ -308,11 +347,24 @@
308347
<property name="viewMode">
309348
<enum>QListView::IconMode</enum>
310349
</property>
350+
<property name="uniformItemSizes">
351+
<bool>true</bool>
352+
</property>
353+
<property name="wordWrap">
354+
<bool>true</bool>
355+
</property>
311356
</widget>
312357
</item>
313358
</layout>
314359
</item>
315-
<item row="4" column="0" colspan="2">
360+
<item row="3" column="0">
361+
<widget class="QLabel" name="lblSymbolName">
362+
<property name="text">
363+
<string>Symbol Name</string>
364+
</property>
365+
</widget>
366+
</item>
367+
<item row="3" column="1">
316368
<widget class="QDialogButtonBox" name="buttonBox">
317369
<property name="orientation">
318370
<enum>Qt::Horizontal</enum>

0 commit comments

Comments
 (0)