5 Dyalog::Dyalog(QWidget *parent, bool showButtons_):
6 QDialog(parent, Qt::Dialog | Qt::WindowTitleHint |
7 Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint),
8 showButtons(showButtons_)
10 scroller = new QScrollArea(this);
13 scroller->setProperty("FingerScrollable", true);
14 scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
16 scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
18 scroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
19 scroller->setFrameStyle(QFrame::NoFrame);
21 content = new QWidget(scroller);
22 contentLayout = new QVBoxLayout(content);
23 contentLayout->setMargin(0);
24 content->setLayout(contentLayout);
26 QBoxLayout *boxLayout;
27 QRect screenGeometry = QApplication::desktop()->screenGeometry();
28 if (screenGeometry.width() < screenGeometry.height()) {
31 buttonBox = new QDialogButtonBox(Qt::Horizontal, this);
34 boxLayout = new QVBoxLayout(this);
38 buttonBox = new QDialogButtonBox(Qt::Vertical, this);
41 boxLayout = new QHBoxLayout(this);
43 boxLayout->addWidget(scroller);
46 boxLayout->addWidget(buttonBox);
51 scroller->setWidget(content);
53 scroller->setWidgetResizable(true);
56 QAction *closeAction = new QAction(tr("Back"), this);
57 closeAction->setSoftKeyRole(QAction::NegativeSoftKey);
58 connect(closeAction, SIGNAL(triggered()), this, SLOT(reject()));
59 addAction(closeAction);
61 #endif // Q_OS_SYMBIAN
64 void Dyalog::addWidget(QWidget *widget)
66 contentLayout->addWidget(widget);
69 void Dyalog::addStretch(int stretch)
71 contentLayout->addStretch(stretch);
74 void Dyalog::addButton(const QString &label, QObject *receiver,
75 const char *slot, QDialogButtonBox::ButtonRole role)
83 QAction *menuAction = new QAction(tr("Options"), this);
84 menuAction->setSoftKeyRole(QAction::PositiveSoftKey);
85 menu = new QMenu(this);
86 menuAction->setMenu(menu);
88 QAction *action = new QAction(label, this);
89 connect(action, SIGNAL(triggered()), receiver, slot);
90 menu->addAction(action);
92 QPushButton *button = new QPushButton(label, this);
93 connect(button, SIGNAL(clicked()), receiver, slot);
94 buttonBox->addButton(button, role);
95 #endif // Q_OS_SYMBIAN
102 foreach (QWidget *w, QApplication::allWidgets()) {
103 w->setContextMenuPolicy(Qt::NoContextMenu);
111 return QDialog::exec();
114 #endif // Q_OS_SYMBIAN