diff --git a/images/themes/default/mIconOverview.png b/images/themes/default/mIconOverview.png new file mode 100644 index 00000000000..9ad7dfc1ad2 Binary files /dev/null and b/images/themes/default/mIconOverview.png differ diff --git a/src/gui/qgsmaplayer.cpp b/src/gui/qgsmaplayer.cpp index 8795f980fda..0e3d5196c23 100644 --- a/src/gui/qgsmaplayer.cpp +++ b/src/gui/qgsmaplayer.cpp @@ -452,29 +452,8 @@ void QgsMapLayer::updateItemPixmap() { if (mLegendLayerFile) { - QPixmap originalPix=mLegendLayerFile->getOriginalPixmap(); - - if(mShowInOverview) - { - //add overview glasses to the pixmap - mLegendLayerFile->setOverviewPixmap(mInOverviewPixmap); - } - else - { - mLegendLayerFile->setOverviewPixmap( QPixmap() ); - } - - if(isEditable()) - { - //add editing icon to the pixmap - mLegendLayerFile->setEditingPixmap(mEditablePixmap); - } - else - { - mLegendLayerFile->setEditingPixmap( QPixmap() ); - } - - mLegendLayerFile->setLegendPixmap(originalPix); + mLegendLayerFile->setIconAppearance(mShowInOverview, + isEditable()); } } @@ -490,7 +469,7 @@ void QgsMapLayer::invalidTransformInput() QPainter p(&pix); p.drawPixmap(60,0,mProjectionErrorPixmap); } - mLegendLayerFile->setLegendPixmap(pix); + mLegendLayerFile->setLegendPixmap(pix); } } diff --git a/src/legend/qgslegend.cpp b/src/legend/qgslegend.cpp index 4db5f5a4c3a..46066902a22 100755 --- a/src/legend/qgslegend.cpp +++ b/src/legend/qgslegend.cpp @@ -69,22 +69,8 @@ QgsLegend::QgsLegend(QgisApp* app, QWidget * parent, const char *name) setFont(f); setBackgroundColor(QColor(192, 192, 192)); - setColumnCount(3); // main column, overview indicator and editing indicator - - header()->setDefaultAlignment(Qt::AlignLeft); - - QStringList myList; - myList += tr("Layer Name"); - myList += tr("Overview"); - myList += tr("Editing"); - - setHeaderLabels(myList); - header()->resizeSection(0, 100); - header()->resizeSection(1, 24); // Enough to fit an overview action icon - header()->resizeSection(2, 17); // Enough to fit an editing icon - - //added by Tim to hide the header - header is unneccessary - // header()->setHidden(1); // morb_au - experiment + setColumnCount(1); + header()->setHidden(1); setRootIsDecorated(true); } diff --git a/src/legend/qgslegendlayerfile.cpp b/src/legend/qgslegendlayerfile.cpp index 4c5cd5f65dc..3463c09c775 100644 --- a/src/legend/qgslegendlayerfile.cpp +++ b/src/legend/qgslegendlayerfile.cpp @@ -96,16 +96,31 @@ void QgsLegendLayerFile::setLegendPixmap(const QPixmap& pix) setIcon(0, theIcon); } -void QgsLegendLayerFile::setOverviewPixmap(const QPixmap& pix) +void QgsLegendLayerFile::setIconAppearance(bool inOverview, + bool editable) { - QIcon theIcon(pix); - setIcon(1, theIcon); -} + QPixmap newIcon(getOriginalPixmap()); -void QgsLegendLayerFile::setEditingPixmap(const QPixmap& pix) -{ - QIcon theIcon(pix); - setIcon(2, theIcon); + if (inOverview) + { + // Overlay the overview icon on the default icon + QPixmap myPixmap(QgsApplication::themePath()+"mIconOverview.png"); + QPainter p(&newIcon); + p.drawPixmap(0,0,myPixmap); + p.end(); + } + + if (editable) + { + // Overlay the editable icon on the default icon + QPixmap myPixmap(QgsApplication::themePath()+"mIconEditable.png"); + QPainter p(&newIcon); + p.drawPixmap(0,0,myPixmap); + p.end(); + } + + QIcon theIcon(newIcon); + setIcon(0, theIcon); } void QgsLegendLayerFile::toggleCheckBox(bool state) diff --git a/src/legend/qgslegendlayerfile.h b/src/legend/qgslegendlayerfile.h index c0c5ac7062c..d559927b88f 100644 --- a/src/legend/qgslegendlayerfile.h +++ b/src/legend/qgslegendlayerfile.h @@ -45,9 +45,7 @@ public: void setLegendPixmap(const QPixmap& pix); - void setOverviewPixmap(const QPixmap& pix); - - void setEditingPixmap(const QPixmap& pix); + void setIconAppearance(bool inOverview, bool editable); /**Sets mVisibilityCheckBox to on/off*/ void toggleCheckBox(bool state);