Skip to content

Commit 0c5c31a

Browse files
author
mhugent
committed
Reenabled selection from attribute table. Still some problems with 'invertSelection'
git-svn-id: http://svn.osgeo.org/qgis/trunk@6672 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5f9bb67 commit 0c5c31a

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

src/app/legend/qgslegendlayerfile.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ void QgsLegendLayerFile::table()
255255
selectionChanged();
256256

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

262262
QApplication::restoreOverrideCursor();

src/app/qgsattributetable.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void QgsAttributeTable::handleChangedSelections()
126126
if (lockKeyPressed == false)
127127
{
128128
//clear the list and evaluate the last selection
129-
emit selectionRemoved();
129+
emit selectionRemoved(false);
130130
}
131131
//if there is no current selection, there is nothing to do
132132
if (currentSelection() == -1)
@@ -138,7 +138,7 @@ void QgsAttributeTable::handleChangedSelections()
138138

139139
for (int index = cselection.topRow(); index <= cselection.bottomRow(); index++)
140140
{
141-
emit selected(text(index, 0).toInt());
141+
emit selected(text(index, 0).toInt(), false);
142142
}
143143

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

654654
QObject::connect(this, SIGNAL(selectionChanged()), this, SLOT(handleChangedSelections()));
655-
656655
emit repaintRequested();
657656
}
658657

src/app/qgsattributetable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ class QgsAttributeTable:public Q3Table
157157
signals:
158158

159159
/**Is emitted when a row was selected*/
160-
void selected(int);
160+
void selected(int, bool);
161161
/**Is emitted when all rows have been deselected*/
162-
void selectionRemoved();
162+
void selectionRemoved(bool);
163163
/**Is emmited when a set of related selection and deselection signals have been emitted*/
164164
void repaintRequested();
165165

src/app/qgsattributetabledisplay.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ void QgsAttributeTableDisplay::invertSelection()
226226

227227
void QgsAttributeTableDisplay::removeSelection()
228228
{
229-
mLayer->removeSelection();
230229
table()->clearSelection();
231230
mLayer->triggerRepaint();
232231
}

src/core/qgsvectorlayer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
115115

116116
/** Select features found within the search rectangle (in layer's coordinates) */
117117
void select(QgsRect & rect, bool lock);
118-
119-
/** Select feature by its ID, optionally emit signal selectionChanged() */
120-
void select(int featureId, bool emitSignal = TRUE);
121-
122-
/** Clear selection */
123-
void removeSelection(bool emitSignal = TRUE);
124118

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

404398
public slots:
405399

400+
/** Select feature by its ID, optionally emit signal selectionChanged() */
401+
void select(int featureId, bool emitSignal = TRUE);
402+
403+
/** Clear selection */
404+
void removeSelection(bool emitSignal = TRUE);
405+
406406
void triggerRepaint();
407407

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

0 commit comments

Comments
 (0)