Fix for middle column not being growing in width
authorunc0rr
Sun, 07 Jan 2007 22:54:08 +0000
changeset 310 b95fd124cb09
parent 309 56b937b1c780
child 311 b8905423f19f
Fix for middle column not being growing in width
QTfrontend/SquareLabel.cpp
QTfrontend/SquareLabel.h
QTfrontend/pages.cpp
--- a/QTfrontend/SquareLabel.cpp	Sun Jan 07 17:48:18 2007 +0000
+++ b/QTfrontend/SquareLabel.cpp	Sun Jan 07 22:54:08 2007 +0000
@@ -21,7 +21,7 @@
 #include "SquareLabel.h"
 
 SquareLabel::SquareLabel(QWidget * parent) :
-  QLabel(parent)
+	QWidget(parent)
 {
 
 }
@@ -37,5 +37,11 @@
 		pixsize = width();
 		painter.translate(0, (height() - pixsize) / 2);
 	}
-	painter.drawPixmap(0, 0, pixsize, pixsize, pixmap()->scaled(pixsize, pixsize, Qt::KeepAspectRatio));
+	painter.drawPixmap(0, 0, pixsize, pixsize, pixmap.scaled(pixsize, pixsize, Qt::KeepAspectRatio));
 }
+
+void SquareLabel::setPixmap(const QPixmap & pixmap)
+{
+	this->pixmap = pixmap;
+	repaint();
+}
--- a/QTfrontend/SquareLabel.h	Sun Jan 07 17:48:18 2007 +0000
+++ b/QTfrontend/SquareLabel.h	Sun Jan 07 22:54:08 2007 +0000
@@ -19,17 +19,23 @@
 #ifndef _SQUARELABEL_H
 #define _SQUARELABEL_H
 
-#include <QLabel>
+#include <QWidget>
+#include <QPixmap>
 
-class SquareLabel : public QLabel
+class SquareLabel : public QWidget
 {
 	Q_OBJECT
 
 public:
 	SquareLabel(QWidget * parent = 0);
 
+	void setPixmap(const QPixmap & pixmap);
 protected:
 	virtual void paintEvent(QPaintEvent * event);
+
+private:
+	QPixmap pixmap;
+
 };
 
 #endif // _SQUARELABEL_H
--- a/QTfrontend/pages.cpp	Sun Jan 07 17:48:18 2007 +0000
+++ b/QTfrontend/pages.cpp	Sun Jan 07 22:54:08 2007 +0000
@@ -111,11 +111,11 @@
 {
 	QFont * font14 = new QFont("MS Shell Dlg", 14);
 	QGridLayout * pageLayout = new QGridLayout(this);
-	pageLayout->setColumnStretch(0, 100);
+	pageLayout->setColumnStretch(0, 1);
 	pageLayout->setColumnMinimumWidth(0, 150);
 	pageLayout->setColumnStretch(1, 100);
 	pageLayout->setColumnMinimumWidth(1, 200);
-	pageLayout->setColumnStretch(2, 250);
+	pageLayout->setColumnStretch(2, 150);
 	pageLayout->setColumnMinimumWidth(2, 250);
 
 	GBoxTeam = new QGroupBox(this);
@@ -214,8 +214,8 @@
 	CBFort->setMaxCount(65535);
 	GBFLayout->addWidget(CBFort, 0, 0);
 	FortPreview	= new SquareLabel(GBoxFort);
+	FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 	FortPreview->setPixmap(QPixmap());
-	FortPreview->setScaledContents(true);
 	GBFLayout->addWidget(FortPreview, 1, 0);
 	pageLayout->addWidget(GBoxFort, 2, 2, 1, 1);