ich habe 2 Listen in einen GridLayout und will dass diese immer die volle Fenstergröße haben. Horizontal klappt´s aber vertical nicht :-/
hier ein ausschnitt vom Code:
Code: Alles auswählen
QWidget* widget = new QWidget(this);
setCentralWidget(widget);
// Widgets erstellen
this->nameListWidget = new QListWidget(widget);
this->fileListWidget = new QListWidget(widget);
this->nameLineEdit = new QLineEdit(widget);
QPushButton *buttonOk = new QPushButton(QApplication::translate("childwidget", "Ok"), widget);
connect(buttonOk,SIGNAL(clicked()),this,SLOT(ok()));
// Layouts
QGridLayout *gridLayout = new QGridLayout();
QVBoxLayout *mainLayout = new QVBoxLayout();
QHBoxLayout *lineLayout = new QHBoxLayout();
lineLayout->addWidget(nameLineEdit);
lineLayout->addWidget(buttonOk);
this->fileListWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
this->nameListWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
this->fileListWidget->setDragDropMode(QAbstractItemView::InternalMove);
this->nameListWidget->setDragDropMode(QAbstractItemView::InternalMove);
gridLayout->addWidget(this->fileListWidget,0,0,-1,10,Qt::AlignTop);
gridLayout->addWidget(this->nameListWidget,0,10,-1,10,Qt::AlignTop);
mainLayout->addLayout(lineLayout);
mainLayout->addLayout(gridLayout);
widget->setLayout(mainLayout);
widget->show();