From 9ef1e89e3ec01a5a34863b1b0aa3483b49404560 Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 7 Apr 2011 18:25:25 +0200 Subject: - make player icons a bit nicer (on windows too) - we don't build DEBUG by default (makes windows go crazy) --- pacman-c++/mainwidget.cpp | 23 +++++++++++++---------- pacman-c++/mainwidget.h | 1 + pacman-c++/pacman.pro | 2 -- pacman-c++/style.qss | 20 ++++++++++++-------- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp index e8a4250..96cf62f 100644 --- a/pacman-c++/mainwidget.cpp +++ b/pacman-c++/mainwidget.cpp @@ -109,13 +109,15 @@ void MainWidget::createGui() setFocusPolicy(Qt::StrongFocus); QVBoxLayout *layout = new QVBoxLayout(this); - QHBoxLayout *m_scoreLayout = new QHBoxLayout(); + QHBoxLayout *scoreLayout = new QHBoxLayout(); for (unsigned int i = 1; i < 4; ++i) { - QGroupBox *scoreBox = new QGroupBox(QString(" Spieler %1").arg(i), this); + QGroupBox *scoreBox = new QGroupBox(QString("Spieler %1").arg(i), this); scoreBox->setObjectName(QString("actor%1").arg(i)); - m_scoreLayout->addWidget(scoreBox); + scoreBox->setCheckable(true); + connect(scoreBox, SIGNAL(clicked()), this, SLOT(playerScoreClicked())); + scoreLayout->addWidget(scoreBox); QGridLayout *playerLayout = new QGridLayout(); scoreBox->setLayout(playerLayout); @@ -126,12 +128,6 @@ void MainWidget::createGui() playerLayout->addWidget(new QLabel("", this), 0, 1); playerLayout->addWidget(new QLabel("", this), 1, 1); - /*Actor *tmp1 = new Actor(Color::red); - QGraphicsScene *tmp2 = new QGraphicsScene(0, 0, 16, 16, this); - QLabel *tmp3 = new QLabel("hfghgfhgfhgfh", this); - tmp3->setPixmap(QPixmap(":/actor1")); - playerLayout->addWidget(tmp3, 0, 2);*/ - m_playerScoreLayouts.append(playerLayout); } @@ -144,7 +140,7 @@ void MainWidget::createGui() window->setFixedSize(Constants::map_size_pixel.width, Constants::map_size_pixel.height); window->setWindowFlags(window->windowFlags() & ~Qt::WindowMaximizeButtonHint); - layout->addLayout(m_scoreLayout); + layout->addLayout(scoreLayout); layout->addWidget(window); QFile css(":/stylesheet"); @@ -356,3 +352,10 @@ void MainWidget::startGame() { m_running = true; } + +void MainWidget::playerScoreClicked() +{ + QGroupBox *tmp = qobject_cast(sender()); + tmp->setChecked(true); + return; +} diff --git a/pacman-c++/mainwidget.h b/pacman-c++/mainwidget.h index 6adcba2..f5703db 100644 --- a/pacman-c++/mainwidget.h +++ b/pacman-c++/mainwidget.h @@ -29,6 +29,7 @@ private: private slots: void startGame(); + void playerScoreClicked(); private: QVector< QVector > visualMap; diff --git a/pacman-c++/pacman.pro b/pacman-c++/pacman.pro index e995c81..3826852 100644 --- a/pacman-c++/pacman.pro +++ b/pacman-c++/pacman.pro @@ -22,8 +22,6 @@ OBJECTS_DIR = .obj MOC_DIR = .moc RC_FILE = pacman.rc -CONFIG += debug - OTHER_FILES += \ style.qss \ pacman.rc diff --git a/pacman-c++/style.qss b/pacman-c++/style.qss index 74ba1b8..1a24459 100644 --- a/pacman-c++/style.qss +++ b/pacman-c++/style.qss @@ -1,27 +1,31 @@ -QGroupBox#actor1::title { +QGroupBox#actor1::indicator { background-image: url(:/actor1icon); background-position: top left; background-repeat: no-repeat; - background-color: palette(window); + width: 16px; + height: 14px; } -QGroupBox#actor2::title { +QGroupBox#actor2::indicator { background-image: url(:/actor2icon); background-position: top left; background-repeat: no-repeat; - background-color: palette(window); + width: 16px; + height: 14px; } -QGroupBox#actor3::title { +QGroupBox#actor3::indicator { background-image: url(:/actor3icon); background-position: top left; background-repeat: no-repeat; - background-color: palette(window); + width: 16px; + height: 14px; } -QGroupBox#actor4::title { +QGroupBox#actor4::indicator { background-image: url(:/actor4icon); background-position: top left; background-repeat: no-repeat; - background-color: palette(window); + width: 16px; + height: 14px; } -- cgit v1.2.3