3

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.

enter image description here

enter image description here

2
  • Your question is very broad, can you narrow the focus? What specific aspect do you need help with? What have you tried?
    – artwork21
    Commented 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.
    – Pimpel
    Commented Sep 27, 2016 at 12:32

1 Answer 1

3

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:

enter image description here

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).

3
  • 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.
    – Pimpel
    Commented Sep 27, 2016 at 12:45
  • 1
    If 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.
    – artwork21
    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.
    – Pimpel
    Commented Sep 27, 2016 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.