Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to achieve the size of video changes as the size of dialog changes?
Forum Updated to NodeBB v4.3 + New Features

How to achieve the size of video changes as the size of dialog changes?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
6 Posts 3 Posters 2.5k Views 1 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.
  • E Offline
    E Offline
    EricLiii
    wrote on last edited by
    #1

    Hi All,

    I am a newbie to Qt. Now I have succeeded to play a video on a dialog. However, when I changed the size of dialog, the size of video didn't change. Please refer to the screenshot below.

    0_1535016694724_1.png

    The following is part of my code.

    0_1535016812182_2.png

    I used 'resize' to set up the size of video. If I comment the line 26, the dialog cannot show the full video.

    0_1535017078600_3.png

    So, anyone can help me to solve this problem? Btw, I use Qt5.

    Thanks!

    JonBJ 1 Reply Last reply
    0
    • E EricLiii

      Hi All,

      I am a newbie to Qt. Now I have succeeded to play a video on a dialog. However, when I changed the size of dialog, the size of video didn't change. Please refer to the screenshot below.

      0_1535016694724_1.png

      The following is part of my code.

      0_1535016812182_2.png

      I used 'resize' to set up the size of video. If I comment the line 26, the dialog cannot show the full video.

      0_1535017078600_3.png

      So, anyone can help me to solve this problem? Btw, I use Qt5.

      Thanks!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @EricLiii
      I assume when you don't specify any size on the QVideoWidget it takes up its "natural" size, which is larger than the dialog.

      You set its initial size. I presume you need to override http://doc.qt.io/qt-5/qdialog.html#resizeEvent and resize the QVideoWidget accordingly. You might also be interested in setting the QVideoWidget's setMinimum/MaximumSize() too.

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

        Hi,

        Why not put your QVideoWidget inside a layout applied to your dialog ? The resizing will be donne automatically.

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

        E 1 Reply Last reply
        3
        • JonBJ JonB

          @EricLiii
          I assume when you don't specify any size on the QVideoWidget it takes up its "natural" size, which is larger than the dialog.

          You set its initial size. I presume you need to override http://doc.qt.io/qt-5/qdialog.html#resizeEvent and resize the QVideoWidget accordingly. You might also be interested in setting the QVideoWidget's setMinimum/MaximumSize() too.

          E Offline
          E Offline
          EricLiii
          wrote on last edited by
          #4

          @JonB
          Thanks for your help! I have solved this problem by using resizeEvent.
          Thank you very much!

          JonBJ 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Why not put your QVideoWidget inside a layout applied to your dialog ? The resizing will be donne automatically.

            E Offline
            E Offline
            EricLiii
            wrote on last edited by
            #5

            @SGaist
            Thanks for your help!
            I have solved this problem by using resizeEvent. I will try your method later. But for now I prefer to finish my project asap.
            Anyway, thank you very much!

            1 Reply Last reply
            0
            • E EricLiii

              @JonB
              Thanks for your help! I have solved this problem by using resizeEvent.
              Thank you very much!

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @EricLiii
              Good. In the long- (short-) term, if @SGaist says a layout will auto-resize your image for you that will undoubtedly be easiest.

              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