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. How to update height of QStandardItem/Delegate?
Forum Updated to NodeBB v4.3 + New Features

How to update height of QStandardItem/Delegate?

Scheduled Pinned Locked Moved Unsolved General and Desktop
c++ qtdelegatesizehint
16 Posts 3 Posters 1.3k Views 2 Watching
  • 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.
  • J JonB
    25 Apr 2024, 14:55

    @StudentScripter I only know of making sizeHint() work for the correct state.

    S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 25 Apr 2024, 18:56 last edited by
    #3

    Hi,

    Seeing the size of the delegate, are you certain that you want to keep the editor locked in the cell ? It seems that it would be better shown outside of it.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    S 1 Reply Last reply 26 Apr 2024, 11:46
    0
    • S SGaist
      25 Apr 2024, 18:56

      Hi,

      Seeing the size of the delegate, are you certain that you want to keep the editor locked in the cell ? It seems that it would be better shown outside of it.

      S Offline
      S Offline
      StudentScripter
      wrote on 26 Apr 2024, 11:46 last edited by
      #4

      @SGaist Hey thanks for responding. :) What exatly do you mean with showing it outside? Isn't an delegate thought to show within one cell. Could may elaborate on what you mean and how to do it. That would be very helpful.

      My goal is a list like on the right side of Godot, but with rearangable dropdown menus. The menus shown switch depending on which element is clicked.
      2e6ce866-9307-4ce6-aa60-38a833298817-image.png

      1 Reply Last reply
      0
      • J JonB
        25 Apr 2024, 14:55

        @StudentScripter I only know of making sizeHint() work for the correct state.

        S Offline
        S Offline
        StudentScripter
        wrote on 26 Apr 2024, 11:48 last edited by
        #5

        @JonB I tryed that in a later version of my code but had no success. But i'll go for the error hunt. I update with new code when i really can't figure it out myself. :) Thanks Jon.

        S 1 Reply Last reply 26 Apr 2024, 12:02
        0
        • S StudentScripter
          26 Apr 2024, 11:48

          @JonB I tryed that in a later version of my code but had no success. But i'll go for the error hunt. I update with new code when i really can't figure it out myself. :) Thanks Jon.

          S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 26 Apr 2024, 12:02 last edited by
          #6

          When the editor is big and complex, it might be better to have it off cell.

          That said, I think you might be taking the wrong approach here. The inspector on the right seems to be a full fledged widget not a delegate.

          I see a combo-box at the top which is likely a selector that will trigger the selection of the current item to show. Once selected, the inspector will be loaded with the detail for this item. This could be accomplished with a QDataWidgetMapper.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          S 1 Reply Last reply 26 Apr 2024, 12:26
          0
          • S SGaist
            26 Apr 2024, 12:02

            When the editor is big and complex, it might be better to have it off cell.

            That said, I think you might be taking the wrong approach here. The inspector on the right seems to be a full fledged widget not a delegate.

            I see a combo-box at the top which is likely a selector that will trigger the selection of the current item to show. Once selected, the inspector will be loaded with the detail for this item. This could be accomplished with a QDataWidgetMapper.

            S Offline
            S Offline
            StudentScripter
            wrote on 26 Apr 2024, 12:26 last edited by
            #7

            @SGaist So no listview or widget? But i want to have many of such modules which should be reorderable by drag and drop, so i thought i could harness the build in dnd functionality of qlistview or qlistwidget.

            S 1 Reply Last reply 26 Apr 2024, 19:02
            0
            • S StudentScripter
              26 Apr 2024, 12:26

              @SGaist So no listview or widget? But i want to have many of such modules which should be reorderable by drag and drop, so i thought i could harness the build in dnd functionality of qlistview or qlistwidget.

              S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 26 Apr 2024, 19:02 last edited by
              #8

              @StudentScripter can you explain what you mean by module ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              S 2 Replies Last reply 27 Apr 2024, 10:51
              0
              • S SGaist
                26 Apr 2024, 19:02

                @StudentScripter can you explain what you mean by module ?

                S Offline
                S Offline
                StudentScripter
                wrote on 27 Apr 2024, 10:51 last edited by
                #9

                @SGaist One Dropdown section with all the widgets that are into such a dropdown.

                So for example modul1/dropdown1:
                -4 lineedits for width, height, posx, posy

                modul2/dropdown2:
                -checkbox for hiding elements in the scene
                -lineedit for setting the name of the item ins scene

                and so on you get the point. :) Have a nice weekend.

                1 Reply Last reply
                0
                • S SGaist
                  26 Apr 2024, 19:02

                  @StudentScripter can you explain what you mean by module ?

                  S Offline
                  S Offline
                  StudentScripter
                  wrote on 29 Apr 2024, 19:28 last edited by
                  #10

                  @SGaist Or should i use indiviual widgets and implement drag and drop within a layout? How to make this efficient? Setting all widgets not used parent to nullptr? Or what should it do?

                  S 1 Reply Last reply 29 Apr 2024, 20:45
                  0
                  • S StudentScripter
                    29 Apr 2024, 19:28

                    @SGaist Or should i use indiviual widgets and implement drag and drop within a layout? How to make this efficient? Setting all widgets not used parent to nullptr? Or what should it do?

                    S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 29 Apr 2024, 20:45 last edited by
                    #11

                    @StudentScripter Did you consider having a "edit mode" where you move things around ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    S 1 Reply Last reply 30 Apr 2024, 07:15
                    0
                    • S SGaist
                      29 Apr 2024, 20:45

                      @StudentScripter Did you consider having a "edit mode" where you move things around ?

                      S Offline
                      S Offline
                      StudentScripter
                      wrote on 30 Apr 2024, 07:15 last edited by
                      #12

                      @SGaist Preferabily i would like to not have an edit mode, if possible. But whats your idea with an edit mode?

                      Also if not using that. Would implementing drag and drop inside they layout be the way or is there any other better methode? Thank you very much.

                      S 1 Reply Last reply 30 Apr 2024, 19:59
                      0
                      • S StudentScripter
                        30 Apr 2024, 07:15

                        @SGaist Preferabily i would like to not have an edit mode, if possible. But whats your idea with an edit mode?

                        Also if not using that. Would implementing drag and drop inside they layout be the way or is there any other better methode? Thank you very much.

                        S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 30 Apr 2024, 19:59 last edited by
                        #13

                        @StudentScripter with the edit mode, you can make your widgets look a bit like a dashboard where you move things around a bit like on iOS when you long press on the screen and things start wobbling. You can then move them around and once it's done you can again use them.

                        As for your second question, it's rather at the containing widget level that you would do that. You would move things around in the layout but it's not the layout that is responsible for the D&D part as layouts do not have a "body".

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        S 1 Reply Last reply 1 May 2024, 06:39
                        0
                        • S SGaist
                          30 Apr 2024, 19:59

                          @StudentScripter with the edit mode, you can make your widgets look a bit like a dashboard where you move things around a bit like on iOS when you long press on the screen and things start wobbling. You can then move them around and once it's done you can again use them.

                          As for your second question, it's rather at the containing widget level that you would do that. You would move things around in the layout but it's not the layout that is responsible for the D&D part as layouts do not have a "body".

                          S Offline
                          S Offline
                          StudentScripter
                          wrote on 1 May 2024, 06:39 last edited by
                          #14

                          @SGaist Yeah i primarily meant drag and drop within the qscrollarea where the layout is located. But is this really my best option? What to keep in mind when having many widgets? Or is removing the widgets that are currently not supposed to be shown from the layout enough? Have good 1st may.

                          S 1 Reply Last reply 1 May 2024, 18:18
                          0
                          • S StudentScripter
                            1 May 2024, 06:39

                            @SGaist Yeah i primarily meant drag and drop within the qscrollarea where the layout is located. But is this really my best option? What to keep in mind when having many widgets? Or is removing the widgets that are currently not supposed to be shown from the layout enough? Have good 1st may.

                            S Offline
                            S Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on 1 May 2024, 18:18 last edited by
                            #15

                            @StudentScripter Things to keep in mind is that if you have a QScrollArea that contains the equivalent of multiple screens worth of widgets, then it won't be nice for your users.

                            You should start by drawing your widgets and then think about how many are necessary, how they should be shown, etc. And if possible discuss that with people from your target audience.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            S 1 Reply Last reply 4 May 2024, 11:16
                            1
                            • S SGaist
                              1 May 2024, 18:18

                              @StudentScripter Things to keep in mind is that if you have a QScrollArea that contains the equivalent of multiple screens worth of widgets, then it won't be nice for your users.

                              You should start by drawing your widgets and then think about how many are necessary, how they should be shown, etc. And if possible discuss that with people from your target audience.

                              S Offline
                              S Offline
                              StudentScripter
                              wrote on 4 May 2024, 11:16 last edited by
                              #16

                              @SGaist Thank you very much. One last questions before closing this thread:

                              1. Does using setListWigetItem (QListWidget) make an difference in performance compared to just using the widgets inside a scrollarea or is the overhead the same?

                              Have a nice day! :)

                              1 Reply Last reply
                              0

                              12/16

                              30 Apr 2024, 07:15

                              • Login

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