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. Creating a new drawing device based on QPaintEngine + QPaintDevice ...
Forum Updated to NodeBB v4.3 + New Features

Creating a new drawing device based on QPaintEngine + QPaintDevice ...

Scheduled Pinned Locked Moved Unsolved General and Desktop
30 Posts 5 Posters 3.0k Views 2 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.
  • Yuri34Y Offline
    Yuri34Y Offline
    Yuri34
    wrote on last edited by
    #1

    Good afternoon colleagues !

    There is a need to create a class of a new drawing device similar to QWidget, QPrinter, ... !
    The goal is to write a class that will allow you to load svg into it and generate lists of primitives QPainterPath::ElementType:: at the output... to convert them to g-code!
    I understand that this is the interaction of the QPaint + QPaintEngine + QPaintDevice classes ! But the question is precisely in the nuances of interaction and implementation !

    Who has experience writing such classes ? We need consultations on the course of implementation !

    Sincerely, Yuri.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you consider the Qt Svg module as a starting point ?

      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
      • Yuri34Y Offline
        Yuri34Y Offline
        Yuri34
        wrote on last edited by
        #3

        Good day !

        Of course!
        That 's what I was considering !
        But my task is to get a set of primitives (QPainterPath::ElementType:: ...), and not to draw or create an SVG file!
        Therefore, the idea of creating a new drawing device arose.

        Sincerely, Yuri.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That I understood, I was thinking of the use of the parser to get the data you want.

          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
          • Yuri34Y Offline
            Yuri34Y Offline
            Yuri34
            wrote on last edited by
            #5

            Good afternoon!

            After a little digging, I got this sketch - https://gitlab.com/z34x/codemaker.git

            Something certainly turned out ! But there are no fewer questions :) !

            And so :

            1 I understand that inheritance should be something like this.
            2 I understand that the use of objects of the successor classes QPaintDevice, QPaintEngine and QPainter should happen like this.

            3 I don 't understand how to set linear dimensions to the heir of QPaintDevice ! It would be logical that it would be the successor of QPaintDevice that would have virtual methods with which the parameters of the device to which the output occurs are changed (linear dimensions, units of measurement ...)! But I understand that my logic here conflicts with reality. :)
            4. I don't understand what to do in the begin() and end() methods when inheriting, for example, the QPaintDevice class. :)

            That's what I want to say - sign me up for courses on Qt :)))) ! Well , or explain to the ignorant ...
            Unfortunately, I have not found a solution to such a problem on the web, but I really want to learn how to write device classes! :)

            Well, as a consequence, I manage to convert one of the svg files that is in the /in subdirectory and its converted image to /out! It's called Petya.svg! But it is not possible to convert the rest ! The reason is clear to me in the rest there is a g< > tag ! But how to solve this problem is not clear ! :)

            In short , there are many questions ...

            Sincerely, Yuri.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Just to get thing correctly, you want to program a CNC out of a SVG file ?

              In that case, why create a new painting system ? It seems to me that you should parse the svg and convert it to g-code directly rather than trying to "paint" g-code. Maybe I missed something though.

              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
              • Yuri34Y Offline
                Yuri34Y Offline
                Yuri34
                wrote on last edited by Yuri34
                #7

                Good day !

                Yes! That 's about how it is !
                It 's really CNC !
                Parsing and converting to g-code is what I can do now! I 'm interested in doing it in the Qt style ! If you look carefully , all the stages of conversion to Qt are already being done ! It is only necessary to understand and correctly formalize the interaction of class objects !
                This is exactly my task !
                Since I want to learn how to write output devices based on QPaintDevice !

                Sincerely, Yuri.

                1 Reply Last reply
                0
                • Yuri34Y Offline
                  Yuri34Y Offline
                  Yuri34
                  wrote on last edited by
                  #8

                  Unfortunately, Qt specialists do not advise on the use of their classes in open source projects (or I am not aware of this)! I would be very grateful if you would recommend a person to whom I could address my questions privately ! Naturally, I am ready to compensate for the time spent on me with payment! :)

                  Sincerely, Yuri.

                  SGaistS 1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mchinand
                    wrote on last edited by
                    #9

                    Did you look at the SVG module (the source code, not just the classes and their methods) like @SGaist recommended? That takes an SVG file and ultimately draws it to the screen. I don't know the details of its implementation, it might already do pretty close to what you want.

                    Yuri34Y 1 Reply Last reply
                    0
                    • Yuri34Y Yuri34

                      Unfortunately, Qt specialists do not advise on the use of their classes in open source projects (or I am not aware of this)! I would be very grateful if you would recommend a person to whom I could address my questions privately ! Naturally, I am ready to compensate for the time spent on me with payment! :)

                      Sincerely, Yuri.

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Yuri34 said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                      Unfortunately, Qt specialists do not advise on the use of their classes in open source projects (or I am not aware of this)!

                      I am not following you on this one. Can you clarify ?

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

                      Yuri34Y 1 Reply Last reply
                      0
                      • M mchinand

                        Did you look at the SVG module (the source code, not just the classes and their methods) like @SGaist recommended? That takes an SVG file and ultimately draws it to the screen. I don't know the details of its implementation, it might already do pretty close to what you want.

                        Yuri34Y Offline
                        Yuri34Y Offline
                        Yuri34
                        wrote on last edited by
                        #11

                        @mchinand said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                        Did you look at the SVG module (the source code, not just the classes and their methods) like @SGaist recommended? That takes an SVG file and ultimately draws it to the screen. I don't know the details of its implementation, it might already do pretty close to what you want.

                        Good day !

                        Of course I watched and continue to watch , but unfortunately I haven 't found anything that would answer my questions yet !

                        Sincerely, Yuri.

                        1 Reply Last reply
                        0
                        • SGaistS SGaist

                          @Yuri34 said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                          Unfortunately, Qt specialists do not advise on the use of their classes in open source projects (or I am not aware of this)!

                          I am not following you on this one. Can you clarify ?

                          Yuri34Y Offline
                          Yuri34Y Offline
                          Yuri34
                          wrote on last edited by
                          #12

                          @SGaist said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                          @Yuri34 said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                          Unfortunately, Qt specialists do not advise on the use of their classes in open source projects (or I am not aware of this)!

                          I am not following you on this one. Can you clarify ?

                          Of course!

                          I meant that I still could not find a high - quality consultation option from Qt ! If I didn 't buy a professional developer license !
                          My efforts have not yet yielded the necessary result because I do not have enough knowledge in the nuances of working with Qt classes ! In parallel, I continue to try to solve my problem, I try to gain experience in Qt and I am looking for a person who could advise me qualitatively!

                          Sincerely, Yuri.

                          jsulmJ 1 Reply Last reply
                          0
                          • Yuri34Y Yuri34

                            @SGaist said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                            @Yuri34 said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                            Unfortunately, Qt specialists do not advise on the use of their classes in open source projects (or I am not aware of this)!

                            I am not following you on this one. Can you clarify ?

                            Of course!

                            I meant that I still could not find a high - quality consultation option from Qt ! If I didn 't buy a professional developer license !
                            My efforts have not yet yielded the necessary result because I do not have enough knowledge in the nuances of working with Qt classes ! In parallel, I continue to try to solve my problem, I try to gain experience in Qt and I am looking for a person who could advise me qualitatively!

                            Sincerely, Yuri.

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            @Yuri34 said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                            high - quality consultation option from Qt

                            You expect to get this for free?
                            Here you are in a user forum. Most people here do not work for Qt Company and help others in their own time...

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            Yuri34Y 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @Yuri34 said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                              high - quality consultation option from Qt

                              You expect to get this for free?
                              Here you are in a user forum. Most people here do not work for Qt Company and help others in their own time...

                              Yuri34Y Offline
                              Yuri34Y Offline
                              Yuri34
                              wrote on last edited by
                              #14

                              @jsulm said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                              You expect to get this for free?
                              Here you are in a user forum. Most people here do not work for Qt Company and help others in their own time...

                              :) no!
                              I don't expect to be consulted for free !
                              Like all open sources , I understand by reading information on this forum and on many other specialized forums ! Through communication and knowledge sharing !
                              As for the specific problem with solving my task, I am ready to pay (within reasonable limits) for the consultant's efforts!
                              If my proposal violates the rules of the forum - please forgive me !
                              I will not make such statements here anymore !

                              Sincerely, Yuri.

                              jsulmJ 1 Reply Last reply
                              0
                              • Yuri34Y Yuri34

                                @jsulm said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                                You expect to get this for free?
                                Here you are in a user forum. Most people here do not work for Qt Company and help others in their own time...

                                :) no!
                                I don't expect to be consulted for free !
                                Like all open sources , I understand by reading information on this forum and on many other specialized forums ! Through communication and knowledge sharing !
                                As for the specific problem with solving my task, I am ready to pay (within reasonable limits) for the consultant's efforts!
                                If my proposal violates the rules of the forum - please forgive me !
                                I will not make such statements here anymore !

                                Sincerely, Yuri.

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                @Yuri34 OK, I understand. It is perfectly fine to ask for paid support here I think.

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                Yuri34Y 1 Reply Last reply
                                0
                                • jsulmJ jsulm

                                  @Yuri34 OK, I understand. It is perfectly fine to ask for paid support here I think.

                                  Yuri34Y Offline
                                  Yuri34Y Offline
                                  Yuri34
                                  wrote on last edited by
                                  #16

                                  @jsulm said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                                  OK, I understand. It is perfectly fine to ask for paid support here I think.

                                  Ok ! Thanks !
                                  I am glad that we understand each other !

                                  But I would also like to sort out my task ! :)
                                  At the moment there are 2 files : piter.svg and rose.svg from my set of files that are somehow converted by my code and there are many other files that I can't convert with the same code! I 'm doing something wrong and I really want to understand what exactly ! :)

                                  And that 's not even the most important thing ! I want to figure out in general how to write devices based on QPaintDevice correctly! :)

                                  Sincerely, Yuri.

                                  M 1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    mchinand
                                    wrote on last edited by
                                    #17

                                    @Yuri34 said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                                    At the moment there are 2 files : piter.svg and rose.svg from my set of files that are somehow converted by my code and there are many other files that I can't convert with the same code

                                    I would look at the similarities between your two working files compared to your other SVGs. For example, do the non-working files use an SVG feature (e.g., text) that the working ones do not? Does your program crash with the other files or just not generate the correct output?

                                    1 Reply Last reply
                                    0
                                    • Yuri34Y Yuri34

                                      @jsulm said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                                      OK, I understand. It is perfectly fine to ask for paid support here I think.

                                      Ok ! Thanks !
                                      I am glad that we understand each other !

                                      But I would also like to sort out my task ! :)
                                      At the moment there are 2 files : piter.svg and rose.svg from my set of files that are somehow converted by my code and there are many other files that I can't convert with the same code! I 'm doing something wrong and I really want to understand what exactly ! :)

                                      And that 's not even the most important thing ! I want to figure out in general how to write devices based on QPaintDevice correctly! :)

                                      Sincerely, Yuri.

                                      M Offline
                                      M Offline
                                      mchinand
                                      wrote on last edited by mchinand
                                      #18

                                      @Yuri34 said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                                      I want to figure out in general how to write devices based on QPaintDevice correctly

                                      If this is your goal, that's fine but does not seem like it is something that would be useful for generating g-code. A QPaintDevice consists of pixels whereas g-code describes how the tooling (3D printer, CNC, etc. ) should move and is more akin to a vector graphics format.

                                      Yuri34Y 1 Reply Last reply
                                      0
                                      • M mchinand

                                        @Yuri34 said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                                        I want to figure out in general how to write devices based on QPaintDevice correctly

                                        If this is your goal, that's fine but does not seem like it is something that would be useful for generating g-code. A QPaintDevice consists of pixels whereas g-code describes how the tooling (3D printer, CNC, etc. ) should move and is more akin to a vector graphics format.

                                        Yuri34Y Offline
                                        Yuri34Y Offline
                                        Yuri34
                                        wrote on last edited by
                                        #19

                                        @mchinand said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                                        @Yuri34 said in Creating a new drawing device based on QPaintEngine + QPaintDevice ...:

                                        I want to figure out in general how to write devices based on QPaintDevice correctly

                                        If this is your goal, ...

                                        I will try to answer you on points :

                                        1. Of course! I'm analyzing the target svg files, but I don't understand what exactly is causing the problem yet ! But I 'm still doing it !
                                          No! No critical failure occurs - just the code is not generated and that 's it ! If there was a critical failure , that would be my problem ! :) Although it doesn 't make it any easier ! The problem is still mine - I understand perfectly well that it's my misunderstanding of the nuances of the work of the three classes of Paint System :)))

                                        2. I'm sorry! But about QPaintDevice you seem to be mistaken ! This class is quite versatile ! And it allows you to draw on yourself not only pixel graphics , which is directly written in the documentation ! :)

                                        Well , in the end , I still get something ! :)

                                        Sincerely, Yuri.

                                        1 Reply Last reply
                                        1
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #20

                                          Since you have working and non working files you should implement some sort of dump method that is verbose enough to show what happens and where things get wrong.

                                          As for paid support, beside the Qt Company itself, you have enterprises like KDAB and ICS that are known to be very good.

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

                                          Yuri34Y 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