-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdialoghelper.cpp
More file actions
51 lines (44 loc) · 1.42 KB
/
dialoghelper.cpp
File metadata and controls
51 lines (44 loc) · 1.42 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
#include "dialoghelper.h"
#include "dialogwindow.h"
#include <QLabel>
#include <QMovie>
void DialogHelper::updateBackground(DialogWindow *window, const QString &imagePath)
{
QPixmap backgroundImage(imagePath);
QPalette palette;
palette.setBrush(window->backgroundRole(), backgroundImage);
window->setPalette(palette);
}
void DialogHelper::updateMovieImage(DialogWindow *window, const QString &moviePath)
{
QMovie *movie = new QMovie(moviePath);
window->npcImgLabel->setMovie(movie);
movie->start();
window->npcImgLabel->setAlignment(Qt::AlignCenter);
window->npcImgLabel->show();
window->npcImgLabel->lower();
}
void DialogHelper::updateImageLabel(DialogWindow *window, const QString &imagePngPath)
{
QPixmap image(imagePngPath);
window->npcImgLabel->setPixmap(image);
window->npcImgLabel->setAlignment(Qt::AlignCenter);
window->npcImgLabel->show();
window->npcImgLabel->lower();
}
void DialogHelper::updateLabel(DialogWindow *window, const QString &text, Qt::Alignment alignment, const QString &styleSheet)
{
window->label->setText(text);
window->label->setAlignment(alignment);
window->label->setStyleSheet(styleSheet);
}
void DialogHelper::hideChoiceButtons(DialogWindow *window)
{
window->leftButton->hide();
window->rightButton->hide();
}
void DialogHelper::showChoiceButtons(DialogWindow *window)
{
window->leftButton->show();
window->rightButton->show();
}