Skip to content

Commit

Permalink
Have a QgGL resizeEvent also update the width and height
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Aug 4, 2023
1 parent 8f694c6 commit 38e43ad
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/qtcad/QgGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class QTCAD_EXPORT QgGL : public QOpenGLWidget, protected QOpenGLFunctions
protected:
void paintGL() override;
void resizeGL(int w, int h) override;
void resizeEvent(QResizeEvent *e) override;

void keyPressEvent(QKeyEvent *k) override;
void mouseMoveEvent(QMouseEvent *e) override;
Expand Down
19 changes: 19 additions & 0 deletions src/libqtcad/QgGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,25 @@ void QgGL::resizeGL(int, int)
emit changed();
}

void QgGL::resizeEvent(QResizeEvent *e)
{
QOpenGLWidget::resizeEvent(e);
if (!dmp || !v)

return;
dm_set_width(dmp, width());
dm_set_height(dmp, height());
v->gv_width = width();
v->gv_height = height();
dm_configure_win(dmp, 0);
if (ifp) {
fb_configure_window(ifp, v->gv_width, v->gv_height);
}
if (dmp)
dm_set_dirty(dmp, 1);
emit changed();
}

void QgGL::need_update()
{
bv_log(4, "QgGL::need_update");
Expand Down

0 comments on commit 38e43ad

Please sign in to comment.