[Qt-interest] monospaced fonts in qgraphicsscene

Atlant Schmidt aschmidt at dekaresearch.com
Thu Jul 29 16:34:18 CEST 2010


Peter:

  Perhaps on the Mac the characters are actually of a
  "fractional" width and not exactly 8.000 screen pixels
  wide?

  (I'd expect the Mac would try to compensate for the
  physical size of the screen/the dots-per-inch of the
  screen as it computes just how big it should render
  "12 point" type.)

                       Atlant

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Peter Schmidtke
Sent: Thursday, July 29, 2010 10:23 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] monospaced fonts in qgraphicsscene

Hello,

I am drawing qgraphicscenes using pyqt and different elements in it. One of these elements is a qgrapchissimpletextitem, where I use a monospaced font (Courier, size 12) printing a long string with capital letters.
Below this string I'd like to show a histogram, building a qgraphicsrectitem for each letter of the string above. For doing this I need to well position my rectangles below each letter. This was possible in Linux systems, where I could set a exact width to each rectangle.

Now I open the whole thing in Mac OSX Snow Leopard and the monospaced font is not shown the same way, So I had a look into fontmetrics for this font, I used the charWidth function, which returns me 8 pixels for one char of Courier, 12. Still my rectangles below don't fit. I tried to use the width function, without success (returns 0).

Basically I cannot manage to fit the width of my rectangles to the width of my characters of my string....did somebody experienced the same issues. It worked fine on openSuse, but is a headache in Mac.

I know that instead of using a String for the sequence I could print every character as seperate object, however this would overload the scene and I don't see the point if monospaced fonts are available.

Thanks in advance.

Peter


On 31/05/2010, at 18:19, <sbremal at hotmail.com> <sbremal at hotmail.com> wrote:

>
> Hello,
>
> I wonder if any standard Qt widget exists for filtering and sorting data in a table view.
>
> There are hundreds of rows in a QSqlTableModel displayed in a QTableView which supposed to be interactively filtered. It would be great if there was some sophisticated component for this, similar to the ones in TOAD or Pgadmin.
>
> Thanks in advance for any suggestion.
>
>
> Cheers,
> Balazs
> _________________________________________________________________
> Hotmail: Trusted email with powerful SPAM protection.
> https://signup.live.com/signup.aspx?id=60969
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Peter Schmidtke

-----------------
PhD Student
Department of Physical Chemistry
School of Pharmacy
University of Barcelona
Barcelona, Spain



_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.




More information about the Qt-interest-old mailing list