5 Dyalog::Dyalog(QWidget *parent, bool showButtons):
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);
36 boxLayout->addWidget(buttonBox);
42 scroller->setWidget(content);
44 scroller->setWidgetResizable(true);
47 QAction *closeAction = new QAction(tr("Close"), this);
48 closeAction->setSoftKeyRole(QAction::NegativeSoftKey);
49 connect(closeAction, SIGNAL(triggered()), this, SLOT(reject()));
50 addAction(closeAction);
51 #endif // Q_OS_SYMBIAN
54 void Dyalog::addWidget(QWidget *widget)
56 contentLayout->addWidget(widget);
59 void Dyalog::addStretch(int stretch)
61 contentLayout->addStretch(stretch);
64 void Dyalog::addButton(QPushButton *button, QDialogButtonBox::ButtonRole role)
66 buttonBox->addButton(button, role);
69 QPushButton *Dyalog::addButton(QDialogButtonBox::StandardButton button)
71 return buttonBox->addButton(button);