Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Insert different widgets listwidget or listview?
QtWS25 Last Chance

Insert different widgets listwidget or listview?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt c++qlistview
4 Posts 2 Posters 448 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    StudentScripter
    wrote on 18 Apr 2024, 14:02 last edited by
    #1

    Hello i want to insert a few hundred widgets harnessing the drag and drop power qlistview/qlistwidget. But i read that setlistWidgetItem is really a bad idea for many items so i thought about using QStyledItemDelegate. However the widgets im inserting are rather complex, so defining an individual paint for all of them would be really really tedious. So here my question is there any better way or a way to automate the painting?

    More info according to the widgets:
    -they all slighly vary but in general its a qformlayout with:
    "Label": Widget
    "Label2": OtherWidget
    .... and so on

    I want something like in QT Design Studio but with dragable modules:
    bc42aef7-d770-4079-aaab-fede14bd174c-image.png

    P 1 Reply Last reply 18 Apr 2024, 15:14
    0
    • S StudentScripter
      18 Apr 2024, 14:02

      Hello i want to insert a few hundred widgets harnessing the drag and drop power qlistview/qlistwidget. But i read that setlistWidgetItem is really a bad idea for many items so i thought about using QStyledItemDelegate. However the widgets im inserting are rather complex, so defining an individual paint for all of them would be really really tedious. So here my question is there any better way or a way to automate the painting?

      More info according to the widgets:
      -they all slighly vary but in general its a qformlayout with:
      "Label": Widget
      "Label2": OtherWidget
      .... and so on

      I want something like in QT Design Studio but with dragable modules:
      bc42aef7-d770-4079-aaab-fede14bd174c-image.png

      P Online
      P Online
      Pl45m4
      wrote on 18 Apr 2024, 15:14 last edited by
      #2

      @StudentScripter said in Insert different widgets listwidget or listview?:

      However the widgets im inserting are rather complex, so defining an individual paint for all of them would be really really tedious

      When you dont want to do this, another option might be creating your own layout/widget, where you can drag+move child widgets at runtime.

      Like here
      But there is also suggested to better use a model/view instead... so I guess it's still the best/cleanest solution. I mean, you just have to do it once, if all widgets are similar.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      S 1 Reply Last reply 18 Apr 2024, 15:25
      1
      • P Pl45m4
        18 Apr 2024, 15:14

        @StudentScripter said in Insert different widgets listwidget or listview?:

        However the widgets im inserting are rather complex, so defining an individual paint for all of them would be really really tedious

        When you dont want to do this, another option might be creating your own layout/widget, where you can drag+move child widgets at runtime.

        Like here
        But there is also suggested to better use a model/view instead... so I guess it's still the best/cleanest solution. I mean, you just have to do it once, if all widgets are similar.

        S Offline
        S Offline
        StudentScripter
        wrote on 18 Apr 2024, 15:25 last edited by StudentScripter
        #3

        @Pl45m4 But is creating widgets in layouts really more efficient than setlistwidgetItem()? I mean it still would be the same amount of widgets.

        However could listwidget still be an option if just add all the widgets on startup to the listwidget and than just call remove() and reuse the widgets later? I guess that wouldn't be to taxating right?

        Regarding the delegate, yes the widgets are similar but how to setup the paint event that flexible?

        Also thank you for trying to help me. :) Have a nice day.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          StudentScripter
          wrote on 19 Apr 2024, 15:17 last edited by
          #4

          bumping this up. Anyone can hint me how to mass paint controls?

          1 Reply Last reply
          0

          4/4

          19 Apr 2024, 15:17

          • Login

          • Login or register to search.
          4 out of 4
          • First post
            4/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved