QTfrontend: Remove ugly rectangle in list of active teams when there are no teams
--- 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 }");
+ }
+}
--- a/QTfrontend/ui/widget/frameTeam.h Fri Mar 16 19:05:11 2018 +0100
+++ b/QTfrontend/ui/widget/frameTeam.h Fri Mar 16 19:25:51 2018 +0100
@@ -44,6 +44,7 @@
void setInteractivity(bool interactive);
int getNextColor();
QSize sizeHint() const;
+ void setDecoFrameEnabled(bool enabled);
signals:
void teamColorChanged(const HWTeam&);
@@ -61,6 +62,9 @@
typedef QMap<HWTeam, QWidget*> tmapTeamToWidget;
tmapTeamToWidget teamToWidget;
bool nonInteractive;
+
+ bool hasDecoFrame;
+ void updateDecoFrame();
};
#endif // _FRAME_TAM_INCLUDED
--- a/QTfrontend/ui/widget/teamselect.cpp Fri Mar 16 19:05:11 2018 +0100
+++ b/QTfrontend/ui/widget/teamselect.cpp Fri Mar 16 19:25:51 2018 +0100
@@ -250,16 +250,7 @@
if (maxHeight > 0)
area->setMaximumHeight(maxHeight);
if (setFrame)
- {
- area->setStyleSheet(
- "FrameTeams{"
- "border: solid;"
- "border-width: 1px;"
- "border-radius: 16px;"
- "border-color: #ffcc00;"
- "}"
- );
- }
+ pfteams->setDecoFrameEnabled(true);
}
TeamSelWidget::TeamSelWidget(QWidget* parent) :