Menu

QMathGL in a QScrollArea: resizing crashes

Help
SImon
2012-03-15
2012-10-16
  • SImon

    SImon - 2012-03-15

    Hi there,

    I have a Qt test program with a main window with a QScrollArea, with a QMathGL
    widget (graph) as child.

    The program crashes (exits) if i try to resize the main window (no scollbars
    appear).

    If I set

    graph->autoResize = true
    

    , nothing crashes but graph just adopts its parent size and rescales. Still no
    scrollbars.

    Why does the program crash with resizing? What is the best approach?

    Thank you!

     
  • SImon

    SImon - 2012-03-15

    By the way, it QMathGL does work with QSplitter as parent container

     
  • SImon

    SImon - 2012-03-15

    The crash is caused by a segmentation fault.

    Not that that is very helpful ;)

     
  • SImon

    SImon - 2012-03-15

    Ok, narrowed it down to the calling of resize(int, int)

    void QMathGL::resizeEvent(QResizeEvent *ev)
    {
            if (autoResize && ev->size().width() > 0 && ev->size().height() > 0) {
                graph->SetSize(ev->size().width(), ev->size().height());
                update();
            } else {
                resize(graph->GetWidth(), graph->GetHeight()); // this causes the exit
            }
    }
    
     
  • SImon

    SImon - 2012-03-15

    Ha, cool! Its causing an infinite loop of resizing! (Probably still caused by
    the construction within the parent QScrollArea)

     
  • SImon

    SImon - 2012-03-15

    Still no luck with the scrollbars though. Seems that the parent QScrollArea
    doesn't see the size of its child QMathGL.

     
  • Nobody/Anonymous

    Checked it out: Looks like a result of working with QDesigner forms...

    But why?

    Anyway, I'll try to re-implement without using the form designer...

     
  • Nobody/Anonymous

    Ok, not using QDesigner works great!!!

     
  • Alexey Balakin

    Alexey Balakin - 2012-03-20

    Which version do you use? Because I was comment this call sometime ago (at
    least in SVN version).

     
  • SImon

    SImon - 2012-03-21

    I use
    Qt Creator 2.2.1
    with
    QMake version 2.01a
    using
    Qt version 4.7.4 in /usr/lib/x86_64-linux-gnu
    on
    Ubuntu.

     
  • Alexey Balakin

    Alexey Balakin - 2012-03-22

    No, the question was -- do you try latest SVN version?

     
  • SImon

    SImon - 2012-03-23

    Oh, excuse me. Using Ubuntu package mathgl 1.11.2-2ubuntu1.

     

Log in to post a comment.