I am creating a plugin which shows the list of location of vector/raster layers. I am using QTableWidget
to show the data. When I select one row/cell and click a QPushButton
it opens the specific vector/ratser layers in the QGIS. I use the following code to retrieve the data from the selected cell:
row = self.tableWidget.currentRow()
path = (self.tableWidget.item(row,3).text())
How do I select multiple cells at the same time to open multiple files?
Best Answer
You could try something like:
Assuming that the cells containing the file paths are in the 4th column (index 3) of your table widget. With this method, you can either select the entire row or just the cell containing the path. The
paths
variable will now be a list containing all path strings from the selected rows or cells.