Skip to content
Permalink
Browse files

Further work on ui cleanups and useability:

 - in unique value and graduated symbol dialogs, show symbol previews in classification lists
 - tidy up for raster props dialog (PeteE I finally capitulated and used a stack widget)
 - use a label instead of a textbrowser in detailed item widget


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8521 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux
timlinux committed May 26, 2008
1 parent e366074 commit 0b4cbe8d7a479d2e74423a9f5213cab7c3856d9c
@@ -1018,7 +1018,7 @@ void QgisApp::createMenus()
void QgisApp::createToolBars()
{
QSize myIconSize ( 24,24 );
//QSize myIconSize ( 32,32 ); //large icons
// QSize myIconSize ( 32,32 ); //large icons
// Note: we need to set each object name to ensure that
// qmainwindow::saveState and qmainwindow::restoreState
// work properly
@@ -53,7 +53,6 @@ class QgsAttributeTableDisplay:public QDialog, private Ui::QgsAttributeTableBase
void doSearch(const QString& searchString);

virtual void closeEvent(QCloseEvent* ev);
void showHelp();

/** array of feature IDs that match last searched condition */
QgsFeatureIds mSearchIds;
@@ -71,7 +70,7 @@ class QgsAttributeTableDisplay:public QDialog, private Ui::QgsAttributeTableBase
void search();
void advancedSearch();
void searchShowResultsChanged(int item);
void on_btnHelp_clicked();
void showHelp();

public slots:
void changeFeatureAttribute(int row, int column);
@@ -155,74 +155,74 @@ void QgsGraduatedSymbolDialog::apply()

QgsGraduatedSymbolRenderer* renderer = new QgsGraduatedSymbolRenderer(mVectorLayer->vectorType());
for (int item=0;item<mClassListWidget->count();++item)
{
QString classbreak=mClassListWidget->item(item)->text();
std::map<QString,QgsSymbol*>::iterator it=mEntries.find(classbreak);
if(it==mEntries.end())
{
continue;
}

QString lower_bound=it->second->lowerValue();
QString upper_bound=it->second->upperValue();
QString label=it->second->label();

QgsSymbol* sy = new QgsSymbol(mVectorLayer->vectorType(), lower_bound, upper_bound, label);

sy->setColor(it->second->pen().color());
sy->setLineStyle(it->second->pen().style());
sy->setLineWidth(it->second->pen().widthF());

if (mVectorLayer->vectorType() == QGis::Point)
{
sy->setNamedPointSymbol(it->second->pointSymbolName());
sy->setPointSize(it->second->pointSize());
sy->setScaleClassificationField(it->second->scaleClassificationField());
sy->setRotationClassificationField(it->second->rotationClassificationField());
}

if (mVectorLayer->vectorType() != QGis::Line)
{
sy->setFillColor(it->second->brush().color());
sy->setCustomTexture(it->second->customTexture());//necessary?
sy->setFillStyle(it->second->brush().style());
}

//test, if lower_bound is numeric or not (making a subclass of QString would be the proper solution)
bool lbcontainsletter = false;
for (int j = 0; j < lower_bound.length(); j++)
{
if (lower_bound.ref(j).isLetter())
{
lbcontainsletter = true;
}
}

//test, if upper_bound is numeric or not (making a subclass of QString would be the proper solution)
bool ubcontainsletter = false;
for (int j = 0; j < upper_bound.length(); j++)
{
if (upper_bound.ref(j).isLetter())
{
ubcontainsletter = true;
}
}
if (lbcontainsletter == false && ubcontainsletter == false && lower_bound.length() > 0 && upper_bound.length() > 0) //only add the item if the value bounds do not contain letters and are not null strings
{
renderer->addSymbol(sy);
}
else
{
QString classbreak=mClassListWidget->item(item)->text();
std::map<QString,QgsSymbol*>::iterator it=mEntries.find(classbreak);
if(it==mEntries.end())
{
continue;
}

QString lower_bound=it->second->lowerValue();
QString upper_bound=it->second->upperValue();
QString label=it->second->label();

QgsSymbol* sy = new QgsSymbol(mVectorLayer->vectorType(), lower_bound, upper_bound, label);

sy->setColor(it->second->pen().color());
sy->setLineStyle(it->second->pen().style());
sy->setLineWidth(it->second->pen().widthF());

if (mVectorLayer->vectorType() == QGis::Point)
{
sy->setNamedPointSymbol(it->second->pointSymbolName());
sy->setPointSize(it->second->pointSize());
sy->setScaleClassificationField(it->second->scaleClassificationField());
sy->setRotationClassificationField(it->second->rotationClassificationField());
}

if (mVectorLayer->vectorType() != QGis::Line)
{
sy->setFillColor(it->second->brush().color());
sy->setCustomTexture(it->second->customTexture());//necessary?
sy->setFillStyle(it->second->brush().style());
}

//test, if lower_bound is numeric or not (making a subclass of QString would be the proper solution)
bool lbcontainsletter = false;
for (int j = 0; j < lower_bound.length(); j++)
{
if (lower_bound.ref(j).isLetter())
{
lbcontainsletter = true;
}
}

//test, if upper_bound is numeric or not (making a subclass of QString would be the proper solution)
bool ubcontainsletter = false;
for (int j = 0; j < upper_bound.length(); j++)
{
if (upper_bound.ref(j).isLetter())
{
ubcontainsletter = true;
}
}
if (lbcontainsletter == false && ubcontainsletter == false && lower_bound.length() > 0 && upper_bound.length() > 0) //only add the item if the value bounds do not contain letters and are not null strings
{
renderer->addSymbol(sy);
}
else
{
delete sy;
}
delete sy;
}
}
renderer->updateSymbolAttributes();

std::map<QString,int>::iterator iter=mFieldMap.find(classificationComboBox->currentText());
if(iter!=mFieldMap.end())
{
renderer->setClassificationField(iter->second);
}
{
renderer->setClassificationField(iter->second);
}
mVectorLayer->setRenderer(renderer);
}

@@ -339,7 +339,9 @@ void QgsGraduatedSymbolDialog::adjustClassification()
(*symbol_it)->setLowerValue(QString::number(lower,'f',3));
(*symbol_it)->setUpperValue(QString::number(upper,'f',3));
listBoxText=QString::number(lower,'f',3)+" - " +QString::number(upper,'f',3);
mClassListWidget->addItem(listBoxText);
QListWidgetItem * mypItem = new QListWidgetItem(listBoxText);
updateEntryIcon(*symbol_it,mypItem);
mClassListWidget->addItem(mypItem);

mEntries.insert(std::make_pair(listBoxText,*symbol_it));
++symbol_it;
@@ -372,6 +374,7 @@ void QgsGraduatedSymbolDialog::changeCurrentValue()
{
sydialog.set((*it).second);
sydialog.setLabel((*it).second->label());
updateEntryIcon((*it).second,item);
}
}
sydialog.blockSignals(false);
@@ -388,6 +391,7 @@ void QgsGraduatedSymbolDialog::applySymbologyChanges()
{
sydialog.apply((*it).second);
it->second->setLabel((*it).second->label());
updateEntryIcon((*it).second,item);
}
}
}
@@ -419,7 +423,8 @@ void QgsGraduatedSymbolDialog::modifyClass(QListWidgetItem* item)
QString newclass=dialog.lowerValue()+"-"+dialog.upperValue();
mEntries.insert(std::make_pair(newclass,symbol));
item->setText(newclass);
}
updateEntryIcon(symbol,item);
}
}
}

@@ -532,3 +537,24 @@ QColor QgsGraduatedSymbolDialog::getColorFromRamp(QString ramp, int step, int to
}
return color;
}

void QgsGraduatedSymbolDialog::updateEntryIcon(QgsSymbol * thepSymbol,
QListWidgetItem * thepItem)
{
QGis::VectorType myType = mVectorLayer->vectorType();
switch (myType)
{
case QGis::Point:
thepItem->setIcon(QIcon(QPixmap::fromImage(thepSymbol->getPointSymbolAsImage())));
break;
case QGis::Line:
thepItem->setIcon(QIcon(QPixmap::fromImage(thepSymbol->getLineSymbolAsImage())));
break;
case QGis::Polygon:
thepItem->setIcon(QIcon(QPixmap::fromImage(thepSymbol->getPolygonSymbolAsImage())));
break;
default: //unknown
//do nothing
;
}
}
@@ -75,6 +75,11 @@ class QgsGraduatedSymbolDialog: public QDialog, private Ui::QgsGraduatedSymbolDi
void deleteCurrentClass();

private:
/** Update the list widget item icon with a preview for the symbol.
* @param QgsSymbol * - symbol holding the style info.
* @param QListWidgetItem * - item to get its icon updated.
*/
void updateEntryIcon(QgsSymbol * thepSymbol,QListWidgetItem * thepItem);
/**Default constructor is privat to not use is*/
QgsGraduatedSymbolDialog();
};
@@ -19,7 +19,6 @@
#ifndef QGSPLUGINMANAGER_H
#define QGSPLUGINMANAGER_H
#include <vector>
#include <QTableView>
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
#include <QStandardItem>

0 comments on commit 0b4cbe8

Please sign in to comment.
You can’t perform that action at this time.