Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    Unsolved Using QPainterPath to generate more complex "images"

    General and Desktop
    5
    9
    183
    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.
    • F
      frnklu20 last edited by

      does someone ave any tip to use QPainterPath to generate more complex "images" like these:![0_1567108141666_bitmap.png]

      0_1567108177625_bitmap.png

      0_1567108160472_reactor.png

      0_1567108200952_carga.png

      0_1567108219992_gerador.png

      0_1567108244336_trafo.png

      Is there a program that i can use to generate the path?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        What is your use case ?

        It looks like you should rather use an painting application like Inkscape or Gimp to create them and then te-use the images in your application.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • F
          frnklu20 last edited by

          Hi,

          I created this images with inkscape, but i have the option to enlarge the diagramscene where i put these items. And when i apply the transfomations to zoom in, the images loose quality
          so i wondered if using the QPolygonF my problems would be solved.

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Why not use a SVG image ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 2
            • mrjj
              mrjj Lifetime Qt Champion last edited by

              Hi
              With SVG format and
              https://doc.qt.io/qt-5/qgraphicssvgitem.html#details
              zooming/enlarging should be possible without any loss of quality.

              1 Reply Last reply Reply Quote 0
              • fcarney
                fcarney last edited by fcarney

                Set sourceSize (height and width) or feed it Qt.size(x,y). Make this value as high as dimensions of object to maintain quality. Be careful setting it to the Image{} size as it will cause errors. Use external size to set the width and height.

                For instance:

                Image {
                    id: logo
                
                    // prevent binding loop, calc once
                    property int calcHeight: parent.height*0.66
                   
                    height: calcHeight
                    fillMode: Image.PreserveAspectFit    
                    
                    source: "logo.svg"
                    // make it look right
                    smooth: true
                    antialiasing: true
                    // this is needed to make the sampling decent
                    // 1x will work as well    
                    sourceSize.height: calcHeight
                }
                

                C++ is a perfectly valid school of magic.

                1 Reply Last reply Reply Quote 0
                • F
                  frnklu20 last edited by

                  when i put

                  #include <QGraphicsSvgItem>
                  

                  it gives me the error "diagramitem.h:5:10: error: 'QGraphicsSvgItem' file not found"

                  1 Reply Last reply Reply Quote 0
                  • M
                    mpergand last edited by mpergand

                    If I'm looking at the doc, I see:

                    Header: #include <QGraphicsSvgItem> 
                    qmake: QT += svg
                    

                    Have you add this to your pro file ?

                    1 Reply Last reply Reply Quote 0
                    • M
                      mpergand last edited by mpergand

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post