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. Using QPainterPath to generate more complex "images"
Forum Updated to NodeBB v4.3 + New Features

Using QPainterPath to generate more complex "images"

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 929 Views 3 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.
  • F Offline
    F Offline
    frnklu20
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • F Offline
        F Offline
        frnklu20
        wrote on last edited by
        #3

        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
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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
          2
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            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
            0
            • fcarneyF Offline
              fcarneyF Offline
              fcarney
              wrote on last edited by fcarney
              #6

              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
              0
              • F Offline
                F Offline
                frnklu20
                wrote on last edited by
                #7

                when i put

                #include <QGraphicsSvgItem>
                

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

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mpergand
                  wrote on last edited by mpergand
                  #8

                  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
                  0
                  • M Offline
                    M Offline
                    mpergand
                    wrote on last edited by mpergand
                    #9
                    This post is deleted!
                    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