diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-04-28 13:50:07 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-04-28 15:40:01 +0200 |
commit | b68d0688feb7b01eca91b33566887200de7fc89a (patch) | |
tree | beea61f9177f2b07208a39d16887123a5b99372a /examples/opengl | |
parent | 33e1b8dda549630a6b782fa465b21f0c4f269280 (diff) |
Add resize event support to QWindow.
(cherry picked from commit 12b4e7e5a2b18cdd23f540821e1f2785f62b0b9a)
Diffstat (limited to 'examples/opengl')
-rw-r--r-- | examples/opengl/hellowindow/hellowindow.cpp | 7 | ||||
-rw-r--r-- | examples/opengl/hellowindow/hellowindow.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index 6de48e8c95..b0576c1255 100644 --- a/examples/opengl/hellowindow/hellowindow.cpp +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -34,6 +34,13 @@ void HelloWindow::mousePressEvent(QMouseEvent *) updateColor(); } +void HelloWindow::resizeEvent(QResizeEvent *) +{ + glContext()->makeCurrent(); + + glViewport(0, 0, geometry().width(), geometry().height()); +} + void HelloWindow::updateColor() { float colors[][4] = diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h index b0adecbb10..f0b8ee8b45 100644 --- a/examples/opengl/hellowindow/hellowindow.h +++ b/examples/opengl/hellowindow/hellowindow.h @@ -13,6 +13,7 @@ public: protected: void mousePressEvent(QMouseEvent *); + void resizeEvent(QResizeEvent *); private slots: void render(); |