Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QOpenGlWidget as viewport of QGraphicsView

QOpenGlWidget as viewport of QGraphicsView

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 5.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    euchkatzl
    wrote on last edited by
    #1

    In my Application i use a QGraphicsView to display several Text(rendered with QGraphicsTextItem) and image items.

    I would like to migrate my application to Qt Version 5.4.

    With Qt 5.3 i used a QGLWidget as viewport for my graphics view to enable open gl rendering.

    Thats simply done by adding the following lines :
    @
    setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
    setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    @

    What is the correct usage with QOpenGLWidget ?
    When i try to set it with :
    @
    setViewport(new QOpenGLWidget(this));
    @

    everything looks very fuzzy. The Text is rendered too big and thin lines(1 pixel) are not even displayed.

    When i use another QSurfaceFormat for my QOpenGLWidget it get a little bit better but i have no idea what are the correct settings.
    @
    QOpenGLWidget* widget = new QOpenGLWidget(this);
    QSurfaceFormat format;
    format.setSamples(4);
    widget->setFormat(format);
    @

    Can anybody tell me how i have to configure my QOpenGLWidget to have quite the same results as with QGLWidget.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      agocs
      wrote on last edited by
      #2

      Yes, the snippet with setSamples() is the correct way to enable 4x antialiasing.

      Which platform is this? Windows? Mac?

      1 Reply Last reply
      0
      • E Offline
        E Offline
        euchkatzl
        wrote on last edited by
        #3

        The Platform is Mac.

        It seems that since Qt 5.4 fonts gets bigger when displaying in an opengl Widget (even with QGLWidget).

        Here are three screenshots that show the differences.

        Without Open GL :

        https://drive.google.com/file/d/0B5fX6ByVLHKDUzAwMU52QkdBaDA/view?usp=sharing

        QOpenGLWidget with qt 5.4 :

        https://drive.google.com/file/d/0B5fX6ByVLHKDN3NEdC1aMzB2ZTQ/view?usp=sharing

        QGLWidget with qt 5.3.2

        https://drive.google.com/file/d/0B5fX6ByVLHKDdUdhYWdvMHpOSm8/view?usp=sharing

        Is there any other setting than setSamples that could improve antialiasing ?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          agocs
          wrote on last edited by
          #4

          You are most likely seeing https://bugreports.qt.io/browse/QTBUG-42861

          1 Reply Last reply
          0
          • E Offline
            E Offline
            euchkatzl
            wrote on last edited by
            #5

            Okay Thank you very much !
            Then i will wait until 5.4.1.

            Hopefully this includes this patch.

            Will this patch also fix the issues with QOpenGLWidget ? Seems that there is only a qtquick file fixed.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              agocs
              wrote on last edited by
              #6

              5.4.1 won't help, it's too late to get any fix in to that.

              Also, the QOpenGLWidget issue needs some more investigation. The fixes only cover Qt Quick for now.

              1 Reply Last reply
              0
              • E Offline
                E Offline
                euchkatzl
                wrote on last edited by
                #7

                Could you please create a new Bug Report for QOpenGlWidget and post the link here ?

                I Think you can describe the bug better as i do.

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  euchkatzl
                  wrote on last edited by
                  #8

                  I've created the Bug Report with a little example.

                  https://bugreports.qt.io/browse/QTBUG-44063

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved