void DockPanel::initShowHideAnimation() { QStateMachine * machine = new QStateMachine(this); QState * showState = new QState(machine); showState->assignProperty(this,"y", 0); QState * hideState = new QState(machine); //y should change with DockMode changed connect(this, &DockPanel::startHide, [=]{ hideState->assignProperty(this,"y", m_dockModeData->getDockHeight()); }); machine->setInitialState(showState); QPropertyAnimation *showAnimation = new QPropertyAnimation(this, "y"); showAnimation->setDuration(SHOW_ANIMATION_DURATION); showAnimation->setEasingCurve(SHOW_EASINGCURVE); connect(showAnimation,&QPropertyAnimation::finished,this,&DockPanel::onShowPanelFinished); QPropertyAnimation *hideAnimation = new QPropertyAnimation(this, "y"); hideAnimation->setDuration(HIDE_ANIMATION_DURATION); hideAnimation->setEasingCurve(HIDE_EASINGCURVE); connect(hideAnimation,&QPropertyAnimation::finished,this,&DockPanel::onHidePanelFinished); QSignalTransition *st = showState->addTransition(this,SIGNAL(startHide()), hideState); st->addAnimation(hideAnimation); QSignalTransition *ht = hideState->addTransition(this,SIGNAL(startShow()),showState); ht->addAnimation(showAnimation); machine->start(); }
void Manager::createConnections() { if(menu){ QObject::connect(menu, SIGNAL(startShow()), this, SLOT(start())); QObject::connect(menu, SIGNAL(stopShow()), this, SLOT(stop())); } connect(&timer, SIGNAL(timeout()), this, SLOT(showValues())); }
void MediaPreviewWidget::showPreview(PhotoData *photo) { if (!photo || photo->full->isNull()) { hidePreview(); return; } startShow(); _photo = photo; _document = nullptr; resetGifAndCache(); }
void MediaPreviewWidget::showPreview(DocumentData *document) { if (!document || (!document->isAnimation() && !document->sticker())) { hidePreview(); return; } startShow(); _photo = nullptr; _document = document; resetGifAndCache(); }
void DockPanel::onHideStateChanged(int dockState) { bool containsMouse = parentWidget()->geometry().contains(QCursor::pos()); if (dockState == Dock::HideStateShowing) { emit startShow(); } else if (dockState == Dock::HideStateHiding && !containsMouse && !m_menuItemInvoked && !m_previewShown) { emit startHide(); } else { m_menuItemInvoked = false; } }
int Widget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QGLWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: startShow(); break; default: ; } _id -= 1; } return _id; }
Widget::Widget(int delay_before, int delay_after, int max_time, int num_images, QString *serial_device, QString *camera_ip, QString *image_prefix, bool interlace_levels, bool numbers, QWidget *parent, QGLFormat *format, bool rotate, QString *file_list_name) :QGLWidget(*format, parent) , m_current(0) , m_state(Stopped) , m_delay_before(delay_before) , m_delay_after(delay_after) , m_max_time(max_time) , m_num_images(num_images) , m_port_value(0x0) , m_first_run(true) , m_serial_device(serial_device) , m_camera_ip(camera_ip) , m_image_prefix(image_prefix) , m_interlace_levels(interlace_levels) , m_numbers(numbers) , m_rotate(rotate) , m_file_list_name(file_list_name) { setAutoFillBackground(false); makeCurrent(); // Escape shortcut QShortcut *sh = new QShortcut(QKeySequence(trUtf8("Esc")), this); connect(sh, SIGNAL(activated()), this, SLOT(close())); m_total=0; // Info0 QMessageBox::information(this, tr("Info"),tr("HIT 'ESC' to CLOSE")); QString portName(*m_serial_device); listener = new PortListener(portName); // signals get hooked up internally m_direction=1; // Images for( int i=0; i<m_num_images; i++) { QPixmap p; QString fname=*m_image_prefix; fname+=QString("%1.bmp").arg(i, 5, 'f', 0, '0'); bool ret = p.load(fname); if(ret) m_pixmap << p; else m_pixmap << QPixmap(); // empty in case of missing images } // qDebug() << "Loading image:" << i << "=" << ret; // } // create num_images empty images... m_curr_angle = 0; m_draw_count = 0; // m_timer = new QTimer(this); m_timespent= new QElapsedTimer(); m_timelastdraw= new QElapsedTimer(); // connect(m_timer, SIGNAL(timeout()), this, SLOT(update())); // m_timer->setInterval(50); // times a second we paint drawmax frames // if list then open it file_list=false; if(*m_file_list_name!="") { flist= new QFile(); file_list=true; flist->setFileName(*file_list_name); if(!flist->open(QIODevice::ReadOnly)) { qDebug() << "Couldn't open file_list " << *file_list_name; std::exit(1); } //open } QTimer::singleShot(0, this, SLOT(startShow())); }