Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. fullscreen button for particular widget

fullscreen button for particular widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 2.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    abhay
    wrote on last edited by
    #1

    Hello!! I am trying to create a media player using Qt.I want to place a button for fullscreen mode.When I use the below code fullscreen works perfectly.

    QWidget::showMaximized();
    

    But I want to show only video widget like in the case of Vlc player.When I change my code to

    ui->video->showMaximized();
    

    the above code no error occurs but its not working at all(assuming I have a widget named 'video').So,how can I create a pushbutton for maximizing a particular widget only.(In my case video widget)?Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Any chance that ui-video is inside a layout ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      1
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by Chris Kawa
        #3

        You can only make windows fullscreen, so you need to first make your widget a window:

        ui->video->setWindowFlags(Qt::Window);
        ui->video->showMaximized();
        

        and to go back make it a widget again:

        ui->video->setWindowFlags(Qt::Widget);
        ui->video->show();
        
        1 Reply Last reply
        2
        • SGaistS SGaist

          Hi,

          Any chance that ui-video is inside a layout ?

          A Offline
          A Offline
          abhay
          wrote on last edited by
          #4

          @SGaist yeah it's inside a horizontal layout.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved