[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Hardcoded fonts in Qt designer
From:       Mads Ipsen <madsipsen () gmail ! com>
Date:       2011-11-30 14:42:37
Message-ID: 4ED640DD.6060303 () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Ubuntu 11.04:

* Start Designer and use the basic widget template
* Add a QLabel.
* Right-click the label and enter rich-text editing
* Add some text with a superscript.

Now click the source tab. This is what I find:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" 
"http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><meta name="qrichtext" content="1" /><style type="text/css">

p, li { white-space: pre-wrap; }

</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; 
font-weight:400; font-style:normal;">

<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; 
margin-right:0px; -qt-block-indent:0; text-indent:0px;">A<span style=" 
vertical-align:super;">2</span></p></body></html>


Now, do perform the same exercise on Windows 7. Then the rich-text 
source will look like this:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" 
"http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><meta name="qrichtext" content="1" /><style type="text/css">

p, li { white-space: pre-wrap; }

</style></head><body style="
font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400;
font-style:normal;">

<p style=" margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px;"><span style="
font-size:8pt;">A</span><span style=" font-size:8pt;
vertical-align:sub;">1</span></p></body></html>


Now, if you work in a cross-platform development where developers (on 
different OS's ie.) share UI files via a GIT repository, this quickly 
becomes a mess. Any suggestions?


Preprocess all .ui files and chop out


<body style="font-family:'MS Shell Dlg 2'; font-size:8.25pt; 
font-weight:400; font-style:normal;">


Best regards,


Mads


-- 
+-----------------------------------------------------+
| Mads Ipsen                                          |
+----------------------+------------------------------+
| Gåsebæksvej 7, 4. tv |                              |
| DK-2500 Valby        | phone:          +45-29716388 |
| Denmark              | email:  mads.ipsen@gmail.com |
+----------------------+------------------------------+



[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    On Ubuntu 11.04:<br>
    <br>
    * Start Designer and use the basic widget template<br>
    * Add a QLabel. <br>
    * Right-click the label and enter rich-text editing<br>
    * Add some text with a superscript.<br>
    <br>
    Now click the source tab. This is what I find:<br>
    <br>
    <style type="text/css">p, li { white-space: pre-wrap; }</style>
    <p style="margin: 0px; text-indent: 0px;">&lt;!DOCTYPE HTML PUBLIC
      "-//W3C//DTD HTML 4.0//EN"
      <a class="moz-txt-link-rfc2396E" \
href="http://www.w3.org/TR/REC-html40/strict.dtd">"http://www.w3.org/TR/REC-html40/strict.dtd"</a>&gt;</p>
  <p style="margin: 0px; text-indent: 0px;">&lt;html&gt;&lt;head&gt;&lt;meta
      name="qrichtext" content="1" /&gt;&lt;style type="text/css"&gt;</p>
    <p style="margin: 0px; text-indent: 0px;">p, li { white-space:
      pre-wrap; }</p>
    <p style="margin: 0px; text-indent: 0px;">&lt;/style&gt;&lt;/head&gt;&lt;body
      style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400;
      font-style:normal;"&gt;</p>
    <p style="margin: 0px; text-indent: 0px;">&lt;p style="
      margin-top:0px; margin-bottom:0px; margin-left:0px;
      margin-right:0px; -qt-block-indent:0;
      text-indent:0px;"&gt;A&lt;span style="
vertical-align:super;"&gt;2&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;<br>
    </p>
    <p style="margin: 0px; text-indent: 0px;"><br>
      Now, do perform the same exercise on Windows 7. Then the rich-text
      source will look like this:<br>
    </p>
    <p style="margin: 0px; text-indent: 0px;"><br>
      &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "<a
        href="http://www.w3.org/TR/REC-html40/strict.dtd">http://www.w3.org/TR/REC-html40/strict.dtd</a>"&gt;</p>
  <p style="margin: 0px;">&lt;html&gt;&lt;head&gt;&lt;meta
      name="qrichtext" content="1" /&gt;&lt;style type="text/css"&gt;</p>
    <p style="margin: 0px;">p, li { white-space: pre-wrap; }</p>
    <p style="margin: 0px;">&lt;/style&gt;&lt;/head&gt;&lt;body style="
      <br>
      font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; <br>
      font-style:normal;"&gt;</p>
    <p style="margin: 0px;">&lt;p style=" margin-top:0px;
      margin-bottom:0px;<br>
      margin-left:0px; margin-right:0px; -qt-block-indent:0; <br>
      text-indent:0px;"&gt;&lt;span style=" <br>
      font-size:8pt;"&gt;A&lt;/span&gt;&lt;span style=" font-size:8pt; <br>
vertical-align:sub;"&gt;1&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</p>
    <p style="margin: 0px; text-indent: 0px;"><br>
      Now, if you work in a cross-platform development where developers
      (on different OS's ie.) share UI files via a GIT repository, this
      quickly becomes a mess. Any suggestions? <br>
    </p>
    <p style="margin: 0px; text-indent: 0px;"><br>
      Preprocess all .ui files and chop out<br>
    </p>
    <p style="margin: 0px; text-indent: 0px;"><br>
      &lt;body style="font-family:'MS Shell Dlg 2'; font-size:8.25pt;
      font-weight:400; font-style:normal;"&gt;<br>
    </p>
    <p style="margin: 0px; text-indent: 0px;"><br>
    </p>
    <p style="margin: 0px; text-indent: 0px;">Best regards,<br>
    </p>
    <p style="margin: 0px; text-indent: 0px;"><br>
      Mads<br>
    </p>
    <br>
    <pre class="moz-signature" cols="72">-- 
+-----------------------------------------------------+
> Mads Ipsen                                          |
+----------------------+------------------------------+
> G&aring;seb&aelig;ksvej 7, 4. tv |                              |
> DK-2500 Valby        | phone:          +45-29716388 |
> Denmark              | email:  <a class="moz-txt-link-abbreviated" \
> href="mailto:mads.ipsen@gmail.com">mads.ipsen@gmail.com</a> |
+----------------------+------------------------------+

</pre>
  </body>
</html>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic