Ubuntu12.04.4_lts
2023-08-01 961efe36f62f7eba688d504ec0cdf3e1daa4dd74
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "custom.h"
#include <QPropertyAnimation>
 
customDialog::customDialog(QWidget *parent):
    QDialog(parent)
{
    this->setWindowFlags(Qt::FramelessWindowHint);
}
 
bool customDialog::execCustom()
{
    QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry");
    animation->setDuration(0);
    animation->setStartValue(QRect(400,240,0,0));
    animation->setEndValue(QRect(0,0,800,480));
    animation->start(QPropertyAnimation::DeleteWhenStopped);
    this->setAttribute(Qt::WA_DeleteOnClose);
    return(this->exec());
}
 
void customDialog::closeCustom(bool accepted)
{
    (void)accepted;
    this->close();
    /*
    QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry");
    animation->setDuration(0);
    animation->setEndValue(QRect(400,240,0,0));
    animation->start(QPropertyAnimation::DeleteWhenStopped);
 
    if(accepted)
        QTimer::singleShot(0, this, SLOT(accept()));
    else
        QTimer::singleShot(0, this, SLOT(reject()));*/
}
 
void customDialog::WidgetHorizontalScroll(QWidget *widget, int scrollindex)
{
    QPropertyAnimation *animation = new QPropertyAnimation(widget, "geometry");
    animation->setDuration(0);
    QRect rect = widget->geometry();
    animation->setEndValue(QRect((0-scrollindex)*800, rect.y(),
                                 widget->width(), widget->height()));
    animation->start(QPropertyAnimation::DeleteWhenStopped);
}
 
void customDialog::WidgetListScroll(QWidget *widget, int scrollindex)
{
    QPropertyAnimation *animation = new QPropertyAnimation(widget, "geometry");
    animation->setDuration(0);
    QRect rect = widget->geometry();
    animation->setEndValue(QRect(220-scrollindex*580, rect.y(),
                                 widget->width(), widget->height()));
    animation->start(QPropertyAnimation::DeleteWhenStopped);
}
 
void customDialog::buzzer_beep(const int ms)
{
    BuzzerDrv BD;
    BD.BuzzerBeep(ms);
}
 
void customDialog::btn_beep(void)
{
    BuzzerDrv BD;
    BD.BuzzerBeep(50);
}
 
void customDialog::set_btn_beep(QObject *obj, const char *signal)
{
    connect(obj,signal,this,SLOT(btn_beep()));
}
 
void customDialog::set_btn_nobeep(QObject *obj, const char *signal)
{
    disconnect(obj,signal,this,SLOT(btn_beep()));
}