get QOpenGLWidget window size?
-
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.
-
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 ? -
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.
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.
-
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 ?
-
actually i just like to know how to get the dimension of the display window.
if i setpointer_test ->setMinimumSize(200,100);
what function do i used(Qsize?) so Qsize::width() return 200?
@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-propNote:
QSize
is a class.