# HG changeset patch # User unc0rr # Date 1218530924 0 # Node ID 63b7961f68de2be3a7aa752c453454fe62797cd8 # Parent 5539aa59f703a5e68fc38b1eeaeeb9456090b21d Add iconed groupbox class diff -r 5539aa59f703 -r 63b7961f68de QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Sun Aug 10 20:18:40 2008 +0000 +++ b/QTfrontend/CMakeLists.txt Tue Aug 12 08:48:44 2008 +0000 @@ -75,6 +75,7 @@ selectWeapon.cpp itemNum.cpp input_ip.cpp + igbox.cpp weaponItem.cpp) if(MINGW) @@ -121,6 +122,7 @@ selectWeapon.h itemNum.h input_ip.h + igbox.h weaponItem.h) set(hwfr_hdrs diff -r 5539aa59f703 -r 63b7961f68de QTfrontend/igbox.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/igbox.cpp Tue Aug 12 08:48:44 2008 +0000 @@ -0,0 +1,38 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2008 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include "igbox.h" + +IconedGroupBox::IconedGroupBox(QWidget * parent) +{ + +} + +void IconedGroupBox::setIcon(const QIcon & icon) +{ + this->icon = icon; +} + +void IconedGroupBox::paintEvent(QPaintEvent * event) +{ + QPainter painter(this); + + icon.paint(&painter, QRect(QPoint(0, 0), size())); +} diff -r 5539aa59f703 -r 63b7961f68de QTfrontend/igbox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/igbox.h Tue Aug 12 08:48:44 2008 +0000 @@ -0,0 +1,40 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2008 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _IGBOX_H +#define _IGBOX_H + +#include +#include + +class IconedGroupBox : public QGroupBox +{ + Q_OBJECT + +public: + IconedGroupBox(QWidget * parent = 0); + + void setIcon(const QIcon & icon); +protected: + virtual void paintEvent(QPaintEvent * event); + +private: + QIcon icon; +}; + +#endif // _IGBOX_H diff -r 5539aa59f703 -r 63b7961f68de QTfrontend/pages.cpp --- a/QTfrontend/pages.cpp Sun Aug 10 20:18:40 2008 +0000 +++ b/QTfrontend/pages.cpp Tue Aug 12 08:48:44 2008 +0000 @@ -50,6 +50,7 @@ #include "SDLs.h" #include "playrecordpage.h" #include "selectWeapon.h" +#include "igbox.h" PageMain::PageMain(QWidget* parent) : AbstractPage(parent) @@ -284,7 +285,7 @@ BtnEditTeam = addButton(tr("Edit team"), GBTlayout, 0, 2); AGGroupBox = new QGroupBox(this); - AGGroupBox->setCheckable(true); + //AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); pageLayout->addWidget(AGGroupBox, 2, 1); diff -r 5539aa59f703 -r 63b7961f68de QTfrontend/pages.h --- a/QTfrontend/pages.h Sun Aug 10 20:18:40 2008 +0000 +++ b/QTfrontend/pages.h Tue Aug 12 08:48:44 2008 +0000 @@ -48,6 +48,7 @@ class FPSEdit; class HWChatWidget; class SelWeaponWidget; +class IconedGroupBox; class AbstractPage : public QWidget {