QTfrontend/ui/widget/frameTeam.cpp
changeset 13235 d5a029299407
parent 11046 47a8c19ecb60
child 13239 6fa6626eb273
--- a/QTfrontend/ui/widget/frameTeam.cpp	Fri Mar 16 19:05:11 2018 +0100
+++ b/QTfrontend/ui/widget/frameTeam.cpp	Fri Mar 16 19:25:51 2018 +0100
@@ -28,7 +28,8 @@
 #include "DataManager.h"
 
 FrameTeams::FrameTeams(QWidget* parent) :
-    QFrame(parent), mainLayout(this), nonInteractive(false)
+    QFrame(parent), mainLayout(this), nonInteractive(false),
+    hasDecoFrame(false)
 {
     QPalette newPalette = palette();
     newPalette.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00));
@@ -73,6 +74,7 @@
     teamToWidget.insert(team, pTeamShowWidget);
     QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
     QCoreApplication::postEvent(parentWidget(), pevent);
+    updateDecoFrame();
 }
 
 void FrameTeams::removeTeam(HWTeam team)
@@ -84,6 +86,7 @@
     teamToWidget.erase(it);
     QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
     QCoreApplication::postEvent(parentWidget(), pevent);
+    updateDecoFrame();
 }
 
 void FrameTeams::resetTeams()
@@ -134,3 +137,28 @@
 {
     return QSize(-1, teamToWidget.size() * 39 + 9);
 }
+
+void FrameTeams::setDecoFrameEnabled(bool enabled)
+{
+    hasDecoFrame = enabled;
+    updateDecoFrame();
+}
+
+void FrameTeams::updateDecoFrame()
+{
+    if (hasDecoFrame && teamToWidget.size() >= 1)
+    {
+        setStyleSheet(
+            "FrameTeams{"
+            "border: solid;"
+            "border-width: 1px;"
+            "border-radius: 16px;"
+            "border-color: #ffcc00;"
+            "}"
+        );
+    }
+    else
+    {
+        setStyleSheet("FrameTeams{ border: transparent }");
+    }
+}