1 Star 0 Fork 82

Jun Seow / Landlords

forked from ibc-dabing / Landlords 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
cardpanel.cpp 1.19 KB
Copy Edit Raw Blame History
kevin authored 2021-12-16 00:16 . 代码优化, 提高程序的健壮性
#include "cardpanel.h"
#include <QMouseEvent>
#include <QPainter>
CardPanel::CardPanel(QWidget *parent) : QWidget(parent)
{
}
void CardPanel::setImage(const QPixmap &front, const QPixmap &back)
{
m_front = front;
m_back = back;
setFixedSize(m_front.size());
update();
}
QPixmap CardPanel::getImage()
{
return m_front;
}
void CardPanel::setFrontSide(bool flag)
{
m_isfront = flag;
}
bool CardPanel::isFrontSide()
{
return m_isfront;
}
void CardPanel::setSeclected(bool flag)
{
m_isSelect = flag;
}
bool CardPanel::isSelected()
{
return m_isSelect;
}
void CardPanel::setCard(const Card &card)
{
m_card = card;
}
Card CardPanel::getCard()
{
return m_card;
}
void CardPanel::setOwner(Player *player)
{
m_owner = player;
}
Player *CardPanel::getOwner()
{
return m_owner;
}
void CardPanel::clicked()
{
emit cardSelected(Qt::LeftButton);
}
void CardPanel::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
QPainter p(this);
if(m_isfront)
{
p.drawPixmap(rect(), m_front);
}
else
{
p.drawPixmap(rect(), m_back);
}
}
void CardPanel::mousePressEvent(QMouseEvent *event)
{
emit cardSelected(event->button());
}
1
https://gitee.com/junjia2003/landlords.git
git@gitee.com:junjia2003/landlords.git
junjia2003
landlords
Landlords
master

Search

53164aa7 5694891 3bd8fe86 5694891