Skip to content

Commit

Permalink
UI Tweaks to make the symbol selector better
Browse files Browse the repository at this point in the history
  • Loading branch information
Arunmozhi committed Jul 9, 2012
1 parent b6d0419 commit 80ecdeb
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 161 deletions.
8 changes: 7 additions & 1 deletion src/gui/symbology-ng/qgssymbolv2selectordialog.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
28 changes: 1 addition & 27 deletions src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.cpp
Expand Up @@ -88,7 +88,7 @@ void QgsVectorFieldSymbolLayerWidget::setSymbolLayer( QgsSymbolLayerV2* layer )
{
mRadiansRadioButton->setChecked( true );
}
updateMarkerIcon();
emit changed();
}

QgsSymbolLayerV2* QgsVectorFieldSymbolLayerWidget::symbolLayer()
Expand Down Expand Up @@ -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 )
Expand Down
2 changes: 0 additions & 2 deletions src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.h
Expand Up @@ -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 );
Expand Down
114 changes: 67 additions & 47 deletions src/ui/symbollayer/widget_symbolslist.ui
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
<item>
<widget class="QPushButton" name="btnAddToStyle">
<property name="text">
<string>Advanced</string>
<string>Save as style</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="btnAddToStyle">
<item>
<widget class="QPushButton" name="btnStyleManager">
<property name="text">
<string>Save as style</string>
<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">
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 80ecdeb

Please sign in to comment.