Skip to content

Commit 4a5d442

Browse files
committed
Move rules up/down instead of inc/dec priorities
1 parent 81ec790 commit 4a5d442

File tree

3 files changed

+14
-40
lines changed

3 files changed

+14
-40
lines changed

src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ QgsRuleBasedRendererV2Widget::QgsRuleBasedRendererV2Widget( QgsVectorLayer* laye
6868
btnAddRule->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.png" ) ) );
6969
btnEditRule->setIcon( QIcon( QgsApplication::iconPath( "symbologyEdit.png" ) ) );
7070
btnRemoveRule->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.png" ) ) );
71-
btnIncreasePriority->setIcon( QIcon( QgsApplication::iconPath( "symbologyUp.png" ) ) );
72-
btnDecreasePriority->setIcon( QIcon( QgsApplication::iconPath( "symbologyDown.png" ) ) );
71+
btnMoveUp->setIcon( QIcon( QgsApplication::iconPath( "symbologyUp.png" ) ) );
72+
btnMoveDown->setIcon( QIcon( QgsApplication::iconPath( "symbologyDown.png" ) ) );
7373

7474
connect( treeRules, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( editRule() ) );
7575
connect( treeRules, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( contextMenuViewCategories( const QPoint& ) ) );
7676

7777
connect( btnAddRule, SIGNAL( clicked() ), this, SLOT( addRule() ) );
7878
connect( btnEditRule, SIGNAL( clicked() ), this, SLOT( editRule() ) );
7979
connect( btnRemoveRule, SIGNAL( clicked() ), this, SLOT( removeRule() ) );
80-
connect( btnIncreasePriority, SIGNAL( clicked() ), this, SLOT( increasePriority() ) );
81-
connect( btnDecreasePriority, SIGNAL( clicked() ), this, SLOT( decreasePriority() ) );
80+
connect( btnMoveUp, SIGNAL( clicked() ), this, SLOT( moveUp() ) );
81+
connect( btnMoveDown, SIGNAL( clicked() ), this, SLOT( moveDown() ) );
8282

8383
connect( radNoGrouping, SIGNAL( clicked() ), this, SLOT( setGrouping() ) );
8484
connect( radGroupFilter, SIGNAL( clicked() ), this, SLOT( setGrouping() ) );
@@ -180,7 +180,7 @@ void QgsRuleBasedRendererV2Widget::removeRule()
180180
}
181181

182182

183-
void QgsRuleBasedRendererV2Widget::increasePriority()
183+
void QgsRuleBasedRendererV2Widget::moveUp()
184184
{
185185
QTreeWidgetItem * item = treeRules->currentItem();
186186
if ( ! item ) return; // No rule selected, exit
@@ -191,7 +191,7 @@ void QgsRuleBasedRendererV2Widget::increasePriority()
191191
}
192192
else
193193
{
194-
if ( rule_index > 0 ) // do not increase priority of first rule
194+
if ( rule_index > 0 ) // do not move up the first rule
195195
{
196196
mRenderer->swapRules( rule_index, rule_index - 1 );
197197
treeRules->populateRules();
@@ -205,7 +205,7 @@ void QgsRuleBasedRendererV2Widget::increasePriority()
205205
}
206206

207207

208-
void QgsRuleBasedRendererV2Widget::decreasePriority()
208+
void QgsRuleBasedRendererV2Widget::moveDown()
209209
{
210210
QTreeWidgetItem * item = treeRules->currentItem();
211211
if ( ! item ) return; // No rule selected, exit
@@ -216,7 +216,7 @@ void QgsRuleBasedRendererV2Widget::decreasePriority()
216216
}
217217
else
218218
{
219-
if ( rule_index + 1 < mRenderer->ruleCount() ) // do not increase priority of last rule
219+
if ( rule_index + 1 < mRenderer->ruleCount() ) // do not move down the last rule
220220
{
221221
mRenderer->swapRules( rule_index, rule_index + 1 );
222222
treeRules->populateRules();

src/gui/symbology-ng/qgsrulebasedrendererv2widget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class GUI_EXPORT QgsRuleBasedRendererV2Widget : public QgsRendererV2Widget, priv
7878
void addRule();
7979
void editRule();
8080
void removeRule();
81-
void increasePriority();
82-
void decreasePriority();
81+
void moveUp();
82+
void moveDown();
8383

8484
void setGrouping();
8585

src/ui/qgsrulebasedrendererv2widget.ui

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,18 @@
1010
<height>401</height>
1111
</rect>
1212
</property>
13-
<property name="windowTitle">
14-
<string>Form</string>
15-
</property>
1613
<layout class="QGridLayout" name="gridLayout">
1714
<item row="0" column="0">
1815
<widget class="QgsRendererRulesTreeWidget" name="treeRules">
1916
<property name="contextMenuPolicy">
2017
<enum>Qt::CustomContextMenu</enum>
2118
</property>
22-
<property name="styleSheet">
23-
<string notr="true"/>
24-
</property>
2519
<property name="selectionMode">
2620
<enum>QAbstractItemView::ExtendedSelection</enum>
2721
</property>
2822
<property name="rootIsDecorated">
2923
<bool>false</bool>
3024
</property>
31-
<property name="sortingEnabled">
32-
<bool>true</bool>
33-
</property>
3425
<property name="headerHidden">
3526
<bool>false</bool>
3627
</property>
@@ -48,28 +39,11 @@
4839
<property name="text">
4940
<string>Min. scale</string>
5041
</property>
51-
<property name="textAlignment">
52-
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
53-
</property>
5442
</column>
5543
<column>
5644
<property name="text">
5745
<string>Max. scale</string>
5846
</property>
59-
<property name="textAlignment">
60-
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
61-
</property>
62-
</column>
63-
<column>
64-
<property name="text">
65-
<string>Priority</string>
66-
</property>
67-
<property name="toolTip">
68-
<string>Priority when symbol levels are enabled (only first matching rule will be applied)</string>
69-
</property>
70-
<property name="textAlignment">
71-
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
72-
</property>
7347
</column>
7448
</widget>
7549
</item>
@@ -104,16 +78,16 @@
10478
</widget>
10579
</item>
10680
<item>
107-
<widget class="QPushButton" name="btnIncreasePriority">
81+
<widget class="QPushButton" name="btnMoveUp">
10882
<property name="text">
109-
<string>Increase priority</string>
83+
<string>Move up</string>
11084
</property>
11185
</widget>
11286
</item>
11387
<item>
114-
<widget class="QPushButton" name="btnDecreasePriority">
88+
<widget class="QPushButton" name="btnMoveDown">
11589
<property name="text">
116-
<string>Decrease priority</string>
90+
<string>Move down</string>
11791
</property>
11892
</widget>
11993
</item>

0 commit comments

Comments
 (0)