diff --git a/view.cpp b/view.cpp index 1295b22a2..1ff7f6367 100644 --- a/view.cpp +++ b/view.cpp @@ -48,6 +48,22 @@ public: View::View(int screen, Corona *corona, QWidget *parent) : QGraphicsView(parent), d(new Private) +{ + initGraphicsView(); + setScene(corona); + setScreen(screen); +} + +View::View(Containment *containment, QWidget *parent) + : QGraphicsView(parent), + d(new Private) +{ + initGraphicsView(); + setScene(containment->scene()); + setContainment(containment); +} + +void View::initGraphicsView() { setFrameShape(QFrame::NoFrame); setAutoFillBackground(true); @@ -58,17 +74,6 @@ View::View(int screen, Corona *corona, QWidget *parent) setAlignment(Qt::AlignLeft | Qt::AlignTop); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - - setScene(corona); - setScreen(screen); -} - -View::View(Containment *containment, QWidget *parent) - : QGraphicsView(parent), - d(new Private) -{ - setScene(containment->scene()); - setContainment(containment); } View::~View() diff --git a/view.h b/view.h index 5de762aa4..fb88a6dfb 100644 --- a/view.h +++ b/view.h @@ -85,6 +85,8 @@ protected Q_SLOTS: void updateSceneRect(); private: + void initGraphicsView(); + class Private; Private * const d; };