I want to create a multiple selection box (like you can see when you click on the processing saga tool "Merge vector layers") with the Qt Designer.
-
Your question is very broad, can you narrow the focus? What specific aspect do you need help with? What have you tried?– artwork21Commented Sep 27, 2016 at 12:28
-
I'm writing my 1st python script. The thing is that I have more than one vector layer to select (for further data processing). I was able to create a selecting box (just for one layer) on the Qt designer. Now I trying to find a way to create (or maybe coding with python) a multi selection box like you can see in the screenshot.– PimpelCommented Sep 27, 2016 at 12:32
1 Answer
In QT you may use the QList Widget. There are various selection options under selectionMode setting you may pick from to enable mutli text selection, see graphic below:
For selecting features or all features in a layer you first need to create QGIS Vector layer that references the layer on disk or in a database, and then perform the selection query. There are many posts on this site and others (search for pyqgis create vector layer, pyqgis select layer or select feature).
-
OK I found this. But I cannot figure out how to get all layers (point layers) inside the box. I changed the pic in my question box.– PimpelCommented Sep 27, 2016 at 12:45
-
1If the layers are in a map already you can loop through the layers in the layer panel and add the layer name text to the widget. I would recommend first learning how to add any text to the widget and then how to get all layer names in a map. If you have a specific question about coding you will need to post what you've tried in your question and note where you are stuck before others can assist. Commented Sep 27, 2016 at 12:52
-
The layers I want to select are already given in QGis. I have to open them manually. These layers should be selectable in the multi selection box.– PimpelCommented Sep 27, 2016 at 12:54