Results 1 to 2 of 2

Thread: How to use Q_Property to customize items in a QListView with a QStyledItemDelegate

  1. #1
    Join Date
    Apr 2015
    Posts
    9
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default How to use Q_Property to customize items in a QListView with a QStyledItemDelegate

    I have custom listview items in my QListView, which are drawed by a QStyledItemDelegate. They contain two lines of text which should be both customizable with stylesheets. The first is set by
    Qt Code:
    1. #list {font: 26px "Ubuntu";}
    To copy to clipboard, switch view to plain text mode 
    , which works fine. But the second should be stylable as well. Qt [mentions][1] that any designable Q_PROPERTY can be set by the stylesheet, but I wonder where to define and how to access these properties from the QStyledItemDelegate:aint method.

    [1]: http://qt-project.org/doc/qt-4.8/sty...ect-properties

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to use Q_Property to customize items in a QListView with a QStyledItemDelegat

    Where would that property be defined? Items do not have properties. You should rather build a custom delegate and use model data to render what and how you want.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Center icon in QListView using QStyledItemDelegate
    By franki in forum Qt Programming
    Replies: 1
    Last Post: 11th June 2013, 08:53
  2. QListView + QStyledItemDelegate + text besides icon
    By NoRulez in forum Qt Programming
    Replies: 8
    Last Post: 1st February 2011, 21:06
  3. Replies: 1
    Last Post: 9th September 2010, 18:26
  4. Replies: 2
    Last Post: 19th February 2010, 12:58
  5. How customize items of ModelView?
    By istdasklar in forum Qt Programming
    Replies: 3
    Last Post: 28th March 2007, 18:08

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.