Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
authornemo
Sun, 17 May 2009 14:25:45 +0000
changeset 2072 6e0fcbcc3f60
parent 2071 0faa147c47df
child 2073 a735c41d97dc
Custom controls implementing paintEvent play poorly with stars, especially SquareLabel Setting PaintOnScreen seems safe with current layout
QTfrontend/SquareLabel.cpp
QTfrontend/igbox.cpp
QTfrontend/itemNum.cpp
QTfrontend/main.cpp
QTfrontend/pages.cpp
--- a/QTfrontend/SquareLabel.cpp	Sun May 17 13:04:58 2009 +0000
+++ b/QTfrontend/SquareLabel.cpp	Sun May 17 14:25:45 2009 +0000
@@ -23,7 +23,7 @@
 SquareLabel::SquareLabel(QWidget * parent) :
 	QWidget(parent)
 {
-
+    setAttribute(Qt::WA_PaintOnScreen, true);
 }
 
 void SquareLabel::paintEvent(QPaintEvent * event)
--- a/QTfrontend/igbox.cpp	Sun May 17 13:04:58 2009 +0000
+++ b/QTfrontend/igbox.cpp	Sun May 17 14:25:45 2009 +0000
@@ -25,6 +25,8 @@
 
 IconedGroupBox::IconedGroupBox(QWidget * parent)
 {
+// Has issues with border-radius on children
+//    setAttribute(Qt::WA_PaintOnScreen, true);
 	titleLeftPadding = 82;
     contentTopPadding = 22;
 }
--- a/QTfrontend/itemNum.cpp	Sun May 17 13:04:58 2009 +0000
+++ b/QTfrontend/itemNum.cpp	Sun May 17 14:25:45 2009 +0000
@@ -25,6 +25,7 @@
   QFrame(parent), m_im(im), infinityState(false), nonInteractive(false), minItems(min), maxItems(max),
   numItems(min+2 >= max ? min : min+2)
 {
+    setAttribute(Qt::WA_PaintOnScreen, true);
 }
 
 ItemNum::~ItemNum()
--- a/QTfrontend/main.cpp	Sun May 17 13:04:58 2009 +0000
+++ b/QTfrontend/main.cpp	Sun May 17 14:25:45 2009 +0000
@@ -133,8 +133,12 @@
 				"background-color: #040200;"
 				"padding: 6px;"
 			"}"
-
-			"IconedGroupBox, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{"
+/*  Experimenting with PaintOnScreen and border-radius on IconedGroupBox children didn't work out well
+			"IconedGroupBox QComboBox, IconedGroupBox QPushButton, IconedGroupBox QLineEdit, "
+            "IconedGroupBox QSpinBox {"
+				"border-radius: 0;"
+			"}" */
+			"IconedGroupBox, IconedGroupBox *, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{"
 				"background-color: #130f2c;"
 			"}"
 
@@ -271,6 +275,9 @@
 			":disabled{"
 				"color: #a0a0a0;"
 			"}"
+            "SquareLabel, ItemNum {"
+				"background-color: #000000;"
+			"}"
 			)
 		);
 
--- a/QTfrontend/pages.cpp	Sun May 17 13:04:58 2009 +0000
+++ b/QTfrontend/pages.cpp	Sun May 17 14:25:45 2009 +0000
@@ -208,6 +208,8 @@
 	FortPreview = new SquareLabel(GBoxFort);
 	FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 	FortPreview->setPixmap(QPixmap());
+    // perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars
+    //FortPreview->setAttribute(Qt::WA_PaintOnScreen, true);
 	GBFLayout->addWidget(FortPreview, 1, 0);
 	vbox3->addWidget(GBoxFort);
 
@@ -331,6 +333,7 @@
 	gbTBLayout->setSpacing(0);
 	{
 		teamsBox = new IconedGroupBox(this);
+        //teamsBox->setAttribute(Qt::WA_PaintOnScreen, true);
 		teamsBox->setIcon(QIcon(":/res/teamicon.png"));
 		teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 		teamsBox->setTitle(QGroupBox::tr("Teams"));