3 #include "fullscreenwindow.h"
4 #include "translucentbutton.h"
6 FullScreenWindow::FullScreenWindow(QWidget *parent): QMainWindow(parent), child(0)
10 setAttribute(Qt::WA_Maemo5StackedWindow, true);
11 setAttribute(Qt::WA_Maemo5NonComposited, true);
12 #endif // Q_WS_MAEMO_5
13 QFrame *frame = new QFrame(this);
14 QVBoxLayout *layout = new QVBoxLayout(frame);
16 frame->setLayout(layout);
17 setCentralWidget(frame);
18 restoreButton = new TranslucentButton("view-fullscreen", this);
21 void FullScreenWindow::showFullScreen()
24 setAttribute(Qt::WA_Maemo5PortraitOrientation, parentWidget()->
25 testAttribute(Qt::WA_Maemo5PortraitOrientation));
26 setAttribute(Qt::WA_Maemo5LandscapeOrientation, parentWidget()->
27 testAttribute(Qt::WA_Maemo5LandscapeOrientation));
28 #endif // Q_WS_MAEMO_5
29 QWidget::showFullScreen();
30 restoreButton->flash();
33 void FullScreenWindow::MOUSE_ACTIVATE_EVENT(QMouseEvent *event)
35 if (fullScreenZone().contains(event->x(), event->y())) {
38 QMainWindow::MOUSE_ACTIVATE_EVENT(event);
41 QRect FullScreenWindow::fullScreenZone() const
43 return QRect(width() / 2 - 45, height() - 104, 95, 95);
46 void FullScreenWindow::resizeEvent(QResizeEvent *e)
48 restoreButton->setGeometry(fullScreenZone());
49 QMainWindow::resizeEvent(e);
52 void FullScreenWindow::takeChild(QWidget *c)
57 child->setParent(centralWidget());
58 centralWidget()->layout()->addWidget(child);
62 void FullScreenWindow::leaveChild()
65 centralWidget()->layout()->removeWidget(child);