Results 1 to 2 of 2

Thread: Can QListBox be populated by custom Widgets?

  1. #1
    Join Date
    Feb 2009
    Posts
    45
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Can QListBox be populated by custom Widgets?

    I am suing Qt3, and need suggestions on the design to implement the following

    Requirement
    • I have an application to view and navigate documents.
    • I have added a view, to the left of the document, to which I want to add thumbnails (image with page number) similar to Acrobat viewer
    • I need to also draw a red border on the thumbnail (a la Acrobat Viewer), showing the area of the page in view


    Questions
    I am using QListBox for the thumbnails view
    • Would it be better to create a custom Widget for the thumbnail (QImage/QPixmap + QLabel), and then implement my own QListBoxItem, to which the custom Widget is added?
    • OR will a QListBoxPixmap, be better
    • For drawing the red border, which Qt object can accommodate this feature a QImage or a QPixmap?


    The main dilemma, is which approach is best suited to accommodate the image + text AS WELL AS having a red border drawn on it.

    Feedback will be much appreciated! Thanks.
    Last edited by qtUser500; 25th February 2009 at 19:41.

  2. #2
    Join Date
    Feb 2009
    Posts
    45
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Re: Can QListBox be populated by custom Widgets?

    I was able to put the image into the listbox using:

    Qt Code:
    1. QPixmap pixmap("book.png");
    2. QPixmap pixmap2("test.png");
    3.  
    4. thbViewListBox->insertItem(pixmap, "1");
    5. thbViewListBox->insertItem(pixmap2, "2");
    To copy to clipboard, switch view to plain text mode 

    Questions
    • How can I draw a red border on this pixmap?
    • If I want to have the label (i.e. text , "1") below the pixmap, is there anyway of doing so?


    Please advice. Thank you.
    Last edited by qtUser500; 26th February 2009 at 19:39.

Similar Threads

  1. Replies: 4
    Last Post: 2nd December 2008, 04:19
  2. Replies: 2
    Last Post: 16th May 2008, 14:39
  3. picking geometry in qt custom widgets
    By notsonerdysunny in forum Qt Programming
    Replies: 2
    Last Post: 17th July 2007, 23:01
  4. create custom widgets
    By nimmyj in forum General Discussion
    Replies: 1
    Last Post: 20th November 2006, 08:24
  5. container populated with custom widgets
    By momesana in forum Qt Programming
    Replies: 2
    Last Post: 16th April 2006, 21:02

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.