Skip to content

Commit

Permalink
Further work on ui cleanups and useability:
Browse files Browse the repository at this point in the history
 - 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@8521 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed May 26, 2008
1 parent 4334234 commit 0c763de
Show file tree
Hide file tree
Showing 12 changed files with 1,040 additions and 836 deletions.
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/app/qgsattributetabledisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
156 changes: 91 additions & 65 deletions src/app/qgsgraduatedsymboldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -372,6 +374,7 @@ void QgsGraduatedSymbolDialog::changeCurrentValue()
{
sydialog.set((*it).second);
sydialog.setLabel((*it).second->label());
updateEntryIcon((*it).second,item);
}
}
sydialog.blockSignals(false);
Expand All @@ -388,6 +391,7 @@ void QgsGraduatedSymbolDialog::applySymbologyChanges()
{
sydialog.apply((*it).second);
it->second->setLabel((*it).second->label());
updateEntryIcon((*it).second,item);
}
}
}
Expand Down Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -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
;
}
}
5 changes: 5 additions & 0 deletions src/app/qgsgraduatedsymboldialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down
1 change: 0 additions & 1 deletion src/app/qgspluginmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef QGSPLUGINMANAGER_H
#define QGSPLUGINMANAGER_H
#include <vector>
#include <QTableView>
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
#include <QStandardItem>
Expand Down
Loading

0 comments on commit 0c763de

Please sign in to comment.