[QGIS Commit] r10807 -
branches/symbology-ng-branch/src/gui/symbology-ng
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun May 17 09:21:02 EDT 2009
Author: wonder
Date: 2009-05-17 09:21:02 -0400 (Sun, 17 May 2009)
New Revision: 10807
Modified:
branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbolv2propertiesdialog.cpp
branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbolv2propertiesdialog.h
Log:
Show symbol layers in symbol properties dialog in more logical order: top layer is now on top :-)
Modified: branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbolv2propertiesdialog.cpp
===================================================================
--- branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbolv2propertiesdialog.cpp 2009-05-17 13:02:06 UTC (rev 10806)
+++ branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbolv2propertiesdialog.cpp 2009-05-17 13:21:02 UTC (rev 10807)
@@ -119,7 +119,7 @@
connect(selModel, SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(layerChanged()));
int count = mSymbol->symbolLayerCount();
- for (int i = 0; i < count; i++)
+ for (int i = count-1; i >= 0; i--)
{
model->appendRow(new SymbolLayerItem( mSymbol->symbolLayer(i) ));
}
@@ -140,7 +140,7 @@
void QgsSymbolV2PropertiesDialog::updateUi()
{
- int row = currentLayerIndex();
+ int row = currentRowIndex();
btnUp->setEnabled( row > 0 );
btnDown->setEnabled( row < listLayers->model()->rowCount()-1 && row != -1 );
btnRemoveLayer->setEnabled( row != -1 );
@@ -209,7 +209,7 @@
}
}
-int QgsSymbolV2PropertiesDialog::currentLayerIndex()
+int QgsSymbolV2PropertiesDialog::currentRowIndex()
{
QModelIndex idx = listLayers->selectionModel()->currentIndex();
if (!idx.isValid())
@@ -217,9 +217,14 @@
return idx.row();
}
+int QgsSymbolV2PropertiesDialog::currentLayerIndex()
+{
+ return listLayers->model()->rowCount() - currentRowIndex() - 1;
+}
+
SymbolLayerItem* QgsSymbolV2PropertiesDialog::currentLayerItem()
{
- int index = currentLayerIndex();
+ int index = currentRowIndex();
if (index < 0)
return NULL;
@@ -339,15 +344,16 @@
void QgsSymbolV2PropertiesDialog::moveLayerByOffset(int offset)
{
- int idx = currentLayerIndex();
-
+ int rowIdx = currentRowIndex();
+ int layerIdx = currentLayerIndex();
+
// switch layers
- QgsSymbolLayerV2* tmpLayer = mSymbol->takeSymbolLayer(idx);
- mSymbol->insertSymbolLayer(idx + offset, tmpLayer);
+ QgsSymbolLayerV2* tmpLayer = mSymbol->takeSymbolLayer(layerIdx);
+ mSymbol->insertSymbolLayer(layerIdx - offset, tmpLayer);
loadSymbol();
- QModelIndex newIndex = listLayers->model()->index(idx + offset,0);
+ QModelIndex newIndex = listLayers->model()->index(rowIdx + offset,0);
listLayers->setCurrentIndex(newIndex);
updateUi();
Modified: branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbolv2propertiesdialog.h
===================================================================
--- branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbolv2propertiesdialog.h 2009-05-17 13:02:06 UTC (rev 10806)
+++ branches/symbology-ng-branch/src/gui/symbology-ng/qgssymbolv2propertiesdialog.h 2009-05-17 13:21:02 UTC (rev 10807)
@@ -50,6 +50,7 @@
void updateSymbolLayerWidget(QgsSymbolLayerV2* layer);
void updateLockButton();
+ int currentRowIndex();
int currentLayerIndex();
SymbolLayerItem* currentLayerItem();
QgsSymbolLayerV2* currentLayer();
More information about the QGIS-commit
mailing list