#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()));
|
}
|