#include <QtWidgets>
#include <string>
using std::string;
#include "canvas.h"
#include "player.h"
#include "computer.h"
{
startButton->setFixedWidth(100);
connect(startButton, SIGNAL(clicked()), this, SLOT(startClicked()));
verticalLayout->addWidget(cardTable);
verticalLayout->addWidget(startButton);
mainLayout->addLayout(verticalLayout, 0, 0, 1, 1);
setLayout(mainLayout);
setUpComputerIcons();
setUpDeckIcons();
myGame = new Game(this);
}
void Canvas::setUpPlayerIcons(string *pString)
{
string str;
for (int i = 0; i < MAXCARDS; i++)
{
cardIconPlayer
[i
] = new QLabel(cardTable
);
str = pString[i];
iconSize = qpx.size();
iconSize.scale(190, 276, Qt::KeepAspectRatio);
QPixmap scaledImage
= qpx.
scaled(iconSize, Qt
::KeepAspectRatio, Qt
::SmoothTransformation);
cardIconPlayer[i]->setPixmap(scaledImage);
cardIconPlayer[i]->move(20 + 60 * i, 350);
}
}
#include <QtWidgets>
#include <string>
using std::string;
#include "canvas.h"
#include "player.h"
#include "computer.h"
Canvas::Canvas(QWidget *parent) : QWidget(parent)
{
cardTable = new QListView;
startButton = new QPushButton("Start");
startButton->setFixedWidth(100);
connect(startButton, SIGNAL(clicked()), this, SLOT(startClicked()));
connect(cardTable, SIGNAL(clicked(QModelIndex)), this, SLOT(currentCard(const QModelIndex &)));
QVBoxLayout *verticalLayout = new QVBoxLayout;
verticalLayout->addWidget(cardTable);
verticalLayout->addWidget(startButton);
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addLayout(verticalLayout, 0, 0, 1, 1);
setLayout(mainLayout);
setUpComputerIcons();
setUpDeckIcons();
myGame = new Game(this);
}
void Canvas::setUpPlayerIcons(string *pString)
{
QPixmap qpx;
QSize iconSize;
string str;
for (int i = 0; i < MAXCARDS; i++)
{
cardIconPlayer[i] = new QLabel(cardTable);
str = pString[i];
qpx = QPixmap(str.c_str());
iconSize = qpx.size();
iconSize.scale(190, 276, Qt::KeepAspectRatio);
QPixmap scaledImage = qpx.scaled(iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
cardIconPlayer[i]->setPixmap(scaledImage);
cardIconPlayer[i]->move(20 + 60 * i, 350);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks