diff --git a/src/legend/qgslegend.cpp b/src/legend/qgslegend.cpp index 138950d37172..67c530e9817e 100755 --- a/src/legend/qgslegend.cpp +++ b/src/legend/qgslegend.cpp @@ -63,17 +63,29 @@ QgsLegend::QgsLegend(QgisApp* app, QWidget * parent, const char *name) this, SLOT(handleCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*))); - setSortingEnabled(false); + setSortingEnabled(false); setDragEnabled(false); setAutoScroll(true); QFont f("Arial", 10, QFont::Normal); setFont(f); setBackgroundColor(QColor(192, 192, 192)); - setColumnCount(1); - QStringList myList("Layers"); + + 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); + // header()->setHidden(1); // morb_au - experiment setRootIsDecorated(true); } diff --git a/src/legend/qgslegendlayerfile.cpp b/src/legend/qgslegendlayerfile.cpp index 13e624e38f06..4c5cd5f65dc6 100644 --- a/src/legend/qgslegendlayerfile.cpp +++ b/src/legend/qgslegendlayerfile.cpp @@ -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) { //todo diff --git a/src/legend/qgslegendlayerfile.h b/src/legend/qgslegendlayerfile.h index c7bb4ac56f46..c0c5ac7062c1 100644 --- a/src/legend/qgslegendlayerfile.h +++ b/src/legend/qgslegendlayerfile.h @@ -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