Skip to content
Permalink
Browse files
Replaced Q3ListBox in the unique value dialog with QListWidget
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6523 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Feb 4, 2007
1 parent 9b335ac commit 3e654a97fcf50e696189bce10697c37aa3667cd6
Showing with 60 additions and 55 deletions.
  1. +22 −12 src/app/qgsuniquevaluedialog.cpp
  2. +38 −43 src/ui/qgsuniquevaluedialogbase.ui
@@ -74,13 +74,13 @@ QgsUniqueValueDialog::QgsUniqueValueDialog(QgsVectorLayer* vl): QDialog(), mVect
sym->setNamedPointSymbol(symbol->pointSymbolName());
sym->setPointSize(symbol->pointSize());
mValues.insert(std::make_pair(symbolvalue,sym));
mClassBreakBox->insertItem(symbolvalue);
mClassBreakBox->addItem(symbolvalue);
}
}

QObject::connect(mClassifyButton, SIGNAL(clicked()), this, SLOT(changeClassificationAttribute()));
QObject::connect(mDeletePushButton, SIGNAL(clicked()), this, SLOT(deleteCurrentClass()));
QObject::connect(mClassBreakBox, SIGNAL(selectionChanged()), this, SLOT(changeCurrentValue()));
QObject::connect(mClassBreakBox, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(changeCurrentValue()));
QObject::connect(&sydialog, SIGNAL(settingsChanged()), this, SLOT(applySymbologyChanges()));
mSymbolWidgetStack->addWidget(&sydialog);
mSymbolWidgetStack->raiseWidget(&sydialog);
@@ -168,7 +168,7 @@ void QgsUniqueValueDialog::changeClassificationAttribute()
int green = 1 + (int) (255.0 * rand() / (RAND_MAX + 1.0));
int blue = 1 + (int) (255.0 * rand() / (RAND_MAX + 1.0));
thecolor.setRgb(red, green, blue);
mClassBreakBox->insertItem(it->first);
mClassBreakBox->addItem(it->first);
QgsSymbol* sym=it->second;
QPen pen;
QBrush brush;
@@ -196,7 +196,7 @@ void QgsUniqueValueDialog::changeClassificationAttribute()
void QgsUniqueValueDialog::changeCurrentValue()
{
sydialog.blockSignals(true);//block signal to prevent sydialog from changing the current QgsRenderItem
Q3ListBoxItem* item=mClassBreakBox->selectedItem();
QListWidgetItem* item=mClassBreakBox->currentItem();
if(item)
{
QString value=item->text();
@@ -216,28 +216,38 @@ void QgsUniqueValueDialog::changeCurrentValue()

void QgsUniqueValueDialog::deleteCurrentClass()
{
QString classValue = mClassBreakBox->currentText();
int currentIndex = mClassBreakBox->currentItem();
QListWidgetItem* currentItem = mClassBreakBox->currentItem();
if(!currentItem)
{
return;
}

QString classValue = currentItem->text();
int currentIndex = mClassBreakBox->currentRow();
mValues.erase(classValue);
mClassBreakBox->removeItem(currentIndex);
delete (mClassBreakBox->takeItem(currentIndex));
qWarning("numRows: ");
qWarning(QString::number(mClassBreakBox->numRows()));
qWarning(QString::number(mClassBreakBox->count()));
//
if(mClassBreakBox->numRows() < (currentIndex + 1))
if(mClassBreakBox->count() < (currentIndex + 1))
{
qWarning("selecting numRows - 1");
mClassBreakBox->setSelected(mClassBreakBox->numRows() - 1, true);
mClassBreakBox->setCurrentRow(mClassBreakBox->count() - 1);
}
else
{
qWarning("selecting currentIndex");
mClassBreakBox->setSelected(currentIndex, true);
mClassBreakBox->setCurrentRow(currentIndex);
}
}

void QgsUniqueValueDialog::applySymbologyChanges()
{
Q3ListBoxItem* item=mClassBreakBox->selectedItem();
QListWidgetItem* item=mClassBreakBox->currentItem();
if(!item)
{
return;
}
QString value=item->text();
std::map<QString,QgsSymbol*>::iterator it=mValues.find(value);
if(it!=mValues.end())
@@ -19,27 +19,38 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="mClassVarLabel" >
<item row="1" column="2" colspan="4" >
<widget class="QListWidget" name="mClassBreakBox" />
</item>
<item row="1" column="0" colspan="2" >
<widget class="Q3WidgetStack" name="mSymbolWidgetStack" >
<widget class="QWidget" name="WStackPage" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>190</width>
<height>246</height>
</rect>
</property>
</widget>
</widget>
</item>
<item row="0" column="3" >
<widget class="QPushButton" name="mClassifyButton" >
<property name="text" >
<string>Classify</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QComboBox" name="mClassificationComboBox" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string>Classification Field:</string>
</property>
<property name="buddy" >
<cstring>mClassificationComboBox</cstring>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="QPushButton" name="mDeletePushButton" >
<property name="text" >
<string>Delete class</string>
</property>
</widget>
</item>
<item row="0" column="5" >
@@ -58,50 +69,34 @@
</property>
</spacer>
</item>
<item row="1" column="2" colspan="4" >
<widget class="Q3ListBox" name="mClassBreakBox" />
<item row="0" column="4" >
<widget class="QPushButton" name="mDeletePushButton" >
<property name="text" >
<string>Delete class</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QComboBox" name="mClassificationComboBox" >
<item row="0" column="0" >
<widget class="QLabel" name="mClassVarLabel" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QPushButton" name="mClassifyButton" >
<property name="text" >
<string>Classify</string>
<string>Classification Field:</string>
</property>
<property name="buddy" >
<cstring>mClassificationComboBox</cstring>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="Q3WidgetStack" name="mSymbolWidgetStack" >
<widget class="QWidget" name="WStackPage" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>190</width>
<height>246</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>Q3ListBox</class>
<extends>Q3Frame</extends>
<header>q3listbox.h</header>
</customwidget>
<customwidget>
<class>Q3WidgetStack</class>
<extends>Q3WidgetStack</extends>

0 comments on commit 3e654a9

Please sign in to comment.