Skip to content
Permalink
Browse files
Renderer properties: switched from list widget to a combo box with re…
…nderers

git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@12134 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 15, 2009
1 parent 6ffdd1a commit 15c79012928a52fb5e70ee747291f638d01b4d54
Showing with 46 additions and 46 deletions.
  1. +9 −8 src/gui/symbology-ng/qgsrendererv2propertiesdialog.cpp
  2. +37 −38 src/ui/qgsrendererv2propsdialogbase.ui
@@ -51,10 +51,11 @@ QgsRendererV2PropertiesDialog::QgsRendererV2PropertiesDialog(QgsVectorLayer* lay
if (!pix.load(iconPath, "png"))
pix = QPixmap();

QListWidgetItem* item = new QListWidgetItem(QIcon(pix), m.visibleName(), listRenderers);
item->setData(Qt::UserRole, name);
cboRenderers->addItem(QIcon(pix), m.visibleName(), name);
}

cboRenderers->setCurrentIndex(-1); // set no current renderer

// if the layer doesn't use renderer V2, let's start using it!
if (!mLayer->isUsingRendererV2())
{
@@ -63,15 +64,15 @@ QgsRendererV2PropertiesDialog::QgsRendererV2PropertiesDialog(QgsVectorLayer* lay
}

// setup slot rendererChanged()
connect(listRenderers, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(rendererChanged()));
connect(cboRenderers, SIGNAL(currentIndexChanged(int)), this, SLOT(rendererChanged()));

// set current renderer from layer
QString rendererName = mLayer->rendererV2()->type();
for (int i = 0; i < listRenderers->count(); i++)
for (int i = 0; i < cboRenderers->count(); i++)
{
if (listRenderers->item(i)->data(Qt::UserRole).toString() == rendererName)
if (cboRenderers->itemData(i).toString() == rendererName)
{
listRenderers->setCurrentItem( listRenderers->item(i) );
cboRenderers->setCurrentIndex(i);
return;
}
}
@@ -85,13 +86,13 @@ QgsRendererV2PropertiesDialog::QgsRendererV2PropertiesDialog(QgsVectorLayer* lay
void QgsRendererV2PropertiesDialog::rendererChanged()
{

if (listRenderers->currentItem() == NULL)
if (cboRenderers->currentIndex() == -1)
{
QgsDebugMsg("No current item -- this should never happen!");
return;
}

QString rendererName = listRenderers->currentItem()->data(Qt::UserRole).toString();
QString rendererName = cboRenderers->itemData( cboRenderers->currentIndex() ).toString();

// get rid of old active widget (if any)
if (mActiveWidget)
@@ -13,36 +13,42 @@
<property name="windowTitle">
<string>Renderer settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QListWidget" name="listRenderers">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="spacing">
<number>4</number>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Renderer:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cboRenderers"/>
</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="btnSymbolLevels">
<property name="text">
<string>Symbol levels</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1" rowspan="2">
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -69,24 +75,17 @@
</widget>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="btnSymbolLevels">
<property name="text">
<string>Symbol levels</string>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>listRenderers</tabstop>
<tabstop>cboRenderers</tabstop>
<tabstop>btnSymbolLevels</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>

0 comments on commit 15c7901

Please sign in to comment.