PathDeformWidget::PathDeformWidget(QWidget *parent, bool smallScreen) : QWidget(parent) { setWindowTitle(tr("Vector Deformation")); m_renderer = new PathDeformRenderer(this, smallScreen); m_renderer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // Layouts QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->addWidget(m_renderer); m_controls = new PathDeformControls(0, m_renderer, smallScreen); m_controls->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); if (!smallScreen) mainLayout->addWidget(m_controls); m_renderer->loadSourceFile(":res/deform/pathdeform.cpp"); m_renderer->loadDescription(":res/deform/pathdeform.html"); m_renderer->setDescriptionEnabled(false); connect(m_renderer, SIGNAL(clicked()), this, SLOT(showControls())); connect(m_controls, SIGNAL(okPressed()), this, SLOT(hideControls())); connect(m_controls, SIGNAL(quitPressed()), QApplication::instance(), SLOT(quit())); }
/** * private constructor */ MediaApp::MediaApp() : QWidget(), m_libraryOpened(false) { m_player = new Player(this); m_playlist = new Playlist(this); m_albumWidget = new AlbumWidget(this); m_albumWidget->LoadImage("Player", "The"); m_albumWidget->setGeometry(46, 16, 300, 300); connect(m_player, SIGNAL(positionChanged()), this, SLOT(onPositionChanged())); connect(m_player, SIGNAL(stateChanged()), this, SLOT(onStateChanged())); m_baseDir = QLatin1String("."); m_fullScreenTimer.setSingleShot(true); connect(&m_fullScreenTimer, SIGNAL(timeout()), this, SLOT(hideControls())); QHBoxLayout* mainLayout = new QHBoxLayout(); mainLayout->setContentsMargins(0, 0, 0, 0); createUI(mainLayout); setLayout(mainLayout); onStateChanged(); setWindowTitle(tr("ThePlayer")); resize(700, 400); }
MediaApp::MediaApp(QWidget *parent) : QWidget(parent) { //create the player m_player = new Player(this); connect(m_player, SIGNAL(positionChanged()), this, SLOT(onPositionChanged())); connect(m_player, SIGNAL(stateChanged()), this, SLOT(onStateChanged())); //m_baseDir is used to remember the last directory that was used. //defaults to the current working directory m_baseDir = QLatin1String("."); //this timer (re-)hides the controls after a few seconds when we are in fullscreen mode m_fullScreenTimer.setSingleShot(true); connect(&m_fullScreenTimer, SIGNAL(timeout()), this, SLOT(hideControls())); //create the UI QVBoxLayout *appLayout = new QVBoxLayout; appLayout->setContentsMargins(0, 0, 0, 0); createUI(appLayout); setLayout(appLayout); onStateChanged(); //set the controls to their default state setWindowTitle(tr("QtGStreamer example player")); resize(400, 400); }
/** * function changes app's view to fullscreen */ void MediaApp::toggleFullScreen() { if (isFullScreen()) { setMouseTracking(false); m_player->setMouseTracking(false); m_fullScreenTimer.stop(); showControls(); showNormal(); } else { setMouseTracking(true); m_player->setMouseTracking(true); hideControls(); showFullScreen(); } }
void MyVis::mouseMoveEvent(QMouseEvent *e) { if ( cursorTim.isActive() ) cursorTim.stop(); setCursor( Qt::ArrowCursor ); if ( isFullScreen() ) { if ( e->y() > height() - 70 && e->y() < height() - 5 ) showControls(); else hideControls(); if ( isFullScreen() ) cursorTim.start( 1500 ); } }
PathStrokeWidget::PathStrokeWidget(bool smallScreen) { setWindowTitle(tr("Path Stroking")); // Widget construction and property setting m_renderer = new PathStrokeRenderer(this, smallScreen); m_controls = new PathStrokeControls(0, m_renderer, smallScreen); // Layouting QHBoxLayout *viewLayout = new QHBoxLayout(this); viewLayout->addWidget(m_renderer); if (!smallScreen) viewLayout->addWidget(m_controls); m_renderer->loadSourceFile(":res/pathstroke/pathstroke.cpp"); m_renderer->loadDescription(":res/pathstroke/pathstroke.html"); connect(m_renderer, SIGNAL(clicked()), this, SLOT(showControls())); connect(m_controls, SIGNAL(okPressed()), this, SLOT(hideControls())); connect(m_controls, SIGNAL(quitPressed()), QApplication::instance(), SLOT(quit())); }