Skip to content
Browse files
The Map Legend now has two more columns for Overview and Editing stat…
…us. If the layer is in overview or editing modes, the appropriate icon will appear in the layer's file entry (you may need to enable "Show file groups" in the right-click menu of the layer in the legend to see file entries).

QGIS used to do this already before the move to Qt4 - however the new QIcon idiom only seems to allow for square icons, therefore it is easier to split the results out to several columns and give them their own QIcons.

I can see room for improvement after this commit:
1. Overview and Editing icons can be also shown beside the top-level layer name, to avoid having to enable "Show file groups".
2. There also seems to be a "projection not valid" icon floating around, however this hasn't been addressed in this commit. Perhaps we need to do something for it too.
3. The column sizes have been hard-coded to arbitrary values.  I have no problem if these get tweaked further.

This commit addresses trac ticket #117.

git-svn-id: c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
morb_au committed Jul 14, 2006
1 parent 4b1bf6f commit eaf92a184357be6a8e88dc050e37ef3ea49d7ed1
Showing with 34 additions and 4 deletions.
  1. +16 −4 src/legend/qgslegend.cpp
  2. +12 −0 src/legend/qgslegendlayerfile.cpp
  3. +6 −0 src/legend/qgslegendlayerfile.h
@@ -63,17 +63,29 @@ QgsLegend::QgsLegend(QgisApp* app, QWidget * parent, const char *name)
this, SLOT(handleCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));

QFont f("Arial", 10, QFont::Normal);
setBackgroundColor(QColor(192, 192, 192));
QStringList myList("Layers");

setColumnCount(3); // main column, overview indicator and editing indicator


QStringList myList;
myList += tr("Layer Name");
myList += tr("Overview");
myList += tr("Editing");

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

@@ -96,6 +96,18 @@ void QgsLegendLayerFile::setLegendPixmap(const QPixmap& pix)
setIcon(0, theIcon);

void QgsLegendLayerFile::setOverviewPixmap(const QPixmap& pix)
QIcon theIcon(pix);
setIcon(1, theIcon);

void QgsLegendLayerFile::setEditingPixmap(const QPixmap& pix)
QIcon theIcon(pix);
setIcon(2, theIcon);

void QgsLegendLayerFile::toggleCheckBox(bool state)
@@ -42,7 +42,13 @@ class QgsLegendLayerFile : public QgsLegendItem
This method is used by QgsMapLayer to paint additional
information (overview, editable, pyramides) to the pixmap*/
QPixmap getOriginalPixmap() const;

void setLegendPixmap(const QPixmap& pix);

void setOverviewPixmap(const QPixmap& pix);

void setEditingPixmap(const QPixmap& pix);

/**Sets mVisibilityCheckBox to on/off*/
void toggleCheckBox(bool state);
/**Returns a label for a layer. Is static such that

0 comments on commit eaf92a1

Please sign in to comment.