Qt QpushButton Delete Icon
-
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?
-
Just how many rows? Thousands? Millions?
ISTM you have 3 choices, if adding a
QPushButtonto 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
-
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?
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) -
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) -
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
-
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
@srimuthu
Not sure anyone can understand from this. If you have aQDialogI 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 aQDialogButtonBoxthat is a different thing, only meant for putting on aQDialog. If you are using aQDialogand putting widgets onto that then, yes, you do need to put a layout on it. -
-
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