user interface - How to group Widgets in my Qt app? -


Easy question (I hope!). This is my first Qt App and I am struggling with a group of elements at my Gui.

I need about 8 standard quadets (label, edit, button) for each file object, which can be

so eventually I have all the files inside QVBoxLayout inside QScrollArea Objects have to be inserted.

But first of all I need to group them in some way. I realized that I could drag them with so many offsets on my main window, but it would not be very elegant.

Do I have my file object any kind of canvas and everyone keeps a set of these widgets?

Thanks for any guidance.

A can be layout in QWidget and other widgets can be You can do the QWidget subclass, whatever you need (with a layout) and use the place you want. Or better (I think that depending on your requirements) is directly QScrollArea subclass, add whatever you need with layout, and then you can leave it in bulk:

< Pre> Class MyWidget: Public QScrollArea {Q_OBJECT Public: MyWidget (Const. Caststring and Filename, QWidget * parent = 0); }; MyWidget :: MyWidget (Constest & File Name, QWidget * Parents): QScrollArea (Parents) {setWidgetResizable (true); QWidget * central = new QWidget (this); SetWidget (central); QVBoxLayout * layout = new QVBoxLayout (central); Central- & gt; SetLayout (layout); Layout-> Advisive (new cullabel (filename, central)); Layout-> Adwizat (new clenith ("Editor 1", central)); Layout-> Advejet (new coolen ("Editor 2", central)); Layout-> Advidate (new QLineEdit ("Editor 3", central)); Layout-> Edgejet (new coolen ("Editor 4", central)); Layout-> Advejet (new quinnitid ("Editor 5", central)); Layout & gt; AddStretch (); }

Then to use it:

  MyWidget * widget1 = New MyWidget ("/ file1", parent); MyViewget * Widget2 = New MyWidt ("/ file2", parent); Layout & gt; AddWidget (WIDGET1); Layout & gt; AddWidget (WIDGET2);  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -