void Notification::slideOut() { QRect screen = getScreenGeometry(); QPropertyAnimation *animation = new QPropertyAnimation(this, "pos"); animation->setDuration(600); animation->setStartValue(this->pos()); animation->setEndValue(QPoint(screen.left() + screen.width(), 30)); animation->start(); QTimer::singleShot(600, this, SLOT(hideAndKill())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { /*****生成主窗口UI*****/ ui->setupUi(this); /*****声明全局变量*****/ saveCount = 1;//Save calib images start with 1 scanSN = -1; isConfigured = false; isProjectorOpened = true; /****生成计时器并连接*****/ timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(readframe())); /****声明相机****/ usebc = false; DHC = new DaHengCamera(this); /****生成对焦辅助窗口****/ fa = new FocusAssistant(); showFocus = false; /*****生成OpenGL窗口并加载*****/ displayModel = new GLWidget(ui->displayWidget); ui->displayLayout->addWidget(displayModel); /*****生成设置窗口并输出默认设置*****/ setDialog = new Set(this);//Initialize the set dialog getSetInfo(); /*****获取屏幕尺寸信息*****/ getScreenGeometry();//Get mian screen and projector screen geometry QDesktopWidget* desktopWidget = QApplication::desktop(); QRect projRect = desktopWidget->screenGeometry(1);//1 represent projector int xOffSet = (projRect.width() - scanWidth)/2 + screenWidth; int yOffSet = (projRect.height() - scanHeight)/2; /*****初始化投影窗口*****/ pj = new Projector(NULL, scanWidth, scanHeight, projectorWidth, projectorHeight, xOffSet, yOffSet);//Initialize the projector pj->move(screenWidth,0);//make the window displayed by the projector pj->showFullScreen(); /*****建立连接*****/ createConnections(); /*****初始化圆点探测*****/ blob = new BlobDetector(); }
void Notification::slideIn() { timer->stop(); QRect screen = getScreenGeometry(); this->setGeometry(screen.left() + screen.width(), 30, this->width(), this->height()); this->show(); QPropertyAnimation *animation = new QPropertyAnimation(this, "pos"); animation->setDuration(600); animation->setStartValue(this->pos()); animation->setEndValue(QPoint(screen.left() + screen.width() - this->width() - 20, 30)); animation->start(); timer->start(5000); }
Notification::Notification(QWidget *parent) : QWidget(parent), ui(new Ui::Notification) { ui->setupUi(this); QRect screen = getScreenGeometry(); this->setGeometry(screen.width(), 30, this->width(), this->height()); this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::ToolTip); this->setAttribute(Qt::WA_ShowWithoutActivating); timer = new QTimer(); connect(timer, SIGNAL(timeout()), this, SLOT(slideOut())); notificationId = notificationNumber++; std::cout << "Creating notification " << notificationId << std::endl; //QGraphicsBlurEffect *blur = new QGraphicsBlurEffect(this); //setGraphicsEffect(blur); }