6 #include "flickcharm.h"
9 Dyalog::Dyalog(QWidget *parent, bool showButtons_):
10 QDialog(parent, Qt::Dialog | Qt::WindowTitleHint |
11 Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint),
12 showButtons(showButtons_)
14 scroller = new QScrollArea(this);
16 #if defined(Q_WS_MAEMO_5)
17 scroller->setProperty("FingerScrollable", true);
18 scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
19 #elif defined(Q_OS_SYMBIAN)
20 FlickCharm *charm = new FlickCharm(this);
21 charm->activateOn(scroller);
23 scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
25 scroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
26 scroller->setFrameStyle(QFrame::NoFrame);
28 content = new QWidget(scroller);
29 contentLayout = new QVBoxLayout(content);
30 contentLayout->setMargin(0);
31 content->setLayout(contentLayout);
33 QBoxLayout *boxLayout;
34 QRect screenGeometry = QApplication::desktop()->screenGeometry();
35 if (screenGeometry.width() < screenGeometry.height()) {
38 buttonBox = new QDialogButtonBox(Qt::Horizontal, this);
41 boxLayout = new QVBoxLayout(this);
45 buttonBox = new QDialogButtonBox(Qt::Vertical, this);
48 boxLayout = new QHBoxLayout(this);
50 boxLayout->addWidget(scroller);
53 boxLayout->addWidget(buttonBox);
58 scroller->setWidget(content);
60 scroller->setWidgetResizable(true);
62 #if defined(Q_OS_SYMBIAN)
63 QAction *closeAction = new QAction(tr("Back"), this);
64 closeAction->setSoftKeyRole(QAction::NegativeSoftKey);
65 connect(closeAction, SIGNAL(triggered()), this, SLOT(reject()));
66 addAction(closeAction);
68 #endif // Q_OS_SYMBIAN
71 void Dyalog::addWidget(QWidget *widget)
73 contentLayout->addWidget(widget);
76 void Dyalog::addStretch(int stretch)
78 contentLayout->addStretch(stretch);
81 void Dyalog::addButton(const QString &label, QObject *receiver,
82 const char *slot, QDialogButtonBox::ButtonRole role)
90 menuBar = new QMenuBar(this);
92 QAction *action = new QAction(label, this);
93 connect(action, SIGNAL(triggered()), receiver, slot);
94 menuBar->addAction(action);
96 QPushButton *button = new QPushButton(label, this);
97 connect(button, SIGNAL(clicked()), receiver, slot);
98 buttonBox->addButton(button, role);
99 #endif // Q_OS_SYMBIAN
106 foreach (QWidget *w, QApplication::allWidgets()) {
107 w->setContextMenuPolicy(Qt::NoContextMenu);
115 return QDialog::exec();
118 #endif // Q_OS_SYMBIAN