summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/profilewidget2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r--qt-ui/profile/profilewidget2.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 5bd738da3..3ec88e320 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -196,7 +196,24 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent* event)
void ProfileWidget2::resizeEvent(QResizeEvent* event)
{
+ QGraphicsView::resizeEvent(event);
+ fitInView(sceneRect(), Qt::IgnoreAspectRatio);
+ if(!stateMachine->configuration().count())
+ return;
+
+ if ((*stateMachine->configuration().begin())->objectName() == "Empty State"){
+ fixBackgroundPos();
+ }
+}
+
+void ProfileWidget2::fixBackgroundPos()
+{
+ QPixmap p = QPixmap(":background").scaledToHeight(viewport()->height());
+ int x = viewport()->width()/2 - p.width()/2;
+ DivePixmapItem *bg = background;
+ bg->setPixmap(p);
+ bg->setX(mapToScene(x, 0).x());
}
void ProfileWidget2::showEvent(QShowEvent* event)