Skip to content

Commit

Permalink
Reenabled selection from attribute table. Still some problems with 'i…
Browse files Browse the repository at this point in the history
…nvertSelection'

git-svn-id: http://svn.osgeo.org/qgis/trunk@6672 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Feb 22, 2007
1 parent 5f9bb67 commit 0c5c31a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/app/legend/qgslegendlayerfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ void QgsLegendLayerFile::table()
selectionChanged();

// etablish the necessary connections between the table and the vector layer
connect(mTableDisplay->table(), SIGNAL(selected(int)), mLyr.layer(), SLOT(select(int)));
connect(mTableDisplay->table(), SIGNAL(selectionRemoved()), mLyr.layer(), SLOT(removeSelection()));
connect(mTableDisplay->table(), SIGNAL(selected(int, bool)), mLyr.layer(), SLOT(select(int, bool)));
connect(mTableDisplay->table(), SIGNAL(selectionRemoved(bool)), mLyr.layer(), SLOT(removeSelection(bool)));
connect(mTableDisplay->table(), SIGNAL(repaintRequested()), mLyr.layer(), SLOT(triggerRepaint()));

QApplication::restoreOverrideCursor();
Expand Down
5 changes: 2 additions & 3 deletions src/app/qgsattributetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void QgsAttributeTable::handleChangedSelections()
if (lockKeyPressed == false)
{
//clear the list and evaluate the last selection
emit selectionRemoved();
emit selectionRemoved(false);
}
//if there is no current selection, there is nothing to do
if (currentSelection() == -1)
Expand All @@ -138,7 +138,7 @@ void QgsAttributeTable::handleChangedSelections()

for (int index = cselection.topRow(); index <= cselection.bottomRow(); index++)
{
emit selected(text(index, 0).toInt());
emit selected(text(index, 0).toInt(), false);
}

//don't send the signal repaintRequested() from here
Expand Down Expand Up @@ -652,7 +652,6 @@ void QgsAttributeTable::selectRowsWithId(const QgsFeatureIds& ids)
}

QObject::connect(this, SIGNAL(selectionChanged()), this, SLOT(handleChangedSelections()));

emit repaintRequested();
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsattributetable.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ class QgsAttributeTable:public Q3Table
signals:

/**Is emitted when a row was selected*/
void selected(int);
void selected(int, bool);
/**Is emitted when all rows have been deselected*/
void selectionRemoved();
void selectionRemoved(bool);
/**Is emmited when a set of related selection and deselection signals have been emitted*/
void repaintRequested();

Expand Down
1 change: 0 additions & 1 deletion src/app/qgsattributetabledisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ void QgsAttributeTableDisplay::invertSelection()

void QgsAttributeTableDisplay::removeSelection()
{
mLayer->removeSelection();
table()->clearSelection();
mLayer->triggerRepaint();
}
Expand Down
12 changes: 6 additions & 6 deletions src/core/qgsvectorlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer

/** Select features found within the search rectangle (in layer's coordinates) */
void select(QgsRect & rect, bool lock);

/** Select feature by its ID, optionally emit signal selectionChanged() */
void select(int featureId, bool emitSignal = TRUE);

/** Clear selection */
void removeSelection(bool emitSignal = TRUE);

/** Select not selected features and deselect selected ones */
void invertSelection();
Expand Down Expand Up @@ -403,6 +397,12 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer

public slots:

/** Select feature by its ID, optionally emit signal selectionChanged() */
void select(int featureId, bool emitSignal = TRUE);

/** Clear selection */
void removeSelection(bool emitSignal = TRUE);

void triggerRepaint();

/** Update the extents for the layer. This is necessary if features are
Expand Down

0 comments on commit 0c5c31a

Please sign in to comment.