5 Dyalog::Dyalog(QWidget *parent) :
6 QDialog(parent, Qt::Dialog | Qt::WindowTitleHint |
7 Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint)
9 scroller = new QScrollArea(this);
12 scroller->setProperty("FingerScrollable", true);
13 scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
15 scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
17 scroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
18 scroller->setFrameStyle(QFrame::NoFrame);
20 content = new QWidget(scroller);
21 contentLayout = new QVBoxLayout(content);
22 contentLayout->setMargin(0);
23 content->setLayout(contentLayout);
25 QBoxLayout *boxLayout;
26 QRect screenGeometry = QApplication::desktop()->screenGeometry();
27 if (screenGeometry.width() < screenGeometry.height()) {
28 buttonBox = new QDialogButtonBox(Qt::Horizontal, this);
29 boxLayout = new QVBoxLayout(this);
31 buttonBox = new QDialogButtonBox(Qt::Vertical, this);
32 boxLayout = new QHBoxLayout(this);
34 boxLayout->addWidget(scroller);
35 boxLayout->addWidget(buttonBox);
38 scroller->setWidget(content);
40 scroller->setWidgetResizable(true);
43 void Dyalog::addWidget(QWidget *widget)
45 contentLayout->addWidget(widget);
48 void Dyalog::addStretch(int stretch)
50 contentLayout->addStretch(stretch);
53 void Dyalog::addButton(QPushButton *button, QDialogButtonBox::ButtonRole role)
55 buttonBox->addButton(button, role);
58 QPushButton *Dyalog::addButton(QDialogButtonBox::StandardButton button)
60 return buttonBox->addButton(button);