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. Qt QpushButton Delete Icon
Forum Updated to NodeBB v4.3 + New Features

Qt QpushButton Delete Icon

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 882 Views 1 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.
  • S Offline
    S Offline
    srimuthu
    wrote on last edited by
    #1

    Hi, I create a table with many rows, I want to attach a Action column with delete button icon in each row cell ending column, But i attach a Qpushbtton in each row my memory get increased very high, what should i do to avoid that memory increasing ,there is any another way avilable to create a delete icon?

    Pl45m4P 1 Reply Last reply
    0
    • JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      Just how many rows? Thousands? Millions?

      ISTM you have 3 choices, if adding a QPushButton to each row is really throwing your memory:

      • Only add to visible rows, and dynamically adjust as user scrolls.
      • Do button or link for delete column as a delegate, with a button drawn but as a widget.
      • Do the button(s) outside the table rows and have it act on the selected row, e.g. https://stackoverflow.com/questions/19012450/qt-delete-selected-row-in-qtableview
      1 Reply Last reply
      2
      • S Offline
        S Offline
        srimuthu
        wrote on last edited by
        #3

        thousands or thousands above rows, Thank you for your response shall i
        choose delagate for that?

        1 Reply Last reply
        0
        • S srimuthu

          Hi, I create a table with many rows, I want to attach a Action column with delete button icon in each row cell ending column, But i attach a Qpushbtton in each row my memory get increased very high, what should i do to avoid that memory increasing ,there is any another way avilable to create a delete icon?

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by Pl45m4
          #4

          @srimuthu

          That's why delegates exist... because you don't want hundreds, thousands or even more active widgets in your table cells.
          Delegates, when cell is editable, provide an editor only if the cell was activated/clicked and don't render 5000 interactive widgets at all time. See @JonB second point.

          Edit:

          Or you add checkbox delegates (via item->setCheckable(true)) to your table and one button below to remove all selected rows.
          (some database editors and email frontends use this kind of approach. You selected one or more items, choose an action, done)


          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
          4
          • Pl45m4P Pl45m4

            @srimuthu

            That's why delegates exist... because you don't want hundreds, thousands or even more active widgets in your table cells.
            Delegates, when cell is editable, provide an editor only if the cell was activated/clicked and don't render 5000 interactive widgets at all time. See @JonB second point.

            Edit:

            Or you add checkbox delegates (via item->setCheckable(true)) to your table and one button below to remove all selected rows.
            (some database editors and email frontends use this kind of approach. You selected one or more items, choose an action, done)

            S Offline
            S Offline
            srimuthu
            wrote on last edited by
            #5

            Thank you, I think this check box delegate is solving my problem delete icon problem

            1 Reply Last reply
            0
            • S Offline
              S Offline
              srimuthu
              wrote on last edited by
              #6

              And i have one more , I create a Dialog box to add a personal information form , when i drag the form to another window , it not get responisve my linedits fields are disappera, after i apply a grid layout for dialog box and gtoup box in the diaolg it get responsive but , there is some gaps and some line edits are aligned small size , it cannot creat for my expectation ui it allign weird

              JonBJ 1 Reply Last reply
              0
              • S srimuthu

                And i have one more , I create a Dialog box to add a personal information form , when i drag the form to another window , it not get responisve my linedits fields are disappera, after i apply a grid layout for dialog box and gtoup box in the diaolg it get responsive but , there is some gaps and some line edits are aligned small size , it cannot creat for my expectation ui it allign weird

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #7

                @srimuthu
                Not sure anyone can understand from this. If you have a QDialog I don't know what "i drag the form to another window" means, if you are making it a widget on another widget/form then don't, dialogs are meant to be their own windows not part of something else. If you mean a QDialogButtonBox that is a different thing, only meant for putting on a QDialog. If you are using a QDialog and putting widgets onto that then, yes, you do need to put a layout on it.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  srimuthu
                  wrote on last edited by
                  #8

                  sorry, thats my fault, I have Qdialog inside the Qdialog i have many line edits , when i run on my window it look nice but when i drag the dialog to another screen monitor , the dialog and line edits get shrink not look responsive, that my problem

                  JonBJ 1 Reply Last reply
                  0
                  • S srimuthu

                    sorry, thats my fault, I have Qdialog inside the Qdialog i have many line edits , when i run on my window it look nice but when i drag the dialog to another screen monitor , the dialog and line edits get shrink not look responsive, that my problem

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #9

                    @srimuthu
                    Oh I don't know about multiple screens. Is the other screen the same or a different resolution than the first one?

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      srimuthu
                      wrote on last edited by
                      #10

                      ok, Thank you for your response

                      1 Reply Last reply
                      0

                      • Login

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