PDA

View Full Version : QWidget



gyre
20th November 2007, 17:44
Hi I need an advice how to design a widget that would do something like this:
It would have 4 buttons...OK,Cancel, RemoveMask and AddNewMask
And it would contain a 2line edits with 2 labels describing it plus a checkbox...
Button AddNewMask would add a new triple of mentioned widgets(2 line edits and checkbox) and button RemoveMask would remove checked triple from that widget view...
So basically it would enable adding mask and removing masks when particular mask is checked...
I dunno whats the best way to do that...
Thanks for any advices ! :)

jacek
20th November 2007, 18:37
You can use QTableView with a custom model or you can create a custom widget that represents such triplet and add them on the fly to a QGroupBox.

gyre
21st November 2007, 02:04
do you mean by that description that I need QTableView?? what about that checkbox ?
I think I need a Dialog...but dunno how can I add widgets to it on fly...If I create a GroupBox I need to set a layout that would actually contain that triplet....but theres a BIG problem with adding a layout to already existing layout since it gets messed up when the dialog changes its size by user...thats just horrible thing to do :(

jacek
21st November 2007, 22:30
do you mean by that description that I need QTableView?? what about that checkbox ?
You can have a checkable item in table view.


I think I need a Dialog...but dunno how can I add widgets to it on fly...
It's quite simple. You just have to create them, add them to a layout and finally show them.


but theres a BIG problem with adding a layout to already existing layout since it gets messed up when the dialog changes its size by user...thats just horrible thing to do :(
I don't see any problem. You can add those custom widgets to a QScrollArea. This way dialog's size won't change.