[PyQt] monospaced fonts in qgraphicsscene

Peter Schmidtke pschmidtke at mmb.pcb.ub.es
Wed Jul 28 11:36:03 BST 2010


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




More information about the PyQt mailing list