-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using new class CardButton to simplify the PlayerCardDialog
- Loading branch information
Showing
8 changed files
with
116 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "cardbutton.h" | ||
|
||
#include "card.h" | ||
|
||
CardButton::CardButton(const Card *card) | ||
:card(card) | ||
{ | ||
if(card){ | ||
setText(card->getFullName()); | ||
setIcon(card->getSuitIcon()); | ||
setToolTip(card->getDescription()); | ||
} | ||
|
||
connect(this, SIGNAL(clicked()), this, SLOT(onClicked())); | ||
} | ||
|
||
void CardButton::onClicked() | ||
{ | ||
if(card) | ||
emit idSelected(card->getId()); | ||
else | ||
emit idSelected(-1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef CARDBUTTON_H | ||
#define CARDBUTTON_H | ||
|
||
#ifdef Q_OS_WIN | ||
#define CommandLinkButton QCommandLinkButton | ||
#include <QCommandLinkButton> | ||
#else | ||
#define CommandLinkButton QPushButton | ||
#include <QPushButton> | ||
#endif | ||
|
||
class Card; | ||
|
||
class CardButton : public CommandLinkButton | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit CardButton(const Card *card); | ||
|
||
private: | ||
const Card *card; | ||
|
||
private slots: | ||
void onClicked(); | ||
|
||
signals: | ||
void idSelected(int id); | ||
}; | ||
|
||
#endif // CARDBUTTON_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters