forked from AttorneyOnline/AO2-Client
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaobutton.cpp
More file actions
36 lines (28 loc) · 1013 Bytes
/
aobutton.cpp
File metadata and controls
36 lines (28 loc) · 1013 Bytes
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
#include "aobutton.h"
#include "debug_functions.h"
#include "file_functions.h"
#include <QDebug>
AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent)
{
ao_app = p_ao_app;
}
AOButton::~AOButton()
{
}
void AOButton::set_image(QString p_image)
{
QString f_image_name = p_image.left(p_image.lastIndexOf(QChar('.')));
QString image_path = ao_app->get_theme_path() + p_image;
QString hover_image_path = ao_app->get_theme_path() + f_image_name + "_hover.png";
QString default_image_path = ao_app->get_default_theme_path() + p_image;
if (file_exists(image_path))
{
if(file_exists(hover_image_path))
this->setStyleSheet("QPushButton {border-image:url(\"" + image_path + "\");}"
"QPushButton:hover {border-image:url(\"" + hover_image_path + "\");}");
else
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
}
else
this->setStyleSheet("border-image:url(\"" + default_image_path + "\")");
}