optional line width and marker size

git-svn-id: http://svn.osgeo.org/qgis/trunk@5059 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
rblazek 2006-03-18 06:21:17 +00:00
parent d121222212
commit 3ece7be85a
3 changed files with 328 additions and 93 deletions

View File

@ -373,22 +373,33 @@ void QgsGrassEdit::init()
mSymbName[SYMB_NODE_2] = "Node (2 lines)";
// Restore symbology
QString spath = "/GRASS/edit/symb/";
QSettings settings("QuantumGIS", "qgis");
mLineWidth = settings.readNumEntry (
spath + "lineWidth", 1 );
mSize = settings.readNumEntry (
spath + "markerSize", 9 );
mLineWidthSpinBox->setValue(mLineWidth);
mMarkerSizeSpinBox->setValue(mSize);
for ( int i = 0; i < SYMB_COUNT; i++ ) {
bool ok;
QString sn;
sn.sprintf( "/GRASS/edit/symb/display/%d", i );
bool displ = settings.readBoolEntry (sn, true, &ok );
bool displ = settings.readBoolEntry (
spath + "display/" + QString::number(i),
true, &ok );
if ( ok ) {
mSymbDisplay[i] = displ;
}
sn.sprintf( "/GRASS/edit/symb/color/%d", i );
QString colorName = settings.readEntry (sn, "", &ok );
QString colorName = settings.readEntry (
spath + "color/" + QString::number(i),
"", &ok );
if ( ok ) {
QColor color( colorName );
mSymb[i].setColor( color );
}
mSymb[i].setWidth( mLineWidth );
}
// Set Symbology in dialog
@ -458,7 +469,6 @@ void QgsGrassEdit::init()
connect( mAttributeTable, SIGNAL(valueChanged(int,int)), this, SLOT(columnTypeChanged(int,int)) );
// Set variables
mSize = 9;
mSelectedLine = 0;
mAttributes = 0;
@ -729,6 +739,33 @@ void QgsGrassEdit::changeSymbology(Q3ListViewItem * item, const QPoint & pnt, in
}
}
void QgsGrassEdit::lineWidthChanged()
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassEdit::lineWidthChanged()" << std::endl;
#endif
QSettings settings("QuantumGIS", "qgis");
mLineWidth = mLineWidthSpinBox->value();
for ( int i = 0; i < SYMB_COUNT; i++ ) {
mSymb[i].setWidth( mLineWidth );
}
QString spath = "/GRASS/edit/symb/";
settings.writeEntry ( spath + "lineWidth", mLineWidth );
}
void QgsGrassEdit::markerSizeChanged()
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassEdit::markerSizeChanged()" << std::endl;
#endif
QSettings settings("QuantumGIS", "qgis");
mSize = mMarkerSizeSpinBox->value();
QString spath = "/GRASS/edit/symb/";
settings.writeEntry ( spath + "markerSize", mSize );
}
void QgsGrassEdit::restorePosition()
{
QSettings settings("QuantumGIS", "qgis");

View File

@ -190,6 +190,12 @@ public slots:
void changeSymbology( Q3ListViewItem * item, const QPoint & pnt, int col );
//! width/size changed
void lineWidthChanged();
void markerSizeChanged();
void on_mLineWidthSpinBox_valueChanged() { lineWidthChanged(); }
void on_mMarkerSizeSpinBox_valueChanged() { markerSizeChanged(); }
// The type of column was changed
void columnTypeChanged ( int row, int col );
@ -323,6 +329,12 @@ private:
//! Symbology name
std::vector<QString> mSymbName;
//! Line width
int mLineWidth;
//! Marker size
int mMarkerSize;
/**
* Read line symbology from map
* @return symbology code

View File

@ -37,66 +37,131 @@
<attribute name="title" >
<string>Category</string>
</attribute>
<layout class="QGridLayout" >
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="3" >
<widget class="QComboBox" name="mFieldBox" >
<property name="minimumSize" >
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel3" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mCatModeBox" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex" >
<number>-1</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="catLabel" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Category</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mCatEntry" >
<property name="minimumSize" >
<size>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="textLabel2" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Field (layer)</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mFieldBox" >
<property name="minimumSize" >
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="editable" >
<bool>true</bool>
</property>
<property name="duplicatesEnabled" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>80</width>
<height>0</height>
<width>20</width>
<height>171</height>
</size>
</property>
<property name="editable" >
<bool>true</bool>
</property>
<property name="duplicatesEnabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="mCatEntry" >
<property name="minimumSize" >
<size>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3" >
<widget class="QComboBox" name="mCatModeBox" >
<property name="currentIndex" >
<number>-1</number>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<string>Field (layer)</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="catLabel" >
<property name="text" >
<string>Category</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="textLabel3" >
<property name="text" >
<string>Mode</string>
</property>
</widget>
</spacer>
</item>
</layout>
</widget>
@ -104,41 +169,85 @@
<attribute name="title" >
<string>Settings</string>
</attribute>
<layout class="QGridLayout" >
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="textLabel4" >
<property name="text" >
<string>Snapping in screen pixels</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QSpinBox" name="mSnapPixels" >
<property name="value" >
<number>10</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3" >
<attribute name="title" >
<string>Symbology</string>
</attribute>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel4" >
<property name="text" >
<string>Snapping in screen pixels</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="mSnapPixels" >
<property name="value" >
<number>10</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>191</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>211</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="title" >
<string>Symbology</string>
</attribute>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" >
<widget class="Q3ListView" name="symbologyList" >
<property name="sizePolicy" >
<sizepolicy>
@ -167,6 +276,83 @@
</column>
</widget>
</item>
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Line width</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="mLineWidthSpinBox" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Marker size</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="mMarkerSizeSpinBox" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>171</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4" >
@ -348,6 +534,13 @@
</widget>
<pixmapfunction></pixmapfunction>
<customwidgets>
<customwidget>
<class>Q3Table</class>
<extends></extends>
<header>q3table.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
<class>Q3ListView</class>
<extends></extends>
@ -362,13 +555,6 @@
<container>1</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
<class>Q3Table</class>
<extends></extends>
<header>q3table.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
</customwidgets>
<resources/>
<connections/>