3 #include "listwindow.h"
6 ListWindow::ListWindow(QWidget *parent): QMainWindow(parent)
9 setAttribute(Qt::WA_Maemo5StackedWindow, true);
12 QFrame *frame = new QFrame(this);
13 setCentralWidget(frame);
14 layout = new QHBoxLayout(frame);
15 frame->setLayout(layout);
18 buttonBox = new QDialogButtonBox(Qt::Vertical, this);
19 layout->addWidget(buttonBox);
23 void ListWindow::addList(QListView *list)
25 layout->insertWidget(0, list);
28 void ListWindow::addAction(const QString &title, QObject *receiver,
29 const char *slot, QDialogButtonBox::ButtonRole role)
32 QPushButton *button = new QPushButton(title, this);
33 QList<QAction *> actions = button->actions();
34 Trace::trace(QString("ListWindow::addAction: Button has %1 default action(s)").arg(actions.length()));
35 buttonBox->addButton(button, role);
36 connect(button, SIGNAL(clicked()), receiver, slot);
39 QAction *action = menuBar()->addAction(title);
40 connect(action, SIGNAL(triggered()), receiver, slot);
41 #endif // Q_WS_MAEMO_5
46 void ListWindow::closeEvent(QCloseEvent *event)
48 // Work around Maemo/Qt but: Menu items are not removed on close
53 #endif // Q_WS_MAEMO_5