# HG changeset patch # User unc0rr # Date 1217969828 0 # Node ID c72b939c00dfc56e5972a2912ee00d65b737be8d # Parent ee6573db301a627143c06a417f747b5100b2ede7 Make buttons border have different colors when mouse is over or it is pressed diff -r ee6573db301a -r c72b939c00df QTfrontend/main.cpp --- a/QTfrontend/main.cpp Tue Aug 05 15:39:51 2008 +0000 +++ b/QTfrontend/main.cpp Tue Aug 05 20:57:08 2008 +0000 @@ -54,19 +54,28 @@ Q_INIT_RESOURCE(hedgewars); qApp->setStyleSheet - (QString( - ".HWForm{" - "background-image: url(\":/res/Background.png\");" - "background-position: bottom center;" - //" background-origin: content;" - "background-repeat: repeat-x;" - "background-color: #870c8f;" - "}" - "PageMain > QPushButton{" - "border: solid transparent;" - "}" - ) - ); + (QString( + ".HWForm{" + "background-image: url(\":/res/Background.png\");" + "background-position: bottom center;" + "background-repeat: repeat-x;" + "background-color: #870c8f;" + "}" + "PageMain > QPushButton{" + "border: solid;" + "border-width: 4px;" + "border-radius: 8px;" + "border-color: orange;" + "background-origin: content;" + "}" + "PageMain > QPushButton:hover{" + "border-color: yellow;" + "}" + "PageMain > QPushButton:pressed{" + "border-color: white;" + "}" + ) + ); bindir->cd("bin"); // workaround over NSIS installer diff -r ee6573db301a -r c72b939c00df QTfrontend/pages.cpp --- a/QTfrontend/pages.cpp Tue Aug 05 15:39:51 2008 +0000 +++ b/QTfrontend/pages.cpp Tue Aug 05 20:57:08 2008 +0000 @@ -60,25 +60,25 @@ //pageLayout->setColumnStretch(1, 2); //pageLayout->setColumnStretch(2, 1); - QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, QSize(720, 140)); + QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); pageLayout->setRowStretch(0, 1); pageLayout->setRowStretch(1, 1); pageLayout->setRowStretch(2, 0); pageLayout->setRowStretch(3, 1); - BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, QSize(314, 260)); + BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); - BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, QSize(314, 260)); + BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); - BtnSetup = addButton(":/res/Settings.png", pageLayout, 3, 3, QSize(54, 50)); + BtnSetup = addButton(":/res/Settings.png", pageLayout, 3, 3, true); - BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, QSize(116, 37)); + BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); - BtnExit = addButton(":/res/Exit.png", pageLayout, 3, 0, 1, 1, QSize(58, 52)); + BtnExit = addButton(":/res/Exit.png", pageLayout, 3, 0, 1, 1, true); } PageEditTeam::PageEditTeam(QWidget* parent) : diff -r ee6573db301a -r c72b939c00df QTfrontend/pages.h --- a/QTfrontend/pages.h Tue Aug 05 15:39:51 2008 +0000 +++ b/QTfrontend/pages.h Tue Aug 05 20:57:08 2008 +0000 @@ -59,15 +59,16 @@ } virtual ~AbstractPage() {}; - QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, const QSize sz=QSize(0, 0)) { + QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, bool iconed = false) { QPushButton* butt = new QPushButton(this); - if (sz==QSize(0, 0)) { + if (!iconed) { butt->setFont(*font14); butt->setText(btname); } else { const QIcon& lp=QIcon(btname); + QSize sz = lp.actualSize(QSize(65535, 65535)); butt->setIcon(lp); - butt->setFixedSize(sz+QSize(2, 2)); + butt->setFixedSize(sz); butt->setIconSize(sz); butt->setFlat(true); butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); @@ -76,15 +77,16 @@ return butt; }; - QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, const QSize sz=QSize(0, 0)) { + QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool iconed = false) { QPushButton* butt = new QPushButton(this); - if (sz==QSize(0, 0)) { + if (!iconed) { butt->setFont(*font14); butt->setText(btname); } else { const QIcon& lp=QIcon(btname); + QSize sz = lp.actualSize(QSize(65535, 65535)); butt->setIcon(lp); - butt->setFixedSize(sz+QSize(2, 2)); + butt->setFixedSize(sz); butt->setIconSize(sz); butt->setFlat(true); butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); diff -r ee6573db301a -r c72b939c00df QTfrontend/res/Exit.png Binary file QTfrontend/res/Exit.png has changed diff -r ee6573db301a -r c72b939c00df QTfrontend/res/LocalPlay.png Binary file QTfrontend/res/LocalPlay.png has changed diff -r ee6573db301a -r c72b939c00df QTfrontend/res/NetworkPlay.png Binary file QTfrontend/res/NetworkPlay.png has changed