Better theme selection widget look
authorunc0rr
Mon, 08 Sep 2008 18:08:47 +0000
changeset 1248 8c77eec56bf4
parent 1247 890b6741251d
child 1249 b6670a6ea2d0
Better theme selection widget look
QTfrontend/igbox.cpp
QTfrontend/igbox.h
QTfrontend/mapContainer.cpp
--- a/QTfrontend/igbox.cpp	Sat Sep 06 12:35:34 2008 +0000
+++ b/QTfrontend/igbox.cpp	Mon Sep 08 18:08:47 2008 +0000
@@ -25,25 +25,26 @@
 
 IconedGroupBox::IconedGroupBox(QWidget * parent)
 {
-
+	padding = 82;
 }
 
 void IconedGroupBox::setIcon(const QIcon & icon)
 {
 	this->icon = icon;
-	setStyleSheet(
+	setStyleSheet(QString(
 		"IconedGroupBox{"
 			"margin-top: 46px;"
 			"margin-left: 12px;"
-			"padding-top: 22px;"
+			"padding: 22px 0px 0px 0px;"
 			"}"
 		"IconedGroupBox::title{"
 			"subcontrol-origin: margin;"
 			"subcontrol-position: top left;"
-			"padding-left: 82px;"
+			"padding-left: %1px;"
 			"padding-top: 26px;"
 			"text-align: left;"
 			"}"
+			).arg(padding)
 	);
 }
 
@@ -57,3 +58,8 @@
 
 	icon.paint(&painter, QRect(QPoint(0, 0), icon.actualSize(size())));
 }
+
+void IconedGroupBox::setTitleTextPadding(int px)
+{
+	padding = px;
+}
--- a/QTfrontend/igbox.h	Sat Sep 06 12:35:34 2008 +0000
+++ b/QTfrontend/igbox.h	Mon Sep 08 18:08:47 2008 +0000
@@ -30,11 +30,13 @@
 	IconedGroupBox(QWidget * parent = 0);
 
 	void setIcon(const QIcon & icon);
+	void setTitleTextPadding(int px);
 protected:
 	virtual void paintEvent(QPaintEvent * event);
 
 private:
 	QIcon icon;
+	int padding;
 };
 
 #endif // _IGBOX_H
--- a/QTfrontend/mapContainer.cpp	Sat Sep 06 12:35:34 2008 +0000
+++ b/QTfrontend/mapContainer.cpp	Mon Sep 08 18:08:47 2008 +0000
@@ -62,8 +62,10 @@
   mainLayout.addWidget(lblMap, 1, 0);
 
 	gbThemes = new IconedGroupBox(this);
+	gbThemes->setTitleTextPadding(60);
 	gbThemes->setTitle(tr("Themes"));
-	//gbThemes->setStyleSheet("padding: 0px"); // doesn't work - why?
+
+	//gbThemes->setStyleSheet("padding: 0px"); // doesn't work - stylesheet is set with icon
 	mainLayout.addWidget(gbThemes, 0, 2, 2, 1);
 	
 	QVBoxLayout * gbTLayout = new QVBoxLayout(gbThemes);
@@ -71,7 +73,7 @@
 	gbTLayout->setSpacing(0);
 	lwThemes = new QListWidget(this);
 	lwThemes->setMinimumHeight(30);
-	lwThemes->setFixedWidth(100);
+	lwThemes->setFixedWidth(120);
 	for (int i = 0; i < Themes->size(); ++i) {
 		QListWidgetItem * lwi = new QListWidgetItem();
 		lwi->setText(Themes->at(i));