Deep brain stimulation (DBS)



  • 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


  • Qt Champions 2016

    Hi
    How do you draw it now?



  • 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!


  • Qt Champions 2016

    @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" ?



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


  • Qt Champions 2016

    @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?



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


  • Qt Champions 2016

    @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.



  • I'll take Your advice, thank You.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.