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::CancelSoftKey);
49 connect(closeAction, SIGNAL(triggered()), this, SLOT(reject()));
50 QList<QAction *> softKeys;
51 softKeys.append(closeAction);
52 setSoftKeys(softKeys);
53 #endif // Q_OS_SYMBIAN
56 void Dyalog::addWidget(QWidget *widget)
58 contentLayout->addWidget(widget);
61 void Dyalog::addStretch(int stretch)
63 contentLayout->addStretch(stretch);
66 void Dyalog::addButton(QPushButton *button, QDialogButtonBox::ButtonRole role)
68 buttonBox->addButton(button, role);
71 QPushButton *Dyalog::addButton(QDialogButtonBox::StandardButton button)
73 return buttonBox->addButton(button);