Is there a way to instantiate e.g. a tab widget ( http://doc.qt.nokia.com/qtabwidget.html ) from script and have a layoutmanager do the sizing etc.? Something like that:
Code: Select all
var D = new Dialog();
D.newTab(foo);
D.add(bar);
Moderator: andrew
Code: Select all
var D = new Dialog();
D.newTab(foo);
D.add(bar);
Code: Select all
// base of a dialogue that contains a tab widget
var tabDialog = new QDialog(appWin);
var tabWidget = new QTabWidget();
// first tab: widget and layout
var T1W = new QWidget();
var T1L = new QVBoxLayout();
// first row in first tab: widget and layout
var T11W = new QWidget();
var T11L = new QHBoxLayout();
var T11WL = new QLabel("Foo 11");
var T11WE = new QLineEdit();
T11L.addWidget(T11WL, 0, 0);
T11L.addWidget(T11WE, 0, 0);
T11W.setLayout(T11L);
// finish tab
T1L.addWidget(T11W, 0, 0);
T1W.setLayout(T1L);
tabWidget.addTab(T1W, "Tab &1");
// dialogue buttons
var buttonBox = new QDialogButtonBox();
buttonBox.addButton(QDialogButtonBox.Open);
buttonBox.addButton(QDialogButtonBox.Ok);
buttonBox.addButton(QDialogButtonBox.Cancel);
// finish dialogue
var dialogLayout = new QVBoxLayout();
dialogLayout.addWidget(tabWidget, 0, 0);
dialogLayout.addWidget(buttonBox, 0, 0);
tabDialog.setLayout(dialogLayout);
tabDialog.setWindowTitle("bar");
tabDialog.exec();