Skip to content
Permalink
Browse files
Fixed a problem with checkboxes in the legend
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.
@@ -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)));
@@ -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);

@@ -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:

@@ -19,6 +19,7 @@
***************************************************************************/

#include "qgsapplication.h"
#include "qgslegend.h"
#include "qgslegendlayer.h"
#include "qgslegendlayerfile.h"
#include "qgslegendlayerfilegroup.h"
@@ -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);
}
}
@@ -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
@@ -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

0 comments on commit f061771

Please sign in to comment.