Skip to content

Commit 3ece7be

Browse files
author
rblazek
committedMar 18, 2006
optional line width and marker size
git-svn-id: http://svn.osgeo.org/qgis/trunk@5059 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d121222 commit 3ece7be

File tree

3 files changed

+309
-74
lines changed

3 files changed

+309
-74
lines changed
 

‎src/plugins/grass/qgsgrassedit.cpp

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,22 +373,33 @@ void QgsGrassEdit::init()
373373
mSymbName[SYMB_NODE_2] = "Node (2 lines)";
374374

375375
// Restore symbology
376+
QString spath = "/GRASS/edit/symb/";
376377
QSettings settings("QuantumGIS", "qgis");
378+
379+
mLineWidth = settings.readNumEntry (
380+
spath + "lineWidth", 1 );
381+
mSize = settings.readNumEntry (
382+
spath + "markerSize", 9 );
383+
mLineWidthSpinBox->setValue(mLineWidth);
384+
mMarkerSizeSpinBox->setValue(mSize);
385+
377386
for ( int i = 0; i < SYMB_COUNT; i++ ) {
378387
bool ok;
379-
QString sn;
380-
sn.sprintf( "/GRASS/edit/symb/display/%d", i );
381-
bool displ = settings.readBoolEntry (sn, true, &ok );
388+
bool displ = settings.readBoolEntry (
389+
spath + "display/" + QString::number(i),
390+
true, &ok );
382391
if ( ok ) {
383392
mSymbDisplay[i] = displ;
384393
}
385394

386-
sn.sprintf( "/GRASS/edit/symb/color/%d", i );
387-
QString colorName = settings.readEntry (sn, "", &ok );
395+
QString colorName = settings.readEntry (
396+
spath + "color/" + QString::number(i),
397+
"", &ok );
388398
if ( ok ) {
389399
QColor color( colorName );
390400
mSymb[i].setColor( color );
391401
}
402+
mSymb[i].setWidth( mLineWidth );
392403
}
393404

394405
// Set Symbology in dialog
@@ -458,7 +469,6 @@ void QgsGrassEdit::init()
458469
connect( mAttributeTable, SIGNAL(valueChanged(int,int)), this, SLOT(columnTypeChanged(int,int)) );
459470

460471
// Set variables
461-
mSize = 9;
462472
mSelectedLine = 0;
463473
mAttributes = 0;
464474

@@ -729,6 +739,33 @@ void QgsGrassEdit::changeSymbology(Q3ListViewItem * item, const QPoint & pnt, in
729739
}
730740
}
731741

742+
void QgsGrassEdit::lineWidthChanged()
743+
{
744+
#ifdef QGISDEBUG
745+
std::cerr << "QgsGrassEdit::lineWidthChanged()" << std::endl;
746+
#endif
747+
QSettings settings("QuantumGIS", "qgis");
748+
mLineWidth = mLineWidthSpinBox->value();
749+
750+
for ( int i = 0; i < SYMB_COUNT; i++ ) {
751+
mSymb[i].setWidth( mLineWidth );
752+
}
753+
754+
QString spath = "/GRASS/edit/symb/";
755+
settings.writeEntry ( spath + "lineWidth", mLineWidth );
756+
}
757+
758+
void QgsGrassEdit::markerSizeChanged()
759+
{
760+
#ifdef QGISDEBUG
761+
std::cerr << "QgsGrassEdit::markerSizeChanged()" << std::endl;
762+
#endif
763+
QSettings settings("QuantumGIS", "qgis");
764+
mSize = mMarkerSizeSpinBox->value();
765+
QString spath = "/GRASS/edit/symb/";
766+
settings.writeEntry ( spath + "markerSize", mSize );
767+
}
768+
732769
void QgsGrassEdit::restorePosition()
733770
{
734771
QSettings settings("QuantumGIS", "qgis");

‎src/plugins/grass/qgsgrassedit.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ public slots:
190190

191191
void changeSymbology( Q3ListViewItem * item, const QPoint & pnt, int col );
192192

193+
//! width/size changed
194+
void lineWidthChanged();
195+
void markerSizeChanged();
196+
void on_mLineWidthSpinBox_valueChanged() { lineWidthChanged(); }
197+
void on_mMarkerSizeSpinBox_valueChanged() { markerSizeChanged(); }
198+
193199
// The type of column was changed
194200
void columnTypeChanged ( int row, int col );
195201

@@ -323,6 +329,12 @@ public slots:
323329
//! Symbology name
324330
std::vector<QString> mSymbName;
325331

332+
//! Line width
333+
int mLineWidth;
334+
335+
//! Marker size
336+
int mMarkerSize;
337+
326338
/**
327339
* Read line symbology from map
328340
* @return symbology code

‎src/plugins/grass/qgsgrasseditbase.ui

Lines changed: 254 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -37,108 +37,217 @@
3737
<attribute name="title" >
3838
<string>Category</string>
3939
</attribute>
40-
<layout class="QGridLayout" >
40+
<layout class="QVBoxLayout" >
4141
<property name="margin" >
4242
<number>9</number>
4343
</property>
4444
<property name="spacing" >
4545
<number>6</number>
4646
</property>
47-
<item row="1" column="3" >
48-
<widget class="QComboBox" name="mFieldBox" >
49-
<property name="minimumSize" >
50-
<size>
51-
<width>80</width>
52-
<height>0</height>
53-
</size>
54-
</property>
55-
<property name="editable" >
56-
<bool>true</bool>
47+
<item>
48+
<layout class="QHBoxLayout" >
49+
<property name="margin" >
50+
<number>0</number>
5751
</property>
58-
<property name="duplicatesEnabled" >
59-
<bool>false</bool>
52+
<property name="spacing" >
53+
<number>6</number>
6054
</property>
61-
</widget>
55+
<item>
56+
<widget class="QLabel" name="textLabel3" >
57+
<property name="sizePolicy" >
58+
<sizepolicy>
59+
<hsizetype>1</hsizetype>
60+
<vsizetype>5</vsizetype>
61+
<horstretch>0</horstretch>
62+
<verstretch>0</verstretch>
63+
</sizepolicy>
64+
</property>
65+
<property name="text" >
66+
<string>Mode</string>
67+
</property>
68+
</widget>
69+
</item>
70+
<item>
71+
<widget class="QComboBox" name="mCatModeBox" >
72+
<property name="sizePolicy" >
73+
<sizepolicy>
74+
<hsizetype>7</hsizetype>
75+
<vsizetype>0</vsizetype>
76+
<horstretch>0</horstretch>
77+
<verstretch>0</verstretch>
78+
</sizepolicy>
79+
</property>
80+
<property name="currentIndex" >
81+
<number>-1</number>
82+
</property>
83+
</widget>
84+
</item>
85+
</layout>
6286
</item>
63-
<item row="1" column="1" >
64-
<widget class="QLineEdit" name="mCatEntry" >
65-
<property name="minimumSize" >
66-
<size>
67-
<width>80</width>
68-
<height>0</height>
69-
</size>
70-
</property>
71-
</widget>
72-
</item>
73-
<item row="0" column="1" colspan="3" >
74-
<widget class="QComboBox" name="mCatModeBox" >
75-
<property name="currentIndex" >
76-
<number>-1</number>
87+
<item>
88+
<layout class="QHBoxLayout" >
89+
<property name="margin" >
90+
<number>0</number>
7791
</property>
78-
</widget>
79-
</item>
80-
<item row="1" column="2" >
81-
<widget class="QLabel" name="textLabel2" >
82-
<property name="text" >
83-
<string>Field (layer)</string>
92+
<property name="spacing" >
93+
<number>6</number>
8494
</property>
85-
</widget>
95+
<item>
96+
<widget class="QLabel" name="catLabel" >
97+
<property name="sizePolicy" >
98+
<sizepolicy>
99+
<hsizetype>1</hsizetype>
100+
<vsizetype>5</vsizetype>
101+
<horstretch>0</horstretch>
102+
<verstretch>0</verstretch>
103+
</sizepolicy>
104+
</property>
105+
<property name="text" >
106+
<string>Category</string>
107+
</property>
108+
</widget>
109+
</item>
110+
<item>
111+
<widget class="QLineEdit" name="mCatEntry" >
112+
<property name="minimumSize" >
113+
<size>
114+
<width>80</width>
115+
<height>0</height>
116+
</size>
117+
</property>
118+
</widget>
119+
</item>
120+
<item>
121+
<widget class="QLabel" name="textLabel2" >
122+
<property name="sizePolicy" >
123+
<sizepolicy>
124+
<hsizetype>1</hsizetype>
125+
<vsizetype>5</vsizetype>
126+
<horstretch>0</horstretch>
127+
<verstretch>0</verstretch>
128+
</sizepolicy>
129+
</property>
130+
<property name="text" >
131+
<string>Field (layer)</string>
132+
</property>
133+
</widget>
134+
</item>
135+
<item>
136+
<widget class="QComboBox" name="mFieldBox" >
137+
<property name="minimumSize" >
138+
<size>
139+
<width>80</width>
140+
<height>0</height>
141+
</size>
142+
</property>
143+
<property name="editable" >
144+
<bool>true</bool>
145+
</property>
146+
<property name="duplicatesEnabled" >
147+
<bool>false</bool>
148+
</property>
149+
</widget>
150+
</item>
151+
</layout>
86152
</item>
87-
<item row="1" column="0" >
88-
<widget class="QLabel" name="catLabel" >
89-
<property name="text" >
90-
<string>Category</string>
153+
<item>
154+
<spacer>
155+
<property name="orientation" >
156+
<enum>Qt::Vertical</enum>
91157
</property>
92-
</widget>
93-
</item>
94-
<item row="0" column="0" >
95-
<widget class="QLabel" name="textLabel3" >
96-
<property name="text" >
97-
<string>Mode</string>
158+
<property name="sizeHint" >
159+
<size>
160+
<width>20</width>
161+
<height>171</height>
162+
</size>
98163
</property>
99-
</widget>
164+
</spacer>
100165
</item>
101166
</layout>
102167
</widget>
103168
<widget class="QWidget" name="tab_2" >
104169
<attribute name="title" >
105170
<string>Settings</string>
106171
</attribute>
107-
<layout class="QGridLayout" >
172+
<layout class="QVBoxLayout" >
108173
<property name="margin" >
109-
<number>0</number>
174+
<number>9</number>
110175
</property>
111176
<property name="spacing" >
112177
<number>6</number>
113178
</property>
114-
<item row="0" column="0" >
115-
<widget class="QLabel" name="textLabel4" >
116-
<property name="text" >
117-
<string>Snapping in screen pixels</string>
179+
<item>
180+
<layout class="QHBoxLayout" >
181+
<property name="margin" >
182+
<number>0</number>
118183
</property>
119-
</widget>
184+
<property name="spacing" >
185+
<number>6</number>
186+
</property>
187+
<item>
188+
<widget class="QLabel" name="textLabel4" >
189+
<property name="text" >
190+
<string>Snapping in screen pixels</string>
191+
</property>
192+
</widget>
193+
</item>
194+
<item>
195+
<widget class="QSpinBox" name="mSnapPixels" >
196+
<property name="value" >
197+
<number>10</number>
198+
</property>
199+
</widget>
200+
</item>
201+
<item>
202+
<spacer>
203+
<property name="orientation" >
204+
<enum>Qt::Horizontal</enum>
205+
</property>
206+
<property name="sizeHint" >
207+
<size>
208+
<width>191</width>
209+
<height>20</height>
210+
</size>
211+
</property>
212+
</spacer>
213+
</item>
214+
</layout>
120215
</item>
121-
<item row="0" column="1" >
122-
<widget class="QSpinBox" name="mSnapPixels" >
123-
<property name="value" >
124-
<number>10</number>
216+
<item>
217+
<spacer>
218+
<property name="orientation" >
219+
<enum>Qt::Vertical</enum>
125220
</property>
126-
</widget>
221+
<property name="sizeHint" >
222+
<size>
223+
<width>20</width>
224+
<height>211</height>
225+
</size>
226+
</property>
227+
</spacer>
127228
</item>
128229
</layout>
129230
</widget>
130231
<widget class="QWidget" name="tab_3" >
232+
<property name="sizePolicy" >
233+
<sizepolicy>
234+
<hsizetype>7</hsizetype>
235+
<vsizetype>7</vsizetype>
236+
<horstretch>0</horstretch>
237+
<verstretch>0</verstretch>
238+
</sizepolicy>
239+
</property>
131240
<attribute name="title" >
132241
<string>Symbology</string>
133242
</attribute>
134-
<layout class="QHBoxLayout" >
243+
<layout class="QGridLayout" >
135244
<property name="margin" >
136-
<number>0</number>
245+
<number>9</number>
137246
</property>
138247
<property name="spacing" >
139248
<number>6</number>
140249
</property>
141-
<item>
250+
<item row="1" column="0" >
142251
<widget class="Q3ListView" name="symbologyList" >
143252
<property name="sizePolicy" >
144253
<sizepolicy>
@@ -167,6 +276,83 @@
167276
</column>
168277
</widget>
169278
</item>
279+
<item row="0" column="0" >
280+
<layout class="QHBoxLayout" >
281+
<property name="margin" >
282+
<number>0</number>
283+
</property>
284+
<property name="spacing" >
285+
<number>6</number>
286+
</property>
287+
<item>
288+
<widget class="QLabel" name="label" >
289+
<property name="sizePolicy" >
290+
<sizepolicy>
291+
<hsizetype>1</hsizetype>
292+
<vsizetype>5</vsizetype>
293+
<horstretch>0</horstretch>
294+
<verstretch>0</verstretch>
295+
</sizepolicy>
296+
</property>
297+
<property name="text" >
298+
<string>Line width</string>
299+
</property>
300+
</widget>
301+
</item>
302+
<item>
303+
<widget class="QSpinBox" name="mLineWidthSpinBox" >
304+
<property name="sizePolicy" >
305+
<sizepolicy>
306+
<hsizetype>5</hsizetype>
307+
<vsizetype>0</vsizetype>
308+
<horstretch>0</horstretch>
309+
<verstretch>0</verstretch>
310+
</sizepolicy>
311+
</property>
312+
</widget>
313+
</item>
314+
<item>
315+
<widget class="QLabel" name="label_2" >
316+
<property name="sizePolicy" >
317+
<sizepolicy>
318+
<hsizetype>1</hsizetype>
319+
<vsizetype>5</vsizetype>
320+
<horstretch>0</horstretch>
321+
<verstretch>0</verstretch>
322+
</sizepolicy>
323+
</property>
324+
<property name="text" >
325+
<string>Marker size</string>
326+
</property>
327+
</widget>
328+
</item>
329+
<item>
330+
<widget class="QSpinBox" name="mMarkerSizeSpinBox" >
331+
<property name="sizePolicy" >
332+
<sizepolicy>
333+
<hsizetype>5</hsizetype>
334+
<vsizetype>0</vsizetype>
335+
<horstretch>0</horstretch>
336+
<verstretch>0</verstretch>
337+
</sizepolicy>
338+
</property>
339+
</widget>
340+
</item>
341+
<item>
342+
<spacer>
343+
<property name="orientation" >
344+
<enum>Qt::Horizontal</enum>
345+
</property>
346+
<property name="sizeHint" >
347+
<size>
348+
<width>171</width>
349+
<height>20</height>
350+
</size>
351+
</property>
352+
</spacer>
353+
</item>
354+
</layout>
355+
</item>
170356
</layout>
171357
</widget>
172358
<widget class="QWidget" name="tab_4" >
@@ -348,6 +534,13 @@
348534
</widget>
349535
<pixmapfunction></pixmapfunction>
350536
<customwidgets>
537+
<customwidget>
538+
<class>Q3Table</class>
539+
<extends></extends>
540+
<header>q3table.h</header>
541+
<container>0</container>
542+
<pixmap></pixmap>
543+
</customwidget>
351544
<customwidget>
352545
<class>Q3ListView</class>
353546
<extends></extends>
@@ -362,13 +555,6 @@
362555
<container>1</container>
363556
<pixmap></pixmap>
364557
</customwidget>
365-
<customwidget>
366-
<class>Q3Table</class>
367-
<extends></extends>
368-
<header>q3table.h</header>
369-
<container>0</container>
370-
<pixmap></pixmap>
371-
</customwidget>
372558
</customwidgets>
373559
<resources/>
374560
<connections/>

0 commit comments

Comments
 (0)
Please sign in to comment.