Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27

Thread: Thumbnail View

  1. #21
    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: Thumbnail View

    Have a list of instances of a structure, you might want to add some more info later and there is no point in redesigning everything then. Or just use QStandardItemModel.
    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.


  2. #22
    Join Date
    Jun 2010
    Posts
    142
    Thanks
    11
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Thumbnail View

    That's a good idea. The problem with QStandardItems is that it must store the whole path, but show only the name in the view.

    Also, how do I avoid starting huge amounts of the concurrent thumbnail functions at once? Or is it OK?

  3. #23
    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: Thumbnail View

    Quote Originally Posted by MTK358 View Post
    The problem with QStandardItems is that it must store the whole path, but show only the name in the view.
    Sorry? There is Qt::DisplayRole for what gets shown and an infinite number of custom roles you can use for any data you want (such as the full path).

    Also, how do I avoid starting huge amounts of the concurrent thumbnail functions at once? Or is it OK?
    It's ok, they will be queued.
    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.


  4. #24
    Join Date
    Jun 2010
    Posts
    142
    Thanks
    11
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Thumbnail View

    Quote Originally Posted by wysota View Post
    Sorry? There is Qt::DisplayRole for what gets shown and an infinite number of custom roles you can use for any data you want (such as the full path).
    How am I supposed to do that when I'm not using a custom model?

    Quote Originally Posted by wysota View Post
    It's ok, they will be queued.
    They will be queued automatically without me taking any action?

  5. #25
    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: Thumbnail View

    Quote Originally Posted by MTK358 View Post
    How am I supposed to do that when I'm not using a custom model?
    You can pass any integer equal or larger than Qt::UserRole as the role for any method accepting a role identifier.

    They will be queued automatically without me taking any action?
    Yes. QtConcurrent will only run concurrently at most as many jobs as you have cores available in your machine (so 1 task for 1 core, 2 tasks for 2 cores, etc.), excluding the main execution thread (so Qt Concurrent guarantees that at least one job will be ran). The remaining jobs will be queued until there are idle threads available.
    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.


  6. #26
    Join Date
    Jun 2010
    Posts
    142
    Thanks
    11
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Thumbnail View

    Quote Originally Posted by wysota View Post
    You can pass any integer equal or larger than Qt::UserRole as the role for any method accepting a role identifier.
    So you can add a non-visible piece of data to be used internally by your program to a QStandardItem?

    Quote Originally Posted by wysota View Post
    Yes. QtConcurrent will only run concurrently at most as many jobs as you have cores available in your machine (so 1 task for 1 core, 2 tasks for 2 cores, etc.), excluding the main execution thread (so Qt Concurrent guarantees that at least one job will be ran). The remaining jobs will be queued until there are idle threads available.
    OK, that's nice.

  7. #27
    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: Thumbnail View

    Quote Originally Posted by MTK358 View Post
    So you can add a non-visible piece of data to be used internally by your program to a QStandardItem?
    Yes, that's correct.

    Qt Code:
    1. enum { myCustomStringRole = Qt::UserRole+1, myCustomColorRole };
    2. //...
    3. QStandardItem *item = ...
    4. item->setData("my custom string", myCustomStringRole);
    5. item->setData(QColor("red"), myCustomColorRole);
    To copy to clipboard, switch view to plain text mode 
    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. photo thumbnail viewer
    By chezifresh in forum Qt Programming
    Replies: 12
    Last Post: 3rd January 2012, 21:25
  2. show thumbnail
    By adonaicanez in forum Newbie
    Replies: 1
    Last Post: 19th October 2009, 07:46
  3. Replies: 0
    Last Post: 16th August 2009, 17:46
  4. how to browse images in thumbnail view?
    By zl2k in forum Qt Programming
    Replies: 12
    Last Post: 23rd April 2009, 02:20
  5. Creating thumbnail of image through qt
    By vishal.chauhan in forum Newbie
    Replies: 1
    Last Post: 30th January 2007, 13:30

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.