QGraphicsScene/QGraphicsView strange behaviour

  • I am not sure whether this is a bug or something I am doing wrong. So I will start here.
    I have a large QGraphicsGridLayout on a QGraphicsLinearLayout.
    If I put the scene/view in main and draw it so it appears in a mainwindow then it draws correctly but then I cant have min and max buttons.
    If I put scene/view in the class so it appears in it's own window then it doesnt complete the drawing fully.

    here's one build function (I have two windows, this is the smaller one).
    @// ***************************************************
    windowLayout = new QGraphicsLinearLayout(Qt::Horizontal);
    grid = new QGraphicsGridLayout(windowLayout);

    for (int i = 0; i < grid->columnCount(); i++)
        grid->setColumnSpacing(i, 1.0);
    setWindowTitle(tr("Weaving Machine Bar Warp Setup"));
    scene = new QGraphicsScene();
    scene->setSceneRect(QRectF(0, 0, 1600, 1000));
    view = new QGraphicsView(scene);
    view->setSceneRect(QRectF(0, 0, 1600, 1000));
    view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    view->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);

    // *******************************************************@

    The screen shows blocks painted in color using addlayoutitem to the grid.

    I have an Image of the screen but don't know how to put tht here. If anyone cares to tell me how to show it here I will or send me an email (mikejenkinson@yahoo.com).

    Why should what is seen via a main window be different when seen through an independent window?



    qxoz:edit "@ tag added"

  • Hi mikejuk,
    Welcome to DevNet.
    For posting an image you can use any image hosting services, and put link here in "picture" tag:


    And for future, when you post code examples put them inside @ tags.

  • Hi
    Thanks so much for the info.

    Further to this:

    Some of the blocks react to double click coded in paintWarps. Now only the blocks within 640*480 get painted but the blocks beyond that respect the double click. Strange. The colour gets changed from white to red and back as you double click, now I have little red islands on a sea of white space.

    Why should only 640*480 get drawn?


    PS Is this a bug does one think?

  • Hers the screen shot


    the grey area is 640*480. the numbers top and side run to 64 in each direction!


  • another strangeness:
    filled rectangles get painted properly QPixmaps dont

Log in to reply