Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    QtQuick antialiasing

    QML and Qt Quick
    4
    8
    8560
    Loading More Posts
    • 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.
    • D
      danilo2 last edited by

      Hi!
      I'm new to qtquick 2.0 and I'm playing with some examples.
      Lets look into the example shipped with qt - how to draw bezeir curve. The curve is drawnm but it is not antialiased.

      Is it possible (if yes, how?) to antialias thinks drawn with qtquick?

      1 Reply Last reply Reply Quote 0
      • D
        danilo2 last edited by

        Hi!
        I've found the solution.
        In the shipped example QSurfaceFormat is not used. If you use it like this:
        @
        QQuickView view;
        QSurfaceFormat format;
        format.setSamples(16);
        view.setFormat(format);
        ...@

        The picture is antialiased

        1 Reply Last reply Reply Quote 0
        • J
          Jens last edited by

          You can set the "antialiasing" property to true on any item, including the Canvas. From the documentation:

          "Primarily used in Rectangle and image based elements to decide if the item should use antialiasing or not. Items with antialiasing enabled require more memory and are potentially slower to render.

          The default is false"

          I think the default should really be true for some items like the Canvas at least.

          1 Reply Last reply Reply Quote 0
          • D
            danilo2 last edited by

            I tested the Rectagle item with antialiasung property set to true and it was not antialiased until I used the QSurfaceFormat.
            Additional - there is no info about how this antialiasing will be created - using this property, it would be (theoretically) multisampled? With how many samples?

            1 Reply Last reply Reply Quote 0
            • C
              capisce last edited by

              The Rectangle item should get antialiased without changing the QSurfaceFormat, it doesn't use multisampling. Of course it will only be antialiased if it has a rounded corner (a radius set), otherwise there's nothing to antialias.

              A bezier curve however is a custom item and will probably need multisampling to be antialiased, it all depends on how it is being rendered.

              1 Reply Last reply Reply Quote 0
              • D
                danilo2 last edited by

                @capisce: the ROTADED box without radius is not being antialiased.

                1 Reply Last reply Reply Quote 0
                • C
                  capisce last edited by

                  It should be, if you do "antialiasing: true" in the Rectangle. Here's an example, run it with qmlscene:

                  @
                  import QtQuick 2.0

                  Rectangle {
                  width: 800
                  height: 600

                  Rectangle {
                      x: 200
                      y: 200
                      width: 400
                      height: 200
                      rotation: 20
                      antialiasing: true
                      color: "red"
                  
                      MouseArea {
                          anchors.fill: parent
                          onPressed: { parent.antialiasing = !parent.antialiasing }
                      }
                  }
                  

                  }
                  @

                  1 Reply Last reply Reply Quote 0
                  • A
                    alizadeh91 last edited by

                    but there is a problem with antialiasing property in qtquick2.0. It usage high CPU in animating objects. For resolving that i have changed my graphic card settings instead of antialiasing property.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post