manualviewerdlg.cpp
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <QImageReader>
#include <QDebug>
#include "manualviewerdlg.h"
#include "ui_manualviewerdlg.h"
ManualViewerDlg::ManualViewerDlg(QWidget *parent, uint32_t start) :
QDialog(parent),
ui(new Ui::ManualViewerDlg)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
this->setFocus();
m_nCurPage = start;
if(m_nCurPage<1 || m_nCurPage > MAX_MANUAL_PAGE) m_nCurPage = 1;
//ui->ctrLbManual->setScaledContents(true);
QPixmap image(QString("/prime/manual/manual-%1.png").arg(m_nCurPage,2,10,QLatin1Char('0')));
ui->ctrLbManual->setPixmap(image);
}
ManualViewerDlg::~ManualViewerDlg()
{
delete ui;
}
void ManualViewerDlg::on_backButton_clicked()
{
deleteLater();
}
void ManualViewerDlg::on_leftButton_clicked()
{
m_nCurPage--;
if(m_nCurPage<1) m_nCurPage=MAX_MANUAL_PAGE;
QPixmap image(QString("/prime/manual/manual-%1.png").arg(m_nCurPage,2,10,QLatin1Char('0')));
ui->ctrLbManual->setPixmap(image);
//ui->ctrLbManual->setPixmap(image.scaled(ui->ctrLbManual->size(),Qt::KeepAspectRatio, Qt::SmoothTransformation));
}
void ManualViewerDlg::on_rightButton_clicked()
{
m_nCurPage++;
if(m_nCurPage > MAX_MANUAL_PAGE) m_nCurPage = 1;
QPixmap image(QString("/prime/manual/manual-%1.png").arg(m_nCurPage,2,10,QLatin1Char('0')));
// QPixmap scale = image.scaled(ui->ctrLbManual->size(),Qt::KeepAspectRatio, Qt::SmoothTransformation);
// qDebug() << image.size();
// qDebug() << scale.size();
// ui->ctrLbManual->setPixmap(image.scaled(ui->ctrLbManual->size(),Qt::KeepAspectRatio, Qt::SmoothTransformation));
ui->ctrLbManual->setPixmap(image);
}