Commit 30524611 authored by grunau's avatar grunau
Browse files

Fix issues with QtCanvas' sizing

The QtCanvas class didn't previously implement the sizeHint method. As
a result, Qt would allot it no display space if there were other widgets
competing for it (e.g. the main window's central widget).

Now QtCanvas has a sizeHint implementation that returns a size hint that
is in line with what the canvas' getSize method reports. Moreover,
QtCanvas now uses the `Expanding` size policy to inform Qt that it would
like to get as much display space as possible.

git-svn-id: bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent d535d6f9
......@@ -45,6 +45,7 @@ QtCanvas::QtCanvas(const std::string& title,
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// we have our own AutoBufferSwap-mechanism (GLCanvas::setAutoFlush), so disable the one of qt
......@@ -575,5 +576,11 @@ void QtCanvas::setSize(ivec2 newSize) {
QWidget::resize(newSize.x, newSize.y);
QSize QtCanvas::sizeHint() const {
const ivec2& size = getSize();
return QSize(size.x, size.y);
} // namespace
......@@ -84,6 +84,14 @@ public:
virtual void resizeGL(int w, int h);
* Return the recommended size for the canvas.
* This method is called by Qt to determine how much space to allocate to display the canvas.
* The returned size is the same as reported by getSize().
virtual QSize sizeHint() const;
virtual void setSize(ivec2 newSize);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment