Added some graphics to the panels. Very rudimentary implementation at
[situare] / src / ui / userpanel.cpp
index 92e3b6e..3e8913f 100644 (file)
@@ -33,10 +33,15 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
     m_userPanelVBox->addWidget(m_userPanelExpandButton);
     m_userPanelVBox->addWidget(m_userPanelLabel);
 
-    this->setAutoFillBackground(true);
+ //   this->setAutoFillBackground(true);
 //    this->setAttribute(Qt::WA_TranslucentBackground);
 //    this->setWindowOpacity(0.5); //DEFUNCT
 
+//    QPalette userPanelPalette;
+//    userPanelPalette.setBrush(this->backgroundRole(),
+//                              QBrush(QImage(":/res/personal_info_bckgrnd.png")));
+//    this->setPalette(userPanelPalette);
+
     m_userPanelStateMachine = new QStateMachine(this);
     m_userPanelStateClosed = new QState(m_userPanelStateMachine);
     m_userPanelStateClosed->assignProperty(this, "pos", QPoint(
@@ -56,6 +61,9 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
     m_userPanelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos"));
 
     m_userPanelStateMachine->start();
+    this->setObjectName("UserPanel");
+    this->setStyleSheet(QString(
+            "#UserPanel{background-image: url(:/res/images/personal_info_bckgrnd.png)}"));
 }
 
 void UserInfoPanel::reDrawUserPanel(int width, int height)
@@ -64,3 +72,14 @@ void UserInfoPanel::reDrawUserPanel(int width, int height)
     Q_UNUSED(width);
     this->resize(USERPANEL_WIDTH,height + MARGIN_CORRECTION);
 }
+
+void UserInfoPanel::paintEvent(QPaintEvent *)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    QStyleOption option;
+    option.init(this);
+
+    QStylePainter painter(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
+}