UI Tweaks to make the symbol selector better

This commit is contained in:
Arunmozhi 2012-06-28 00:01:46 +05:30
parent b6d0419977
commit 80ecdebea7
5 changed files with 165 additions and 163 deletions

View File

@ -109,7 +109,7 @@ class SymbolLayerItem : public QStandardItem
QVariant data( int role ) const
{
if ( role == Qt::DisplayRole )
if ( role == Qt::DisplayRole || role == Qt::EditRole )
{
if ( mIsLayer )
return QgsSymbolLayerV2Registry::instance()->symbolLayerMetadata( mLayer->layerType() )->visibleName();
@ -214,6 +214,9 @@ QMenu* QgsSymbolV2SelectorDialog::advancedMenu()
void QgsSymbolV2SelectorDialog::loadSymbol( QgsSymbolV2* symbol, SymbolLayerItem* parent )
{
SymbolLayerItem* symbolItem = new SymbolLayerItem( symbol );
QFont boldFont = symbolItem->font();
boldFont.setBold( true );
symbolItem->setFont( boldFont );
parent->appendRow( symbolItem );
int count = symbol->symbolLayerCount();
@ -490,10 +493,13 @@ void QgsSymbolV2SelectorDialog::changeLayer( QgsSymbolLayerV2* newLayer )
// When it is a marker symbol
if ( newLayer->subSymbol() )
{
/*
SymbolLayerItem *subsymbol = new SymbolLayerItem( newLayer->subSymbol() );
SymbolLayerItem *sublayer = new SymbolLayerItem( newLayer->subSymbol()->symbolLayer( 0 ) );
subsymbol->appendRow( sublayer );
item->appendRow( subsymbol );
*/
loadSymbol( newLayer->subSymbol(), item );
}
// Change the symbol at last to avoid deleting item's layer

View File

@ -88,7 +88,7 @@ void QgsVectorFieldSymbolLayerWidget::setSymbolLayer( QgsSymbolLayerV2* layer )
{
mRadiansRadioButton->setChecked( true );
}
updateMarkerIcon();
emit changed();
}
QgsSymbolLayerV2* QgsVectorFieldSymbolLayerWidget::symbolLayer()
@ -123,32 +123,6 @@ void QgsVectorFieldSymbolLayerWidget::on_mYAttributeComboBox_currentIndexChanged
}
}
void QgsVectorFieldSymbolLayerWidget::on_mLineStylePushButton_clicked()
{
if ( !mLayer )
{
return;
}
QgsSymbolV2PropertiesDialog dlg( mLayer->subSymbol(), mVectorLayer, this );
if ( dlg.exec() == QDialog::Rejected )
{
return;
}
updateMarkerIcon();
emit changed();
}
void QgsVectorFieldSymbolLayerWidget::updateMarkerIcon()
{
if ( mLayer )
{
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( mLayer->subSymbol(), mLineStylePushButton->iconSize() );
mLineStylePushButton->setIcon( icon );
}
}
void QgsVectorFieldSymbolLayerWidget::on_mCartesianRadioButton_toggled( bool checked )
{
if ( mLayer && checked )

View File

@ -35,13 +35,11 @@ class GUI_EXPORT QgsVectorFieldSymbolLayerWidget: public QgsSymbolLayerV2Widget,
protected:
QgsVectorFieldSymbolLayer* mLayer;
void updateMarkerIcon();
private slots:
void on_mScaleSpinBox_valueChanged( double d );
void on_mXAttributeComboBox_currentIndexChanged( int index );
void on_mYAttributeComboBox_currentIndexChanged( int index );
void on_mLineStylePushButton_clicked();
void on_mCartesianRadioButton_toggled( bool checked );
void on_mPolarRadioButton_toggled( bool checked );
void on_mHeightRadioButton_toggled( bool checked );

View File

@ -6,17 +6,23 @@
<rect>
<x>0</x>
<y>0</y>
<width>408</width>
<height>431</height>
<width>344</width>
<height>441</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="3">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" colspan="2">
<property name="verticalSpacing">
<number>4</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="mSymbolUnitLabel">
@ -87,7 +93,7 @@
</item>
</layout>
</item>
<item row="0" column="2" colspan="2">
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@ -217,63 +223,50 @@
</widget>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Saved styles</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>194</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="2">
<widget class="QPushButton" name="btnAdvanced">
<property name="text">
<string>Advanced</string>
</property>
</widget>
</item>
<item row="1" column="3">
<item>
<widget class="QPushButton" name="btnAddToStyle">
<property name="text">
<string>Save as style</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnStyleManager">
<property name="text">
<string>Style manager...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Saved styles</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>194</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="btnStyleManager">
<property name="text">
<string>Style manager...</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<item row="2" column="0">
<widget class="QListView" name="viewSymbols">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -308,11 +301,38 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblSymbolName">
<property name="text">
<string>Symbol Name</string>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="topMargin">
<number>2</number>
</property>
</widget>
<item>
<widget class="QLabel" name="lblSymbolName">
<property name="text">
<string>Symbol Name</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnAdvanced">
<property name="text">
<string>Advanced</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>291</height>
<width>315</width>
<height>320</height>
</rect>
</property>
<property name="windowTitle">
@ -21,7 +21,7 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<item row="0" column="1">
<widget class="QComboBox" name="mXAttributeComboBox"/>
</item>
<item row="1" column="0">
@ -31,7 +31,7 @@
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<item row="1" column="1">
<widget class="QComboBox" name="mYAttributeComboBox"/>
</item>
<item row="2" column="0">
@ -41,98 +41,102 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="mScaleSpinBox"/>
</item>
<item row="4" column="0" rowspan="2" colspan="2">
<widget class="QGroupBox" name="mFieldTypeGroupBox">
<property name="title">
<string>Vector field type</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="mCartesianRadioButton">
<property name="text">
<string>Cartesian</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="mPolarRadioButton">
<property name="text">
<string>Polar</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="mHeightRadioButton">
<property name="text">
<string>Height only</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="2" colspan="2">
<widget class="QGroupBox" name="mAngleUnitsGroupBox">
<property name="title">
<string>Angle units</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QRadioButton" name="mDegreesRadioButton">
<property name="text">
<string>Degrees</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="mRadiansRadioButton">
<property name="text">
<string>Radians</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="2" colspan="2">
<widget class="QGroupBox" name="mAngleOrientationGroupBox">
<property name="title">
<string>Angle orientation</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="mFieldTypeGroupBox">
<property name="title">
<string>Vector field type</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QRadioButton" name="mHeightRadioButton">
<property name="text">
<string>Height only</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="mPolarRadioButton">
<property name="text">
<string>Polar</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="mCartesianRadioButton">
<property name="text">
<string>Cartesian</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mAngleUnitsGroupBox">
<property name="title">
<string>Angle units</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QRadioButton" name="mDegreesRadioButton">
<property name="text">
<string>Degrees</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="mRadiansRadioButton">
<property name="text">
<string>Radians</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="mAngleOrientationGroupBox">
<property name="title">
<string>Angle orientation</string>
</property>
<widget class="QRadioButton" name="mCounterclockwiseFromEastRadioButton">
<property name="geometry">
<rect>
<x>17</x>
<y>52</y>
<width>183</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Counterclockwise from east</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="mClockwiseFromNorthRadioButton">
<property name="geometry">
<rect>
<x>17</x>
<y>25</y>
<width>146</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Clockwise from north</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mLineStyleLabel">
<property name="text">
<string>LineStyle</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QPushButton" name="mLineStylePushButton">
<property name="text">
<string>change</string>
</property>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>