View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#5
The Hildon Style Guide has a list of the logical font and colour names that you provide as arguments to the static methods of the QMaemo5Style class. The blue text in your screenshot is obtained using the logical colour name 'ActiveTextColor'. So, you could set the text colour of a QListWidgetItem as follows:

Code:
listWidgetItem.setTextColor(QMaemo5Style.standardColor("ActiveTextColor"))
Unfortunately, I have not been able to get this to work in PyQt. I suspect the class QMaemo5Style is not available in PyQt.

To obtain multiple lines of text with different fonts, you can create a custom widget containing the required number of QLabels etc in a grid layout, and set the QListWidgetItem's widget to the custom widget that you have created, using the setItemWidget() method of the QListWidget class.

As an example, I am currently developing a YouTube client for the N900, and I created a custom widget containing:
  • A QLabel with a QFrame containing a QPixmap showing the video thumbnail.
  • A QLabel containing the video duration.
  • A QLabel containing the video title.
  • A QLabel containing the username of the uploader (font size 18px).
  • A QLabel containing an QPixmap showing the rating.

The label are set in a grid layout. You can do all of this in Qt Designer if you wish.

Screenshot:


Last edited by marxian; 2010-10-22 at 22:01.
 

The Following User Says Thank You to marxian For This Useful Post: