-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabentry.cpp
63 lines (50 loc) · 1.32 KB
/
tabentry.cpp
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
54
55
56
57
58
59
60
61
62
63
#include "tabentry.h"
#include "ui_tabentry.h"
#include <QDebug>
TabEntry::TabEntry(QWidget *parent) :
QWidget(parent),
ui(new Ui::TabEntry) {
ui->setupUi(this);
ui->progressBar->hide();
ui->progressBar->setRange(0, 100);
tooltip = new StemedTooltip(this);
}
TabEntry::~TabEntry() {
delete ui;
}
void TabEntry::setName(QString name) {
ui->checkBox->setText(name);
}
void TabEntry::setIcon(QString icon) {
ui->label->setPixmap(QPixmap(icon));
}
bool TabEntry::isChecked() {
return ui->checkBox->isChecked();
}
void TabEntry::setProgressValue(int value) {
value = (value>100? 100:value);
qDebug()<<"Updating progress bar with "<<value;
ui->progressBar->setValue(value);
}
void TabEntry::showProgressBar(bool visible) {
ui->progressBar->setVisible(visible);
}
void TabEntry::showStatusText(QString text) {
showProgressBar(false);
ui->status->setText(text);
}
bool TabEntry::event(QEvent *ev) {
if (ev->type() == QEvent::ToolTip) {
tooltip->showWindow();
return true;
} else if (ev->type() == QEvent::Leave) {
qDebug()<<"hover leave";
tooltip->hideWindow();
}
return false;
}
void TabEntry::setToolTip(QString name, QString size, QString url) {
tooltip->setName(name);
tooltip->setUrl(url);
tooltip->setSize(size);
}