int val = 1;
{
number.setNum(val);
number.prepend(pics);
number.append(png);
QPixmap image
(original
->scaled
( 1300,
700, Qt
::KeepAspectRatio, Qt
::SmoothTransformation ));
label->setPixmap(image);
int pixwidth = image.width();
int labelwidth = (WIDTH - pixwidth) / 2;
label->setGeometry(labelwidth, SIZEY, pixwidth, 700);
}
void XKCD::OnPrev()
{
val--;
if (val < 1) {val = 0;}
number = number.setNum(val);
number = number.prepend(pics);
number = number.append(png);
QPixmap image
= (original
->scaled
( 1300,
600, Qt
::KeepAspectRatio, Qt
::SmoothTransformation ));
label->setPixmap(image);
int pixwidth = image.width();
int labelwidth = (WIDTH - pixwidth) / 2;
label->setGeometry(labelwidth, SIZEY, pixwidth, 700);
/* Debugging purposes */ std::cout << "Val is now: "<< val << ". The image path is now: " << number.toStdString() << "." << std::endl;
}
int val = 1;
XKCD::XKCD(QWidget *parent)
: QWidget(parent)
{
QString number;
QString png = ".png";
QString pics = "pics/";
number.setNum(val);
number.prepend(pics);
number.append(png);
QPixmap *original=new QPixmap(QString(number));
QPixmap image(original->scaled ( 1300,700, Qt::KeepAspectRatio, Qt::SmoothTransformation ));
QLabel *label = new QLabel(this);
label->setPixmap(image);
int pixwidth = image.width();
int labelwidth = (WIDTH - pixwidth) / 2;
label->setGeometry(labelwidth, SIZEY, pixwidth, 700);
}
void XKCD::OnPrev()
{
val--;
if (val < 1) {val = 0;}
QString number;
QString png = ".png";
QString pics = "pics/";
number = number.setNum(val);
number = number.prepend(pics);
number = number.append(png);
QPixmap *original=new QPixmap(QString(number));
QPixmap image= (original->scaled ( 1300, 600, Qt::KeepAspectRatio, Qt::SmoothTransformation ));
QLabel *label = new QLabel(this);
label->setPixmap(image);
int pixwidth = image.width();
int labelwidth = (WIDTH - pixwidth) / 2;
label->setGeometry(labelwidth, SIZEY, pixwidth, 700);
/* Debugging purposes */ std::cout << "Val is now: "<< val << ". The image path is now: " << number.toStdString() << "." << std::endl;
}
To copy to clipboard, switch view to plain text mode
Bookmarks