summaryrefslogtreecommitdiffstats
path: root/hyperui
diff options
context:
space:
mode:
authorAdriano Rezende <adriano.rezende@openbossa.org>2009-10-29 19:31:39 -0300
committerAdriano Rezende <adriano.rezende@openbossa.org>2009-10-29 22:22:56 -0300
commitf126cf59dd22d1d4eb74f932f3032224734c837a (patch)
tree34a1c0dd86f5643134c6796b0f972f42f79dc3de /hyperui
parentb312bba986ba1b52b6996bf8cb132351ff5e4e58 (diff)
HyperUI: Adjusted main window to paint background
Diffstat (limited to 'hyperui')
-rw-r--r--hyperui/main.cpp3
-rw-r--r--hyperui/mainwindow.cpp15
-rw-r--r--hyperui/mainwindow.h9
3 files changed, 21 insertions, 6 deletions
diff --git a/hyperui/main.cpp b/hyperui/main.cpp
index b54a6b9..c3dec85 100644
--- a/hyperui/main.cpp
+++ b/hyperui/main.cpp
@@ -56,9 +56,6 @@ int main(int argc, char **argv)
view.resize(width, height);
scene.setSceneRect(0, 0, width, height);
- view.setBackgroundBrush(Resource::pixmap("background.png"));
- view.setCacheMode(QGraphicsView::CacheBackground);
-
MainWindow mainWindow;
scene.addItem(&mainWindow);
mainWindow.setGeometry(0, 0, width, height);
diff --git a/hyperui/mainwindow.cpp b/hyperui/mainwindow.cpp
index 95decf6..4109833 100644
--- a/hyperui/mainwindow.cpp
+++ b/hyperui/mainwindow.cpp
@@ -30,6 +30,7 @@
****************************************************************************/
#include <QDateTime>
+#include <QPainter>
#include "global.h"
#include "mainwindow.h"
@@ -46,10 +47,9 @@
MainWindow::MainWindow(QGraphicsItem *parent)
- : QGraphicsWidget(parent)
+ : QGraphicsWidget(parent),
+ m_background(Resource::pixmap("background.png"))
{
- setFlag(QGraphicsItem::ItemHasNoContents);
-
m_clockWidget = new ClockWidget(this);
m_clockWidget->setPos(0, 0);
@@ -129,6 +129,15 @@ void MainWindow::createDummyDailyEvents()
QDateTime(cd, QTime(8, 20, 0)), color3);
}
+void MainWindow::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+
+ painter->drawPixmap(0, 0, m_background);
+}
+
/*!
Lock the screen in portrait mode.
diff --git a/hyperui/mainwindow.h b/hyperui/mainwindow.h
index aae91b1..e3b3e69 100644
--- a/hyperui/mainwindow.h
+++ b/hyperui/mainwindow.h
@@ -38,6 +38,11 @@ class PageView;
class ClockWidget;
class DraggablePreview;
+QT_BEGIN_NAMESPACE
+class QPainter;
+class QStyleOptionGraphicsItem;
+QT_END_NAMESPACE
+
class MainWindow : public QGraphicsWidget
{
@@ -46,6 +51,9 @@ class MainWindow : public QGraphicsWidget
public:
MainWindow(QGraphicsItem *parent = 0);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = 0);
+
private slots:
void onMaximizeFinished();
@@ -56,6 +64,7 @@ private slots:
private:
void createDummyDailyEvents();
+ QPixmap m_background;
PageView *m_mainView;
ClockWidget *m_clockWidget;
DraggablePreview *m_preview;