Add hat selection control to team editing page (it's empty combobox yet)
authorunc0rr
Fri, 29 Aug 2008 21:05:31 +0000
changeset 1238 914bd2a9a249
parent 1237 7f3105a15d5d
child 1239 4901abe4c3b0
Add hat selection control to team editing page (it's empty combobox yet)
QTfrontend/hats.cpp
QTfrontend/hats.h
QTfrontend/pages.cpp
--- a/QTfrontend/hats.cpp	Fri Aug 29 20:36:10 2008 +0000
+++ b/QTfrontend/hats.cpp	Fri Aug 29 21:05:31 2008 +0000
@@ -45,3 +45,14 @@
 	else
 		return 2;
 }
+
+QVariant HatsModel::data(const QModelIndex &index,
+                         int role) const
+{
+	if (!index.isValid() || index.row() < 0
+		|| index.row() >= 60
+		|| role != Qt::DisplayRole)
+		return QVariant();
+
+	return QVariant();//games[index.row()][index.column()];
+}
--- a/QTfrontend/hats.h	Fri Aug 29 20:36:10 2008 +0000
+++ b/QTfrontend/hats.h	Fri Aug 29 21:05:31 2008 +0000
@@ -33,6 +33,7 @@
 	int rowCount(const QModelIndex & parent) const;
 	int columnCount(const QModelIndex & parent) const;
 
+	QVariant data(const QModelIndex &index, int role) const;
 //protected:
 //	QList<QStringList> games;
 };
--- a/QTfrontend/pages.cpp	Fri Aug 29 20:36:10 2008 +0000
+++ b/QTfrontend/pages.cpp	Fri Aug 29 21:05:31 2008 +0000
@@ -50,6 +50,7 @@
 #include "playrecordpage.h"
 #include "selectWeapon.h"
 #include "igbox.h"
+#include "hats.h"
 
 PageMain::PageMain(QWidget* parent) : 
   AbstractPage(parent)
@@ -90,7 +91,7 @@
 {
 	QGridLayout * pageLayout = new QGridLayout(this);
 	pageLayout->setColumnStretch(0, 1);
-	pageLayout->setColumnMinimumWidth(0, 150);
+	pageLayout->setColumnMinimumWidth(0, 180);
 	pageLayout->setColumnStretch(1, 100);
 	pageLayout->setColumnMinimumWidth(1, 210);
 	pageLayout->setColumnStretch(2, 75);
@@ -112,12 +113,18 @@
 	GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members"));
 	GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 	QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs);
+	
+	HatsModel * hatsModel = new HatsModel(GBoxHedgehogs);
 	for(int i = 0; i < 8; i++)
 	{
 		HHNameEdit[i] = new QLineEdit(GBoxHedgehogs);
-		HHNameEdit[i]->setGeometry(QRect(10, 20 + i * 30, 141, 20));
 		HHNameEdit[i]->setMaxLength(64);
-		GBHLayout->addWidget(HHNameEdit[i]);
+		HHNameEdit[i]->setMinimumWidth(120);
+		GBHLayout->addWidget(HHNameEdit[i], i, 0);
+		
+		HHHats[i] = new QComboBox(GBoxHedgehogs);
+		HHHats[i]->setModel(hatsModel);
+		GBHLayout->addWidget(HHHats[i], i, 1);
 	}
 	pageLayout->addWidget(GBoxHedgehogs, 1, 0, 2, 1);