Results 1 to 4 of 4

Thread: Load Images in a dir into a QScrollArea

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Load Images in a dir into a QScrollArea

    Qt Code:
    1. QWidget *viewport = new QWidget;
    2. QVBoxLayout *l = new QVBoxLayout(viewport);
    3. foreach(const QString &path, stringlist){
    4. QPixmap px(path);
    5. QLabel *label = new QLabel;
    6. label->setPixmap(px);
    7. l->addWidget(label);
    8. }
    9. scrollArea->setWidget(viewport);
    To copy to clipboard, switch view to plain text mode 

    This won't look very good but it's a place to start. Using QGraphicsView or QListView might give you better results though...

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

    nmuntz (20th January 2009)

Similar Threads

  1. WekKit won't load JPEG images.
    By andrem in forum Qt Programming
    Replies: 4
    Last Post: 10th December 2008, 00:24
  2. import large number of images
    By sriluyarlagadda in forum Qt Programming
    Replies: 5
    Last Post: 15th May 2008, 10:26
  3. Program not compiling on Fresh install of Leopard
    By dvmorris in forum Qt Programming
    Replies: 1
    Last Post: 22nd November 2007, 10:22
  4. Replies: 2
    Last Post: 8th October 2006, 20:14

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
  •  
Qt is a trademark of The Qt Company.