| Subject: | QGLWidget inside QScrollBar newbie problem |
|---|---|
| From: | "Alvaro Aguilera" |
| Date: | Tue, 11 Dec 2007 21:06:38 +0100 |
|
Hello everyone, I don't have much experience with QT or OpenGL but I have to make a small program using both of them and perhaps someone here can help me with the first issue I run into. I have a QGLWidget that displays a map using the function glDrawPixels(), this widget is located inside a QScrollArea. Everything works fine until I zoom in a couple of times, if then I try to scroll down, I get a segmentation fault. If I debug the program with gdb, then my whole KDE dies. Here is some code: The main window: /****************************************************************/ glMap = new GLMap(); scrollArea = new QScrollArea; scrollArea->setBackgroundRole(QPalette::Base); scrollArea->setWidget(glMap); setCentralWidget(scrollArea); /****************************************************************/ The GLWidget (GLMap): /****************************************************************/ void GLMap::initializeGL() { glClearColor(255,255,255,255); glShadeModel(GL_FLAT); glDisable(GL_DEPTH_TEST); glPixelZoom( 1.0, 1.0 ); } void GLMap::paintGL() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glDrawPixels(mapWidth, mapHeight, GL_LUMINANCE, GL_UNSIGNED_BYTE, mapBuffer); } QSize GLMap::sizeHint() const { return QSize(ceil(mapWidth*zoomFactor),ceil(mapHeight*zoomFactor)); } void GLMap::zoomIn() { zoomFactor += 0.1; adjustSize(); glPixelZoom(zoomFactor,zoomFactor); updateGL(); } /****************************************************************/ Can anyone tell me what I'm doing wrong? Thanks! Avlaro. |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Easily configure and build Qt with QtBuilder!, Aurelien Regat-Barrel |
|---|---|
| Next by Date: | Re: invokeMethod, Eric Methorst |
| Previous by Thread: | Easily configure and build Qt with QtBuilder!, Aurelien Regat-Barrel |
| Next by Thread: | Re: QGLWidget inside QScrollBar (newbie problem), Brad Howes |
| Indexes: | [Date] [Thread] [Top] [All Lists] |