Finish iconed groupbox implementation
authorunc0rr
Tue, 12 Aug 2008 09:26:44 +0000
changeset 1193 2911384169b4
parent 1192 63b7961f68de
child 1194 32e854874df2
Finish iconed groupbox implementation
QTfrontend/igbox.cpp
QTfrontend/main.cpp
QTfrontend/pages.cpp
QTfrontend/pages.h
--- a/QTfrontend/igbox.cpp	Tue Aug 12 08:48:44 2008 +0000
+++ b/QTfrontend/igbox.cpp	Tue Aug 12 09:26:44 2008 +0000
@@ -18,6 +18,9 @@
 
 #include <QPainter>
 #include <QPoint>
+#include <QStylePainter>
+#include <QStyleOptionGroupBox>
+
 #include "igbox.h"
 
 IconedGroupBox::IconedGroupBox(QWidget * parent)
@@ -32,7 +35,11 @@
 
 void IconedGroupBox::paintEvent(QPaintEvent * event)
 {
-	QPainter painter(this);
+	QStylePainter painter(this);
 
-	icon.paint(&painter, QRect(QPoint(0, 0), size()));
+	QStyleOptionGroupBox option;
+	initStyleOption(&option);
+	painter.drawComplexControl(QStyle::CC_GroupBox, option);
+
+	icon.paint(&painter, QRect(QPoint(0, 0), icon.actualSize(size())));
 }
--- a/QTfrontend/main.cpp	Tue Aug 12 08:48:44 2008 +0000
+++ b/QTfrontend/main.cpp	Tue Aug 12 09:26:44 2008 +0000
@@ -183,15 +183,14 @@
 				"padding: 3px;"
 				"margin-top: 60px;"
 				"margin-left: 16px;"
-//				"padding-top: 6px;"
-				"}"
-			"QGroupBox::indicator{"
-				"image: url(\":/res/graphicsicon.png\");"
+				"padding-top: 6px;"
 				"}"
 			"QGroupBox::title{"
 				"subcontrol-origin: margin;"
 				"subcontrol-position: top left;"
-				"text-align: center;"
+				"padding-left: 82px;"
+				"padding-top: 26px;"
+				"text-align: left;"
 				"}"
 
 			"QCheckBox{"
--- a/QTfrontend/pages.cpp	Tue Aug 12 08:48:44 2008 +0000
+++ b/QTfrontend/pages.cpp	Tue Aug 12 09:26:44 2008 +0000
@@ -284,8 +284,8 @@
 
 	BtnEditTeam = addButton(tr("Edit team"), GBTlayout, 0, 2);
 
-	AGGroupBox = new QGroupBox(this);
-	//AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png"));
+	AGGroupBox = new IconedGroupBox(this);
+	AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png"));
 	AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 	AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
 	pageLayout->addWidget(AGGroupBox, 2, 1);
--- a/QTfrontend/pages.h	Tue Aug 12 08:48:44 2008 +0000
+++ b/QTfrontend/pages.h	Tue Aug 12 09:26:44 2008 +0000
@@ -192,7 +192,7 @@
 	QPushButton *BtnNewTeam;
 	QPushButton *BtnEditTeam;
 	QComboBox *CBTeamName;
-	QGroupBox *AGGroupBox;
+	IconedGroupBox *AGGroupBox;
 	QComboBox *CBResolution;
 	QCheckBox *CBEnableSound;
 	QCheckBox *CBEnableMusic;