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.
  • 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
                          • SGaistS SGaist

                            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.

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

                            Good day !

                            Ooo! Thank you so much for the tip on the options for counseling ! I will try ...

                            As for debugging the code and getting a clearer picture of how Qt classes work - yes , of course ! That 's what I 'm doing ! But so far the results are insignificant ! :)

                            But in any case - thank you for your advice !!!

                            Sincerely, Yuri.

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

                              Good day !

                              And so ! :)
                              Part of my weekend was devoted to trying to solve my puzzle ! :)

                              As a result :

                              1. it is clear that SVG prevents my code from converting files - this is transform="translate(... ...)" ! Files where there are no transformations , as they were the success that I had from the very beginning ! :)
                                But I am absolutely sure that this is just because I use the methods of the Qt Paint System classes poorly ! Since when working with , for example , QImage , the same files are drawn perfectly !
                                I became even more convinced that it is necessary to seek competent help from specialists who work with SVG and can advise on the methods of the Qt Paint System classes or understand the source code. :)))

                              2. I looked very carefully at the ICS resource! Judging by the information on their website, they are just VERY competent in Qt (just cool)! And of course I wrote to them ! I even signed up for a free QML course :), but unfortunately I have not yet received an answer both to the desire to learn from them and to the question I asked! I'll be waiting...

                              3. And finally - special thanks to SGaist - for advising me the ICS resource! And in general for the reaction to my questions ! :)

                              Sincerely, Yuri.

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

                                Good day !

                                Can one of my colleagues tell me how to properly overload the methods virtual void QPaintEngine::updateState(const QPaintEngineState &state) and virtual int QPaintDevice::metric(PaintDeviceMetric metric) const ?

                                Or where can I see examples of their overload ?

                                Sincerely, Yuri.

                                JonBJ 1 Reply Last reply
                                0
                                • Yuri34Y Yuri34

                                  Good day !

                                  Can one of my colleagues tell me how to properly overload the methods virtual void QPaintEngine::updateState(const QPaintEngineState &state) and virtual int QPaintDevice::metric(PaintDeviceMetric metric) const ?

                                  Or where can I see examples of their overload ?

                                  Sincerely, Yuri.

                                  JonBJ Offline
                                  JonBJ Offline
                                  JonB
                                  wrote on last edited by JonB
                                  #24

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

                                  properly overload the methods

                                  Do you mean overload? Overload means write a new version of the QPaintEngine::updateState() method which takes different parameters from the current one. In which case you just write that. Is this what you want?

                                  Or did you mean override instead? Override means write your own version of the existing virtual methods with the same parameters as the existing one. Is that actually what you want? In which case:

                                  // in yourclass.h
                                  class YourClass : public QPaintEngine
                                  {
                                      virtual void updateState(const QPaintEngineState &state) override;
                                  }
                                  
                                  // in yourclass.cpp
                                  void YourClass::updateState(const QPaintEngineState &state)
                                  {
                                      ...
                                      // and if you need to call the original base class implementation
                                      QPaintEngine::updateState(state);
                                      ...
                                  }
                                  
                                  1 Reply Last reply
                                  0
                                  • Yuri34Y Offline
                                    Yuri34Y Offline
                                    Yuri34
                                    wrote on last edited by Yuri34
                                    #25

                                    Oh, thanks !

                                    Apparently I explained it incorrectly ! :)
                                    What is overloading and how syntactically it is formed in c++/Qt, I perfectly imagine!
                                    I am interested in what and what is initialized in the virtual methods I mentioned ?

                                    In order not to insert pieces of code here, I will mention once again the link to the repo-gitlab - https://gitlab.com/z34x/codemaker.git !

                                    • ::metric() at the end of the file - FCPaintDevice
                                    • ::updateState() at the end of the file - FCPaintEngine

                                    I 'm doing exactly wrong !!!

                                    My question is how to properly design these virtual methods so that the svg file is parsed correctly ? :)

                                    Moreover, pay attention to the virtual void QPaintEngine::updateState(const QPaintEngine State &state) = 0 ! abstract method !!!

                                    Sincerely, Yuri.

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

                                      Good day !

                                      Ooook ! :)
                                      It seems like the problem is not frequent for developers or not relevant !

                                      Best regards, Yuri.

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

                                        The next question ...

                                        Is there a method in the Qt Painting System classes that allows you to determine the intersection of primitives when drawing on QPaintDevice ?

                                        Best regards, Yuri.

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

                                          OooK!
                                          I'll answer myself (maybe it's interesting to someone besides me) !
                                          Of course there is - intersect(..)/intersected(..) !!!

                                          Best regards, Yuri.

                                          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