Skip to content

Commit

Permalink
Fixed a problem with checkboxes in the legend
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5638 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jul 25, 2006
1 parent bf71f52 commit f061771
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/gui/qgsbookmarks.cpp
Expand Up @@ -87,7 +87,7 @@ void QgsBookmarks::initialise()
{
QString name = QString::fromUtf8((const char *)sqlite3_column_text(ppStmt, 1));
// sqlite3_bind_parameter_index(ppStmt, "name"));
QgsDebugMsg("Bookmark name: " + name.toLocal8Bit().data());
//QgsDebugMsg("Bookmark name: " + name.toLocal8Bit().data());
Q3ListViewItem *lvi = new Q3ListViewItem(lstBookmarks, name);
// set the project name
lvi->setText(1, QString::fromUtf8((const char *)sqlite3_column_text(ppStmt, 2)));
Expand Down
3 changes: 0 additions & 3 deletions src/legend/qgslegend.cpp
Expand Up @@ -1265,9 +1265,6 @@ QDomNode QgsLegend::nextDomNode(const QDomNode& theNode)

void QgsLegend::insertItem(QTreeWidgetItem* move, QTreeWidgetItem* into)
{
#ifdef QGISDEBUG
qWarning("entering QgsLegend::insertItem");
#endif
QgsLegendItem* movedItem = dynamic_cast<QgsLegendItem*>(move);
QgsLegendItem* intoItem = dynamic_cast<QgsLegendItem*>(into);

Expand Down
1 change: 1 addition & 0 deletions src/legend/qgslegend.h
Expand Up @@ -162,6 +162,7 @@ class QgsLegend : public QTreeWidget
the given QgsLegendLayerFile */
void setName(QgsLegendLayerFile* w, QString layerName);

void updateCheckStates(QTreeWidgetItem* item, Qt::CheckState state) {mStateOfCheckBoxes[item] = state;}

public slots:

Expand Down
3 changes: 3 additions & 0 deletions src/legend/qgslegendlayer.cpp
Expand Up @@ -19,6 +19,7 @@
***************************************************************************/

#include "qgsapplication.h"
#include "qgslegend.h"
#include "qgslegendlayer.h"
#include "qgslegendlayerfile.h"
#include "qgslegendlayerfilegroup.h"
Expand Down Expand Up @@ -230,6 +231,8 @@ void QgsLegendLayer::updateCheckState()
{
treeWidget()->blockSignals(true);
setCheckState(0, theState);
//notify the legend that the check state has changed
legend()->updateCheckStates(this, theState);
treeWidget()->blockSignals(false);
}
}
Expand Down
16 changes: 0 additions & 16 deletions src/legend/qgslegendlayerfilegroup.cpp
Expand Up @@ -73,23 +73,13 @@ QgsLegendItem::DRAG_ACTION QgsLegendLayerFileGroup::accept(const QgsLegendItem*

bool QgsLegendLayerFileGroup::insert(QgsLegendItem* newItem)
{
#ifdef QGISDEBUG
qWarning("In QgsLegendLayerFileGroup::insert");
#endif
if ( newItem->type() == LEGEND_LAYER_FILE )
{
QgsLegendItem* oldItem = firstChild();
//QgsLegendLayer* parentLegendLayer = dynamic_cast<QgsLegendLayer*>(parent());

if(!oldItem)//this item is the first child
{
insertChild(0, newItem);
//update the icon and the check state of the new and the former legend layer
//if(parentLegendLayer)
//{
// parentLegendLayer->updateIcon();
// parentLegendLayer->updateCheckState();
//}
return true;
}
//there are already legend layer files
Expand All @@ -114,12 +104,6 @@ bool QgsLegendLayerFileGroup::insert(QgsLegendItem* newItem)
if(newLayer->isSymbologyCompatible(*thelayer))
{
insertChild(childCount(), newItem);
//update the icon and the check state of the new and the former legend layer
//if(parentLegendLayer)
//{
// parentLegendLayer->updateIcon();
// parentLegendLayer->updateCheckState();
//}
return true;
}
else
Expand Down

0 comments on commit f061771

Please sign in to comment.