Skip to content

Commit 82dfbac

Browse files
author
Arunmozhi
committedJul 9, 2012
Midway commit; implements symbols listing/changing in symbol selector
1 parent 1d770bf commit 82dfbac

File tree

7 files changed

+582
-573
lines changed

7 files changed

+582
-573
lines changed
 

‎python/gui/symbology-ng-gui.sip

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,34 @@ class QgsSymbolV2SelectorDialog : QDialog //, private Ui::QgsSymbolV2SelectorDia
7171
%TypeHeaderCode
7272
#include <qgssymbolv2selectordialog.h>
7373
%End
74+
public:
75+
QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent = NULL, bool embedded = false );
7476

75-
public:
76-
QgsSymbolV2SelectorDialog(QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent = NULL, bool embedded = false);
77-
78-
protected:
79-
void populateSymbolView();
80-
void updateSymbolPreview();
81-
void updateSymbolColor();
82-
void updateSymbolInfo();
83-
77+
QMenu* advancedMenu();
8478

85-
public slots:
86-
void changeSymbolProperties();
87-
void setSymbolFromStyle(const QModelIndex & index);
88-
void setSymbolColor();
89-
void setMarkerAngle(double angle);
90-
void setMarkerSize(double size);
91-
void setLineWidth(double width);
92-
93-
signals:
94-
void symbolModified();
79+
protected:
80+
void keyPressEvent( QKeyEvent * event );
81+
82+
void loadSymbol();
83+
void updateUi();
84+
void updateLockButton();
85+
QgsSymbolLayerV2* currentLayer();
86+
void moveLayerByOffset( int offset );
87+
void setWidget( QWidget* widget );
88+
89+
signals:
90+
void symbolModified();
91+
92+
public slots:
93+
void moveLayerDown();
94+
void moveLayerUp();
95+
void addLayer();
96+
void removeLayer();
97+
void lockLayer();
98+
void layerTypeChanged();
99+
void layerChanged();
100+
void updateLayerPreview();
101+
void updatePreview();
95102

96103
};
97104

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty
4646

4747
QStandardItemModel* model = new QStandardItemModel( viewSymbols );
4848
viewSymbols->setModel( model );
49-
//connect( viewSymbols, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( setSymbolFromStyle( const QModelIndex & ) ) );
49+
connect( viewSymbols, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( setSymbolFromStyle( const QModelIndex & ) ) );
5050

5151
connect( btnStyleManager, SIGNAL( clicked() ), SLOT( openStyleManager() ) );
5252
lblSymbolName->setText( "" );
@@ -270,7 +270,16 @@ void QgsSymbolsListWidget::setSymbolFromStyle( const QModelIndex & index )
270270
emit changed();
271271
}
272272

273-
273+
QMenu* QgsSymbolsListWidget::advancedMenu()
274+
{
275+
if ( mAdvancedMenu == NULL )
276+
{
277+
mAdvancedMenu = new QMenu;
278+
btnAdvanced->setMenu( mAdvancedMenu );
279+
btnAdvanced->show();
280+
}
281+
return mAdvancedMenu;
282+
}
274283

275284

276285

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
class QgsSymbolV2;
2424
class QgsStyleV2;
25-
class QgsVectorLayer;
2625

2726
class QMenu;
2827

@@ -57,7 +56,6 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::WidgetSymbol
5756
QgsSymbolV2* mSymbol;
5857
QgsStyleV2* mStyle;
5958
QMenu* mAdvancedMenu;
60-
const QgsVectorLayer* mVectorLayer;
6159

6260
void populateSymbolView();
6361
void updateSymbolColor();

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

Lines changed: 411 additions & 200 deletions
Large diffs are not rendered by default.

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

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@
2020

2121
#include "ui_qgssymbolv2selectordialogbase.h"
2222

23+
#include <QStandardItemModel>
24+
2325
class QgsStyleV2;
2426
class QgsSymbolV2;
27+
class QgsSymbolLayerV2;
2528
class QgsVectorLayer;
2629

2730
class QMenu;
31+
class QWidget;
32+
33+
class SymbolLayerItem;
2834

2935
class GUI_EXPORT QgsSymbolV2SelectorDialog : public QDialog, private Ui::QgsSymbolV2SelectorDialogBase
3036
{
@@ -37,39 +43,59 @@ class GUI_EXPORT QgsSymbolV2SelectorDialog : public QDialog, private Ui::QgsSymb
3743
QMenu* advancedMenu();
3844

3945
protected:
40-
void populateSymbolView();
41-
void updateSymbolPreview();
42-
void updateSymbolColor();
43-
void updateSymbolInfo();
44-
4546
//! Reimplements dialog keyPress event so we can ignore it
4647
void keyPressEvent( QKeyEvent * event );
4748

48-
private:
49-
/**Displays alpha value as transparency in mTransparencyLabel*/
50-
void displayTransparency( double alpha );
49+
void loadSymbol();
50+
void loadSymbol( QgsSymbolV2* symbol, SymbolLayerItem* parent );
5151

52-
public slots:
53-
void changeSymbolProperties();
54-
void setSymbolFromStyle( const QModelIndex & index );
55-
void setSymbolColor();
56-
void setMarkerAngle( double angle );
57-
void setMarkerSize( double size );
58-
void setLineWidth( double width );
59-
void addSymbolToStyle();
60-
void on_mSymbolUnitComboBox_currentIndexChanged( const QString & text );
61-
void on_mTransparencySlider_valueChanged( int value );
62-
63-
void openStyleManager();
52+
void populateLayerTypes( QgsSymbolV2* symbol );
53+
54+
void updateUi();
55+
56+
//void loadPropertyWidgets();
57+
58+
//void updateSymbolLayerWidget( QgsSymbolLayerV2* layer );
59+
void updateLockButton();
60+
61+
SymbolLayerItem* currentLayerItem();
62+
QgsSymbolLayerV2* currentLayer();
63+
64+
void moveLayerByOffset( int offset );
65+
66+
void setWidget( QWidget* widget );
6467

6568
signals:
6669
void symbolModified();
6770

68-
protected:
71+
public slots:
72+
void moveLayerDown();
73+
void moveLayerUp();
74+
75+
void addLayer();
76+
void removeLayer();
77+
78+
void lockLayer();
79+
80+
void layerTypeChanged();
81+
82+
void layerChanged();
83+
84+
void updateLayerPreview();
85+
void updatePreview();
86+
87+
void symbolChanged();
88+
89+
90+
protected: // data
6991
QgsStyleV2* mStyle;
7092
QgsSymbolV2* mSymbol;
7193
QMenu* mAdvancedMenu;
7294
const QgsVectorLayer* mVectorLayer;
95+
96+
QStandardItemModel* model;
97+
QWidget *mPresentWidget;
98+
7399
};
74100

75101
#endif

‎src/ui/qgssymbolv2propertiesdialogbase.ui

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>674</width>
9+
<width>597</width>
1010
<height>396</height>
1111
</rect>
1212
</property>
@@ -68,10 +68,13 @@
6868
</item>
6969
</layout>
7070
</item>
71-
<item row="0" column="0">
72-
<widget class="QLabel" name="label_3">
73-
<property name="text">
74-
<string>Symbol layers</string>
71+
<item row="5" column="0" colspan="2">
72+
<widget class="QDialogButtonBox" name="buttonBox">
73+
<property name="orientation">
74+
<enum>Qt::Horizontal</enum>
75+
</property>
76+
<property name="standardButtons">
77+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
7578
</property>
7679
</widget>
7780
</item>
@@ -205,13 +208,10 @@
205208
</property>
206209
</widget>
207210
</item>
208-
<item row="5" column="0" colspan="2">
209-
<widget class="QDialogButtonBox" name="buttonBox">
210-
<property name="orientation">
211-
<enum>Qt::Horizontal</enum>
212-
</property>
213-
<property name="standardButtons">
214-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
211+
<item row="0" column="0">
212+
<widget class="QLabel" name="label_3">
213+
<property name="text">
214+
<string>Symbol layers</string>
215215
</property>
216216
</widget>
217217
</item>
@@ -237,32 +237,32 @@
237237
<connections>
238238
<connection>
239239
<sender>buttonBox</sender>
240-
<signal>accepted()</signal>
240+
<signal>rejected()</signal>
241241
<receiver>DlgSymbolV2Properties</receiver>
242-
<slot>accept()</slot>
242+
<slot>reject()</slot>
243243
<hints>
244244
<hint type="sourcelabel">
245-
<x>257</x>
245+
<x>325</x>
246246
<y>386</y>
247247
</hint>
248248
<hint type="destinationlabel">
249-
<x>157</x>
249+
<x>286</x>
250250
<y>274</y>
251251
</hint>
252252
</hints>
253253
</connection>
254254
<connection>
255255
<sender>buttonBox</sender>
256-
<signal>rejected()</signal>
256+
<signal>accepted()</signal>
257257
<receiver>DlgSymbolV2Properties</receiver>
258-
<slot>reject()</slot>
258+
<slot>accept()</slot>
259259
<hints>
260260
<hint type="sourcelabel">
261-
<x>325</x>
261+
<x>257</x>
262262
<y>386</y>
263263
</hint>
264264
<hint type="destinationlabel">
265-
<x>286</x>
265+
<x>157</x>
266266
<y>274</y>
267267
</hint>
268268
</hints>

‎src/ui/qgssymbolv2selectordialogbase.ui

Lines changed: 67 additions & 309 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.