Skip to content

Commit

Permalink
Move rules up/down instead of inc/dec priorities
Browse files Browse the repository at this point in the history
wonder-sk committed Nov 26, 2011
1 parent 81ec790 commit 4a5d442
Showing 3 changed files with 14 additions and 40 deletions.
16 changes: 8 additions & 8 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
Original file line number Diff line number Diff line change
@@ -68,17 +68,17 @@ QgsRuleBasedRendererV2Widget::QgsRuleBasedRendererV2Widget( QgsVectorLayer* laye
btnAddRule->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.png" ) ) );
btnEditRule->setIcon( QIcon( QgsApplication::iconPath( "symbologyEdit.png" ) ) );
btnRemoveRule->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.png" ) ) );
btnIncreasePriority->setIcon( QIcon( QgsApplication::iconPath( "symbologyUp.png" ) ) );
btnDecreasePriority->setIcon( QIcon( QgsApplication::iconPath( "symbologyDown.png" ) ) );
btnMoveUp->setIcon( QIcon( QgsApplication::iconPath( "symbologyUp.png" ) ) );
btnMoveDown->setIcon( QIcon( QgsApplication::iconPath( "symbologyDown.png" ) ) );

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

connect( btnAddRule, SIGNAL( clicked() ), this, SLOT( addRule() ) );
connect( btnEditRule, SIGNAL( clicked() ), this, SLOT( editRule() ) );
connect( btnRemoveRule, SIGNAL( clicked() ), this, SLOT( removeRule() ) );
connect( btnIncreasePriority, SIGNAL( clicked() ), this, SLOT( increasePriority() ) );
connect( btnDecreasePriority, SIGNAL( clicked() ), this, SLOT( decreasePriority() ) );
connect( btnMoveUp, SIGNAL( clicked() ), this, SLOT( moveUp() ) );
connect( btnMoveDown, SIGNAL( clicked() ), this, SLOT( moveDown() ) );

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


void QgsRuleBasedRendererV2Widget::increasePriority()
void QgsRuleBasedRendererV2Widget::moveUp()
{
QTreeWidgetItem * item = treeRules->currentItem();
if ( ! item ) return; // No rule selected, exit
@@ -191,7 +191,7 @@ void QgsRuleBasedRendererV2Widget::increasePriority()
}
else
{
if ( rule_index > 0 ) // do not increase priority of first rule
if ( rule_index > 0 ) // do not move up the first rule
{
mRenderer->swapRules( rule_index, rule_index - 1 );
treeRules->populateRules();
@@ -205,7 +205,7 @@ void QgsRuleBasedRendererV2Widget::increasePriority()
}


void QgsRuleBasedRendererV2Widget::decreasePriority()
void QgsRuleBasedRendererV2Widget::moveDown()
{
QTreeWidgetItem * item = treeRules->currentItem();
if ( ! item ) return; // No rule selected, exit
@@ -216,7 +216,7 @@ void QgsRuleBasedRendererV2Widget::decreasePriority()
}
else
{
if ( rule_index + 1 < mRenderer->ruleCount() ) // do not increase priority of last rule
if ( rule_index + 1 < mRenderer->ruleCount() ) // do not move down the last rule
{
mRenderer->swapRules( rule_index, rule_index + 1 );
treeRules->populateRules();
4 changes: 2 additions & 2 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.h
Original file line number Diff line number Diff line change
@@ -78,8 +78,8 @@ class GUI_EXPORT QgsRuleBasedRendererV2Widget : public QgsRendererV2Widget, priv
void addRule();
void editRule();
void removeRule();
void increasePriority();
void decreasePriority();
void moveUp();
void moveDown();

void setGrouping();

34 changes: 4 additions & 30 deletions src/ui/qgsrulebasedrendererv2widget.ui
Original file line number Diff line number Diff line change
@@ -10,27 +10,18 @@
<height>401</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QgsRendererRulesTreeWidget" name="treeRules">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>false</bool>
</property>
@@ -48,28 +39,11 @@
<property name="text">
<string>Min. scale</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>Max. scale</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>Priority</string>
</property>
<property name="toolTip">
<string>Priority when symbol levels are enabled (only first matching rule will be applied)</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
</widget>
</item>
@@ -104,16 +78,16 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="btnIncreasePriority">
<widget class="QPushButton" name="btnMoveUp">
<property name="text">
<string>Increase priority</string>
<string>Move up</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnDecreasePriority">
<widget class="QPushButton" name="btnMoveDown">
<property name="text">
<string>Decrease priority</string>
<string>Move down</string>
</property>
</widget>
</item>

0 comments on commit 4a5d442

Please sign in to comment.