Results 1 to 2 of 2

Thread: cannot exit from fullscreen

  1. #1
    Join Date
    Dec 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default cannot exit from fullscreen

    Hi,
    I am displaying a video using phonon videoplayer.
    Now on double clicking i want it to toggle between fullscreen and normal display.
    i seem to be able to go to fullscreen but am not able to exit out of fullscreen.
    i am pasting relevant portion of the code


    myplayer.h
    -------------

    class MyPlayer : public Phonon::VideoPlayer{
    Q_OBJECT
    public:
    MyPlayer(QWidget *parent=0);
    private slots:
    private:
    protected:
    void mouseDoubleClickEvent(QMouseEvent* e);

    };

    ==
    myplayer.cpp

    MyPlayer::MyPlayer(QWidget *parent)
    :Phonon::VideoPlayer(parent)
    {
    }


    void MyPlayer::mouseDoubleClickEvent(QMouseEvent* e){

    if(videoWidget()->isFullScreen()){
    videoWidget()->exitFullScreen();
    }else{
    videoWidget()->enterFullScreen();
    }
    }

    =======

  2. #2
    Join Date
    Oct 2011
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: cannot exit from fullscreen

    solution:

    // eventFilter
    bool videoPlayer::eventFilter(QObject *obj, QEvent *event)
    {
    QMouseEvent *mouse = static_cast<QMouseEvent *>(event); // mouseEvent

    if (obj == videoWidget) {

    // double clicked to enter full screen or exit full screen
    if (event->type() == QEvent::MouseButtonDblClick) {
    if(mouse->button() == Qt::LeftButton){
    if(!bFull){ // is not full screen and enter full screen
    videoWidget->enterFullScreen();
    bFull = true;
    }
    else{ // exit full screen
    videoWidget->exitFullScreen();
    bFull = false;
    }

    return true;
    }
    }
    else
    return false;
    }
    else
    return videoPlayer::eventFilter(obj, event);

    }


    Added after 9 minutes:


    hello lzyCoder, about my videoWidget is like this:
    Phonon::viddeoWidget *videoWidget = new Phonon::videoWidget(this);
    Last edited by Mr.Simple; 7th October 2011 at 06:38.

Similar Threads

  1. QGraphicsItem to fullscreen
    By medved6 in forum Qt Programming
    Replies: 2
    Last Post: 16th June 2010, 22:54
  2. QMenu bar in FullScreen
    By ppaluch in forum Newbie
    Replies: 0
    Last Post: 14th August 2009, 15:52
  3. fullscreen opengl
    By k2 in forum Qt Programming
    Replies: 4
    Last Post: 30th April 2009, 18:15
  4. mode fullScreen
    By ederbs in forum Qt Programming
    Replies: 4
    Last Post: 20th January 2007, 00:42
  5. Fullscreen
    By dragor in forum Qt Programming
    Replies: 1
    Last Post: 21st February 2006, 21:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.