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. Deep brain stimulation (DBS)

Deep brain stimulation (DBS)

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 1.8k Views
  • 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.
  • P Offline
    P Offline
    Peter Viola
    wrote on last edited by
    #1

    Would You be so kind to help me?

    I have an ant (Dot from The Bugs Life) on my printed matter (A6 size). Is it possible to hit the T lobe of Dot with my DBS electrode (printer)? My problem is as follows: On the second (A4 size) printed matter I have the Lion King and I want to position my DBS electrode in its F lobe. If succeed I want to print a text to Dot's 3th leg "success" and the King's right ear "done".

    Do I need to subclass the QGraphicsScene or the QTextDocument?

    Thanks in advance,

    Peter

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

      Hi
      How do you draw it now?

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Peter Viola
        wrote on last edited by
        #3

        Dear mrjj,

        I tried to subclass QGraphicsScene parsing the xml (QDomDocument) creating the scene

        //your code here
        ```<?xml version="1.0" encoding="UTF-8"?>
        <root>
        	<document id="SEVT 14 282 2S" type="receipt">
        		<printer>
        			<name>HP_LaserJet_Professional_M1132_MFP</name>
        			<paper>A6</paper>
        		</printer>
        		<rect>
        			<left>0</left>
        			<top>0</top>
        			<width>1050</width>
        			<height>1480</height>
        		</rect>
        		<font>
        			<family>Georgia</family>
        			<size>30</size>
        			<weight>-1</weight>
        			<italic>0</italic>
        		</font>
        		<item id="physician code" type="text">
        			<rect>
        				<left>700</left>
        				<top>110</top>
        				<width>280</width>
        				<height>60</height>
        			</rect>
        		</item>
        		<item id="patient ic" type="text">
        			<rect>
        				<left>330</left>
        				<top>190</top>
        				<width>190</width>
        				<height>50</height>
        			</rect>
        		</item>
        		<item id="patient name" type="text">
        			<rect>
        				<left>90</left>
        				<top>300</top>
        				<width>280</width>
        				<height>60</height>
        			</rect>
        		</item>
        		<item id="patient address" type="text">
        			<rect>
        				<left>90</left>
        				<top>400</top>
        				<width>890</width>
        				<height>60</height>
        			</rect>
        		</item>
        		<item id="diagnose" type="text">
        			<rect>
        				<left>100</left>
        				<top>470</top>
        				<width>225</width>
        				<height>50</height>
        			</rect>
        		</item>
        		<item id="code" type="text">
        			<rect>
        				<left>360</left>
        				<top>470</top>
        				<width>225</width>
        				<height>50</height>
        			</rect>
        		</item>
        		<item id="remedy" type="text">
        			<rect>
        				<left>50</left>
        				<top>590</top>
        				<width>580</width>
        				<height>480</height>
        			</rect>
        		</item>
        		<item id="date" type="text">
        			<rect>
        				<left>150</left>
        				<top>1150</top>
        				<width>380</width>
        				<height>50</height>
        			</rect>
        		</item>
        		<item id="physician name" type="text">
        			<font>
        				<family>Georgia</family>
        				<size>20</size>
        				<weight>-1</weight>
        				<italic>1</italic>
        			</font>
        			<rect>
        				<left>50</left>
        				<top>1210</top>
        				<width>620</width>
        				<height>50</height>
        			</rect>
        		</item>
        	</document>
        </root>
        

        using QTextDocument

        <!DOCTYPE html>
        <html>
        
        <head>
            <title>SEVT 14 282 2S</title>
            <meta charset="UTF-8">
            <style>
                #container {
                    position: fixed;
                    left: 0mm;
                    top: 0mm;
                    width: 105mm;
                    height: 148mm;
                    font: 3mm monospace; 
                    background-image: url("file:///home/peter/Documents/Code/Qt/PluginRecipe/img/igaz222.png");
                    background-size: 105mm 148mm
                }
                #physician_code {
                    position: fixed;
                    left: 70mm;
                    top: 11mm;
                    width: 28mm;
                    height: 6mm;
                    background-color: red
                }
                #patient_icid {
                    position: fixed;
                    left: 33mm;
                    top: 19mm;
                    width: 19mm;
                    height: 5mm;
                    background-color: red
                }
                #patient_name {
                    position: fixed;
                    left: 9mm;
                    top: 30mm;
                    width: 28mm;
                    height: 6mm;
                    background-color: red
                }        
                #patient_id {
                    position: fixed;
                    left: 70mm;
                    top: 30mm;
                    width: 28mm;
                    height: 6mm;
                    background-color: red
                }
                #patient_address {
                    position: fixed;
                    left: 9mm;
                    top: 40mm;
                    width: 89mm;
                    height: 6mm;
                    background-color: red
                }
                #diagnose {
                    position: fixed;
                    left: 10mm;
                    top: 47mm;
                    width: 22.5mm;
                    height: 5mm;
                    background-color: red
                }
                #remedy_code {
                    position: fixed;
                    left: 36mm;
                    top: 47mm;
                    width: 22.5mm;
                    height: 5mm;
                    background-color: red
                }
                #date {
                    position: fixed;
                    left: 15mm;
                    top: 115mm;
                    width: 38mm;
                    height: 5mm;
                    background-color: red
                }
                #physician_name {
                    position: fixed;
                    left: 5mm;
                    top: 121mm;
                    width: 62mm;
                    height: 5mm;
                    background-color: red
                }
                #surcharge_ic {
                    position: fixed;
                    left: 69mm;
                    top: 50mm;
                    width: 15mm;
                    height: 3mm;
                    background-color: red
                }
                #surcharge_patient {
                    position: fixed;
                    left: 84mm;
                    top: 50mm;
                    width: 15mm;
                    height: 3mm;
                    background-color: red
                }
            </style>
        </head>
        
        <body>
            <div id="container">
                <div id="physician_code">pcode</div>
                <div id="patient_icid">icid</div>
                <div id="patient_name">name</div>
                <div id="patient_id">name</div>
                <div id="patient_address">address</div>
                <div id="diagnose">diagnose</div>
                <div id="remedy_code">rcode</div>
                <div id="date">date</div>
                <div id="physician_name">pname</div>
                <div id="surcharge_ic">sid</div>
                <div id="surcharge_patient">spat</div>
            </div>
        </body>
        
        </html>
        
        

        The problem is Dot is pre-printed. The Lion King I am able to render. I have another printed matter containing 100x 3x3mm squares to hit.

        Thank You!

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

          @Peter-Viola said in Deep brain stimulation (DBS):

          The problem is Dot is pre-printed.

          What is Dot ?

          So the source is some xml documents describing "something"
          and you want to visualize the "something" ?

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Peter Viola
            wrote on last edited by
            #5

            Sorry, I was busy.

            Yes, my model is the printed matter coordinates translated (mostly simply measured by a ruler) to xml (html, JSON, MySQL, PostgreSQL, etc).
            The blocks are predominantly texts, but sometimes need to draw images (logo, barcode), lines too.

            The problem is
            1/ QTextDocument: positioning the image(s)
            2/ QGraphicsScene: fit the text to QGraphicsRectItem (maybe QFontMetrics will help)
            3/ QPrinter: Mostly I can render the whole form and print it to an empty sheet, sometimes I need to fill the pre-printed matter (e.g. hit a 3x3mm square (my Dot) on the paper).

            Thank You.

            mrjjM 1 Reply Last reply
            0
            • P Peter Viola

              Sorry, I was busy.

              Yes, my model is the printed matter coordinates translated (mostly simply measured by a ruler) to xml (html, JSON, MySQL, PostgreSQL, etc).
              The blocks are predominantly texts, but sometimes need to draw images (logo, barcode), lines too.

              The problem is
              1/ QTextDocument: positioning the image(s)
              2/ QGraphicsScene: fit the text to QGraphicsRectItem (maybe QFontMetrics will help)
              3/ QPrinter: Mostly I can render the whole form and print it to an empty sheet, sometimes I need to fill the pre-printed matter (e.g. hit a 3x3mm square (my Dot) on the paper).

              Thank You.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Peter-Viola

              Hi
              is it the <rect> you are drawing?

              do you need to edit it on screen or is more the printing part that is important?

              1 Reply Last reply
              0
              • P Offline
                P Offline
                Peter Viola
                wrote on last edited by
                #7

                Yes, the rect is the rectangle to draw the text in, the image's bounding rectangle, etc and yes, it would be fine to present the editables before printing.

                Thank You.

                mrjjM 1 Reply Last reply
                0
                • P Peter Viola

                  Yes, the rect is the rectangle to draw the text in, the image's bounding rectangle, etc and yes, it would be fine to present the editables before printing.

                  Thank You.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Peter-Viola
                  Then using QGraphicsScene seems a good choice.

                  About issue:
                  2/ QGraphicsScene: fit the text to QGraphicsRectItem

                  You mean make text smaller so it can be inside the Rect Area?
                  yes, you can use QFontMetrics to get actual size and reduce point size of font until it fits.

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    Peter Viola
                    wrote on last edited by
                    #9

                    I'll take Your advice, thank You.

                    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