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. get QOpenGLWidget window size?
Forum Updated to NodeBB v4.3 + New Features

get QOpenGLWidget window size?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 2.6k 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.
  • S Offline
    S Offline
    s002wjh
    wrote on last edited by
    #1

    how do i get the current GUI display size for QOpenGLWidget

    example

    class test : public QOpenGLWidget{
    .....
    }

    pointer_test = new test;
    pointer_test ->setMinimumSize(100,100);

    but this size change when i drag the window around, so like to get the current window size after i dragged.

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

      Hi,

      Moving a window shouldn't resize it.
      What do you do ?
      What does exactly happen ?
      What OS are you running ?
      If Linux what window manager are you using ?
      What version of Qt ?

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

      1 Reply Last reply
      0
      • S s002wjh

        how do i get the current GUI display size for QOpenGLWidget

        example

        class test : public QOpenGLWidget{
        .....
        }

        pointer_test = new test;
        pointer_test ->setMinimumSize(100,100);

        but this size change when i drag the window around, so like to get the current window size after i dragged.

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by JKSH
        #3

        Do you mean "resize" instead of "drag"?

        @s002wjh said in get QOpenGLWidget window size?:

        but this size change when i drag the window around, so like to get the current window size after i dragged.

        QOpenGLWidget inherits QWidget, so you can call QWidget methods.

        https://doc.qt.io/qt-5/qwidget.html#size-prop

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        0
        • S Offline
          S Offline
          s002wjh
          wrote on last edited by
          #4

          actually i just like to know how to get the dimension of the display window.
          if i set

          pointer_test ->setMinimumSize(200,100);

          what function do i used(Qsize?) so Qsize::width() return 200?

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

            What was already suggested by @JKSH.

            Note that you set the minimum size for your widget. That action alone won't make it that size. The next question is: do you want your widget to be resizable ?

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

            1 Reply Last reply
            0
            • S s002wjh

              actually i just like to know how to get the dimension of the display window.
              if i set

              pointer_test ->setMinimumSize(200,100);

              what function do i used(Qsize?) so Qsize::width() return 200?

              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              @s002wjh said in get QOpenGLWidget window size?:

              what function do i used(Qsize?) so Qsize::width() return 200?

              You want to find the widget's size, so you should call the QWidget::size() method.

              So far, your code is calling the QWidget::setMinimumSize() method. Its documentation is at https://doc.qt.io/qt-5/qwidget.html#minimumSize-prop

              Note: QSize is a class.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              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