#include #include #include #include #include #include #include #include #include #include #include class A : public QWidget { Q_OBJECT public: A(QWidget *parent = 0) : QWidget(parent) { setWindowTitle("Problematic"); /* QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(new QLabel("List")); layout->addWidget(new QListWidget); QPushButton *quitBtn = new QPushButton("Quit"); connect(quitBtn, SIGNAL(clicked()), qApp, SLOT(quit())); layout->addWidget(quitBtn); */ /**/ QComboBox *accountCombo = new QComboBox; QLineEdit *toEdit = new QLineEdit; QLineEdit *subjectEdit = new QLineEdit; QLabel *accountLabel = new QLabel(tr("Account")); accountLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); QLabel *toLabel = new QLabel(tr("To")); toLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); QLabel *subjectLabel = new QLabel(tr("Subject")); subjectLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); QGridLayout *metaDataLayout = new QGridLayout; metaDataLayout->setContentsMargins(0, 0, 0, 0); metaDataLayout->addWidget(accountLabel, 0, 0); metaDataLayout->setAlignment(accountLabel, Qt::AlignRight); metaDataLayout->addWidget(toLabel, 1, 0); metaDataLayout->setAlignment(toLabel, Qt::AlignRight); /* metaDataLayout->addWidget(subjectLabel, 2, 0); metaDataLayout->setAlignment(subjectLabel, Qt::AlignRight); */ metaDataLayout->addWidget(accountCombo, 0, 1); metaDataLayout->addWidget(toEdit, 1, 1); /* metaDataLayout->addWidget(subjectEdit, 2, 1); */ QPushButton *removeButton = new QPushButton(tr("Remove")); QPushButton *addButton = new QPushButton(tr("Add")); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->setContentsMargins(0, 0, 0, 0); buttonLayout->addWidget(addButton); buttonLayout->addWidget(removeButton); QListWidget *attachmentsList = new QListWidget; QVBoxLayout *attachmentsLayout = new QVBoxLayout; attachmentsLayout->setContentsMargins(0, 0, 0, 0); attachmentsLayout->addWidget(attachmentsList); attachmentsLayout->addLayout(buttonLayout); QGroupBox *attachmentsGroup = new QGroupBox(tr("Attachments")); attachmentsGroup->setLayout(attachmentsLayout); QTextEdit *textEdit = new QTextEdit; QPushButton *sendButton = new QPushButton(tr("Send")); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->addLayout(metaDataLayout, 0); mainLayout->addWidget(textEdit, 2); mainLayout->addWidget(attachmentsGroup, 1); mainLayout->addWidget(sendButton, 0); mainLayout->setAlignment(sendButton, Qt::AlignRight); /**/ } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); A a; a.showMaximized(); return app.exec(); } #include "main.moc"