Results 1 to 2 of 2

Thread: Model Views and QLabel

  1. #1
    Join Date
    Feb 2006
    Location
    Warsaw, Poland
    Posts
    45
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Model Views and QLabel

    Hello! I need to do thing like this:

    I have a model view, one column with icon. I need this column to display two labels in it. One label is editable by delegate (line edit), and other one is under it displaying some text. Also i need to be able to hide non-editable label (it depends on user preferences). Any ideas how to do this?

  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: Model Views and QLabel

    Two possibilities -- change the model (the data() member), but this is a bit stupid or create a custom delegate which will show both the DisplayRole (which will also be the EditRole) and some other role (define a custom one or reuse one of the default ones). You'll have to reimplement the painting routine of course.

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.