Skip to content

Commit 80ecdeb

Browse files
author
Arunmozhi
committedJul 9, 2012
UI Tweaks to make the symbol selector better
1 parent b6d0419 commit 80ecdeb

File tree

5 files changed

+163
-161
lines changed

5 files changed

+163
-161
lines changed
 

‎src/gui/symbology-ng/qgssymbolv2selectordialog.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class SymbolLayerItem : public QStandardItem
109109

110110
QVariant data( int role ) const
111111
{
112-
if ( role == Qt::DisplayRole )
112+
if ( role == Qt::DisplayRole || role == Qt::EditRole )
113113
{
114114
if ( mIsLayer )
115115
return QgsSymbolLayerV2Registry::instance()->symbolLayerMetadata( mLayer->layerType() )->visibleName();
@@ -214,6 +214,9 @@ QMenu* QgsSymbolV2SelectorDialog::advancedMenu()
214214
void QgsSymbolV2SelectorDialog::loadSymbol( QgsSymbolV2* symbol, SymbolLayerItem* parent )
215215
{
216216
SymbolLayerItem* symbolItem = new SymbolLayerItem( symbol );
217+
QFont boldFont = symbolItem->font();
218+
boldFont.setBold( true );
219+
symbolItem->setFont( boldFont );
217220
parent->appendRow( symbolItem );
218221

219222
int count = symbol->symbolLayerCount();
@@ -490,10 +493,13 @@ void QgsSymbolV2SelectorDialog::changeLayer( QgsSymbolLayerV2* newLayer )
490493
// When it is a marker symbol
491494
if ( newLayer->subSymbol() )
492495
{
496+
/*
493497
SymbolLayerItem *subsymbol = new SymbolLayerItem( newLayer->subSymbol() );
494498
SymbolLayerItem *sublayer = new SymbolLayerItem( newLayer->subSymbol()->symbolLayer( 0 ) );
495499
subsymbol->appendRow( sublayer );
496500
item->appendRow( subsymbol );
501+
*/
502+
loadSymbol( newLayer->subSymbol(), item );
497503
}
498504

499505
// Change the symbol at last to avoid deleting item's layer

‎src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void QgsVectorFieldSymbolLayerWidget::setSymbolLayer( QgsSymbolLayerV2* layer )
8888
{
8989
mRadiansRadioButton->setChecked( true );
9090
}
91-
updateMarkerIcon();
91+
emit changed();
9292
}
9393

9494
QgsSymbolLayerV2* QgsVectorFieldSymbolLayerWidget::symbolLayer()
@@ -123,32 +123,6 @@ void QgsVectorFieldSymbolLayerWidget::on_mYAttributeComboBox_currentIndexChanged
123123
}
124124
}
125125

126-
void QgsVectorFieldSymbolLayerWidget::on_mLineStylePushButton_clicked()
127-
{
128-
if ( !mLayer )
129-
{
130-
return;
131-
}
132-
133-
QgsSymbolV2PropertiesDialog dlg( mLayer->subSymbol(), mVectorLayer, this );
134-
if ( dlg.exec() == QDialog::Rejected )
135-
{
136-
return;
137-
}
138-
139-
updateMarkerIcon();
140-
emit changed();
141-
}
142-
143-
void QgsVectorFieldSymbolLayerWidget::updateMarkerIcon()
144-
{
145-
if ( mLayer )
146-
{
147-
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( mLayer->subSymbol(), mLineStylePushButton->iconSize() );
148-
mLineStylePushButton->setIcon( icon );
149-
}
150-
}
151-
152126
void QgsVectorFieldSymbolLayerWidget::on_mCartesianRadioButton_toggled( bool checked )
153127
{
154128
if ( mLayer && checked )

‎src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ class GUI_EXPORT QgsVectorFieldSymbolLayerWidget: public QgsSymbolLayerV2Widget,
3535

3636
protected:
3737
QgsVectorFieldSymbolLayer* mLayer;
38-
void updateMarkerIcon();
3938

4039
private slots:
4140
void on_mScaleSpinBox_valueChanged( double d );
4241
void on_mXAttributeComboBox_currentIndexChanged( int index );
4342
void on_mYAttributeComboBox_currentIndexChanged( int index );
44-
void on_mLineStylePushButton_clicked();
4543
void on_mCartesianRadioButton_toggled( bool checked );
4644
void on_mPolarRadioButton_toggled( bool checked );
4745
void on_mHeightRadioButton_toggled( bool checked );

‎src/ui/symbollayer/widget_symbolslist.ui

Lines changed: 67 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>408</width>
10-
<height>431</height>
9+
<width>344</width>
10+
<height>441</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
1414
<string>Form</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout_4">
17-
<item row="0" column="0" colspan="3">
18-
<layout class="QGridLayout" name="gridLayout_5">
19-
<item row="0" column="0" colspan="2">
17+
<property name="verticalSpacing">
18+
<number>4</number>
19+
</property>
20+
<property name="margin">
21+
<number>0</number>
22+
</property>
23+
<item row="0" column="0">
24+
<layout class="QHBoxLayout" name="horizontalLayout">
25+
<item>
2026
<layout class="QGridLayout" name="gridLayout_3">
2127
<item row="0" column="0">
2228
<widget class="QLabel" name="mSymbolUnitLabel">
@@ -87,7 +93,7 @@
8793
</item>
8894
</layout>
8995
</item>
90-
<item row="0" column="2" colspan="2">
96+
<item>
9197
<widget class="QStackedWidget" name="stackedWidget">
9298
<property name="sizePolicy">
9399
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@@ -217,63 +223,50 @@
217223
</widget>
218224
</widget>
219225
</item>
220-
<item row="1" column="0">
221-
<spacer name="horizontalSpacer">
226+
</layout>
227+
</item>
228+
<item row="1" column="0">
229+
<layout class="QHBoxLayout" name="horizontalLayout_3">
230+
<property name="spacing">
231+
<number>3</number>
232+
</property>
233+
<item>
234+
<widget class="QLabel" name="label">
235+
<property name="text">
236+
<string>Saved styles</string>
237+
</property>
238+
</widget>
239+
</item>
240+
<item>
241+
<spacer name="horizontalSpacer_2">
222242
<property name="orientation">
223243
<enum>Qt::Horizontal</enum>
224244
</property>
225245
<property name="sizeHint" stdset="0">
226246
<size>
227-
<width>40</width>
247+
<width>194</width>
228248
<height>20</height>
229249
</size>
230250
</property>
231251
</spacer>
232252
</item>
233-
<item row="1" column="1" colspan="2">
234-
<widget class="QPushButton" name="btnAdvanced">
253+
<item>
254+
<widget class="QPushButton" name="btnAddToStyle">
235255
<property name="text">
236-
<string>Advanced</string>
256+
<string>Save as style</string>
237257
</property>
238258
</widget>
239259
</item>
240-
<item row="1" column="3">
241-
<widget class="QPushButton" name="btnAddToStyle">
260+
<item>
261+
<widget class="QPushButton" name="btnStyleManager">
242262
<property name="text">
243-
<string>Save as style</string>
263+
<string>Style manager...</string>
244264
</property>
245265
</widget>
246266
</item>
247267
</layout>
248268
</item>
249-
<item row="1" column="0">
250-
<widget class="QLabel" name="label">
251-
<property name="text">
252-
<string>Saved styles</string>
253-
</property>
254-
</widget>
255-
</item>
256-
<item row="1" column="1">
257-
<spacer name="horizontalSpacer_2">
258-
<property name="orientation">
259-
<enum>Qt::Horizontal</enum>
260-
</property>
261-
<property name="sizeHint" stdset="0">
262-
<size>
263-
<width>194</width>
264-
<height>20</height>
265-
</size>
266-
</property>
267-
</spacer>
268-
</item>
269-
<item row="1" column="2">
270-
<widget class="QPushButton" name="btnStyleManager">
271-
<property name="text">
272-
<string>Style manager...</string>
273-
</property>
274-
</widget>
275-
</item>
276-
<item row="2" column="0" colspan="3">
269+
<item row="2" column="0">
277270
<widget class="QListView" name="viewSymbols">
278271
<property name="sizePolicy">
279272
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -308,11 +301,38 @@
308301
</widget>
309302
</item>
310303
<item row="3" column="0">
311-
<widget class="QLabel" name="lblSymbolName">
312-
<property name="text">
313-
<string>Symbol Name</string>
304+
<layout class="QHBoxLayout" name="horizontalLayout_4">
305+
<property name="topMargin">
306+
<number>2</number>
314307
</property>
315-
</widget>
308+
<item>
309+
<widget class="QLabel" name="lblSymbolName">
310+
<property name="text">
311+
<string>Symbol Name</string>
312+
</property>
313+
</widget>
314+
</item>
315+
<item>
316+
<spacer name="horizontalSpacer">
317+
<property name="orientation">
318+
<enum>Qt::Horizontal</enum>
319+
</property>
320+
<property name="sizeHint" stdset="0">
321+
<size>
322+
<width>40</width>
323+
<height>20</height>
324+
</size>
325+
</property>
326+
</spacer>
327+
</item>
328+
<item>
329+
<widget class="QPushButton" name="btnAdvanced">
330+
<property name="text">
331+
<string>Advanced</string>
332+
</property>
333+
</widget>
334+
</item>
335+
</layout>
316336
</item>
317337
</layout>
318338
</widget>

‎src/ui/symbollayer/widget_vectorfield.ui

Lines changed: 88 additions & 84 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>400</width>
10-
<height>291</height>
9+
<width>315</width>
10+
<height>320</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -21,7 +21,7 @@
2121
</property>
2222
</widget>
2323
</item>
24-
<item row="0" column="1" colspan="2">
24+
<item row="0" column="1">
2525
<widget class="QComboBox" name="mXAttributeComboBox"/>
2626
</item>
2727
<item row="1" column="0">
@@ -31,7 +31,7 @@
3131
</property>
3232
</widget>
3333
</item>
34-
<item row="1" column="1" colspan="2">
34+
<item row="1" column="1">
3535
<widget class="QComboBox" name="mYAttributeComboBox"/>
3636
</item>
3737
<item row="2" column="0">
@@ -41,98 +41,102 @@
4141
</property>
4242
</widget>
4343
</item>
44-
<item row="2" column="1" colspan="2">
44+
<item row="2" column="1">
4545
<widget class="QDoubleSpinBox" name="mScaleSpinBox"/>
4646
</item>
47-
<item row="4" column="0" rowspan="2" colspan="2">
48-
<widget class="QGroupBox" name="mFieldTypeGroupBox">
49-
<property name="title">
50-
<string>Vector field type</string>
51-
</property>
52-
<layout class="QGridLayout" name="gridLayout">
53-
<item row="0" column="0">
54-
<widget class="QRadioButton" name="mCartesianRadioButton">
55-
<property name="text">
56-
<string>Cartesian</string>
57-
</property>
58-
</widget>
59-
</item>
60-
<item row="1" column="0">
61-
<widget class="QRadioButton" name="mPolarRadioButton">
62-
<property name="text">
63-
<string>Polar</string>
64-
</property>
65-
</widget>
66-
</item>
67-
<item row="2" column="0">
68-
<widget class="QRadioButton" name="mHeightRadioButton">
69-
<property name="text">
70-
<string>Height only</string>
71-
</property>
72-
</widget>
73-
</item>
74-
</layout>
75-
</widget>
76-
</item>
77-
<item row="4" column="2" colspan="2">
78-
<widget class="QGroupBox" name="mAngleUnitsGroupBox">
79-
<property name="title">
80-
<string>Angle units</string>
81-
</property>
82-
<layout class="QGridLayout" name="gridLayout_3">
83-
<item row="0" column="0">
84-
<widget class="QRadioButton" name="mDegreesRadioButton">
85-
<property name="text">
86-
<string>Degrees</string>
87-
</property>
88-
</widget>
89-
</item>
90-
<item row="1" column="0">
91-
<widget class="QRadioButton" name="mRadiansRadioButton">
92-
<property name="text">
93-
<string>Radians</string>
94-
</property>
95-
</widget>
96-
</item>
97-
</layout>
98-
</widget>
99-
</item>
100-
<item row="5" column="2" colspan="2">
101-
<widget class="QGroupBox" name="mAngleOrientationGroupBox">
102-
<property name="title">
103-
<string>Angle orientation</string>
104-
</property>
105-
<layout class="QGridLayout" name="gridLayout_2">
106-
<item row="1" column="0">
47+
<item row="3" column="0" colspan="2">
48+
<layout class="QGridLayout" name="gridLayout_2">
49+
<item row="0" column="0">
50+
<layout class="QHBoxLayout" name="horizontalLayout">
51+
<item>
52+
<widget class="QGroupBox" name="mFieldTypeGroupBox">
53+
<property name="title">
54+
<string>Vector field type</string>
55+
</property>
56+
<layout class="QGridLayout" name="gridLayout">
57+
<item row="2" column="0">
58+
<widget class="QRadioButton" name="mHeightRadioButton">
59+
<property name="text">
60+
<string>Height only</string>
61+
</property>
62+
</widget>
63+
</item>
64+
<item row="1" column="0">
65+
<widget class="QRadioButton" name="mPolarRadioButton">
66+
<property name="text">
67+
<string>Polar</string>
68+
</property>
69+
</widget>
70+
</item>
71+
<item row="0" column="0">
72+
<widget class="QRadioButton" name="mCartesianRadioButton">
73+
<property name="text">
74+
<string>Cartesian</string>
75+
</property>
76+
</widget>
77+
</item>
78+
</layout>
79+
</widget>
80+
</item>
81+
<item>
82+
<widget class="QGroupBox" name="mAngleUnitsGroupBox">
83+
<property name="title">
84+
<string>Angle units</string>
85+
</property>
86+
<layout class="QGridLayout" name="gridLayout_3">
87+
<item row="0" column="0">
88+
<widget class="QRadioButton" name="mDegreesRadioButton">
89+
<property name="text">
90+
<string>Degrees</string>
91+
</property>
92+
</widget>
93+
</item>
94+
<item row="1" column="0">
95+
<widget class="QRadioButton" name="mRadiansRadioButton">
96+
<property name="text">
97+
<string>Radians</string>
98+
</property>
99+
</widget>
100+
</item>
101+
</layout>
102+
</widget>
103+
</item>
104+
</layout>
105+
</item>
106+
<item row="1" column="0">
107+
<widget class="QGroupBox" name="mAngleOrientationGroupBox">
108+
<property name="title">
109+
<string>Angle orientation</string>
110+
</property>
107111
<widget class="QRadioButton" name="mCounterclockwiseFromEastRadioButton">
112+
<property name="geometry">
113+
<rect>
114+
<x>17</x>
115+
<y>52</y>
116+
<width>183</width>
117+
<height>21</height>
118+
</rect>
119+
</property>
108120
<property name="text">
109121
<string>Counterclockwise from east</string>
110122
</property>
111123
</widget>
112-
</item>
113-
<item row="0" column="0">
114124
<widget class="QRadioButton" name="mClockwiseFromNorthRadioButton">
125+
<property name="geometry">
126+
<rect>
127+
<x>17</x>
128+
<y>25</y>
129+
<width>146</width>
130+
<height>21</height>
131+
</rect>
132+
</property>
115133
<property name="text">
116134
<string>Clockwise from north</string>
117135
</property>
118136
</widget>
119-
</item>
120-
</layout>
121-
</widget>
122-
</item>
123-
<item row="3" column="0">
124-
<widget class="QLabel" name="mLineStyleLabel">
125-
<property name="text">
126-
<string>LineStyle</string>
127-
</property>
128-
</widget>
129-
</item>
130-
<item row="3" column="1" colspan="2">
131-
<widget class="QPushButton" name="mLineStylePushButton">
132-
<property name="text">
133-
<string>change</string>
134-
</property>
135-
</widget>
137+
</widget>
138+
</item>
139+
</layout>
136140
</item>
137141
</layout>
138142
</widget>

0 commit comments

Comments
 (0)
Please sign in to comment.