Wednesday, 15 February 2012

qt - Stop QWidgets from stacking on top of each other dynamically -


I create all my QWidget s with code and put them in a tab Although all widgets are at the top of each other, is there a way to move widgets to dynamic? How much is it possible to design a widget to dial in the widget? According to the widget - I know that they have to move with move () , which can be difficult to keep track of, but when more objects are added.

  QTabWidget * MainWindow :: CreateTabWidget () {QTabWidget * tabWidget = new QTabWidget (ui- & gt; centralviewjet); TabWidget-> Settests (size->) width (), this-> size (). Height () - 40); QWidget * Tab = new QWidget (); QLabel * label = new QLabel ("Sektionnamn", tab); QLineEdit * line = New QLineEdit (tab); Line-> This step (0,20); TabWidget-> AddTab (Tab, "Tab 1"); Return tabwith; }  

Use Qualify:

  QLabel * Label = new QLabel ("Sektionnamn"); QLineEdit * line = new QLineEdit (); QHBoxLayout * Layout = New QHBoxLayout; Layout & gt; AddWidget (label); Layout & gt; AddWidget (line); Tab- & gt; SetLayout (layout);  

No comments:

Post a Comment