Results 1 to 6 of 6

Thread: How to port QListBox and QListBoxItem in Qtopia 2.2.0 to 4.2.0

  1. #1
    Join Date
    Dec 2006
    Posts
    11
    Thanks
    1
    Qt products

    Default How to port QListBox and QListBoxItem in Qtopia 2.2.0 to 4.2.0

    Hi guys,

    Have someone tried 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: How to port QListBox and QListBoxItem in Qtopia 2.2.0 to 4.2.0

    What's there to try? QListBox equivalent in Qt4 is QListWidget. The API doesn't differ that much, so it should be easy for you to port it.

  3. #3
    Join Date
    Dec 2006
    Posts
    11
    Thanks
    1
    Qt products

    Default Re: How to port QListBox and QListBoxItem in Qtopia 2.2.0 to 4.2.0

    The problem here is with QListBoxItem. In 2.2.0, I use my own class inherits from QListBoxItem, and I re-implement its paint. So what's QListBoxItem in 4.4.0?

  4. #4
    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 port QListBox and QListBoxItem in Qtopia 2.2.0 to 4.2.0

    QListWidgetItem. Please at least take a look at QListWidget docs before asking such questions...

  5. #5
    Join Date
    Dec 2006
    Posts
    11
    Thanks
    1
    Qt products

    Default Re: How to port QListBox and QListBoxItem in Qtopia 2.2.0 to 4.2.0

    I don't think you got my question or because of my poor English.

    If you inherits QListBoxItem, unless you re-implement paint(), you will always get a compilation error. And by using paint(), you could custom the item's view.

    Have a look at call history application in Qtopia 2.2.0. For each item, it has two rows to display in different fonts. Show me, how you implement this using QListWidgetItem in Qtopia 4.2.0

  6. #6
    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 port QListBox and QListBoxItem in Qtopia 2.2.0 to 4.2.0

    The looks of items in Qt4 are controled by an entity called the delegate. If you want to customize how an item gets rendered, you need to subclass QItemDelegate or QAbstractItemDelegate. But if you only need simple customization, it is possible you can do it without a custom delegate. So the basic question is - how do you want your item to look like? I suggest you read the docs about model-view programming: http://doc.trolltech.com/latest/mode...ogramming.html

  7. The following user says thank you to wysota for this useful post:

    mellibra (25th October 2007)

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.