[Qt-interest] How enforce aspect ratio of QGLWidget in QLayout?
Jason H
scorp1us at yahoo.com
Fri Sep 10 19:24:07 CEST 2010
Qxt's QxtLetterBox widget (container for any QWidget)
----- Original Message ----
From: Ed Sutton <ESutton at fescorp.com>
To: Qt-interest Interest <qt-interest at trolltech.com>
Sent: Fri, September 10, 2010 9:24:43 AM
Subject: [Qt-interest] How enforce aspect ratio of QGLWidget in QLayout?
When main window is resized, I want to enforce the aspect ratio of video
displayed in a QGLWidget. My first attempt implemented this in
GLWidget::resizeGL() by adjusting the glViewport width and height. This sort of
worked but left black bars at either the top or side and when I changed channels
to a new aspect ration video, it would not fix itself because no resize called.
I think the correct approach must be to control the size of the GLWidget rather
than the glViewport. Do I need to implement this is the BorderLayout that the
GLWidget was added to?
Thanks in advance for any tips or direction,
-Ed
/// Widget to handle reception of video and render as a OpenGl 2-D texture
class GLWidget : public QGLWidget
{
protected:
// storage for one texture - the video frame bitmap
GLuint m_texture[1];
int m_width;
int m_height;
void initializeGL();
void paintGL();
void resizeGL(int width, int height);
};
// Border layout contains a channel selector to the right of the video window
class BorderLayout : public QLayout
{
};
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list