Results 1 to 5 of 5

Thread: Search value in QList

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    518
    Thanks
    13
    Thanked 77 Times in 75 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Search value in QList

    Hi, if you only have positive values then use std::min_element.

    Ginsengelf

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

    pelaoqlo (6th February 2019)

  3. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Search value in QList

    Quote Originally Posted by Ginsengelf View Post
    Hi, if you only have positive values then use std::min_element.
    Yes, definitely std::min_element.

    If there are negative values then with a compare function that takes the abs() for comparison

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 14th November 2012, 21:00
  2. Qlist<QLabel *> in Qlist<QAction*>
    By Naahmi in forum Qt Programming
    Replies: 1
    Last Post: 9th September 2011, 08:53
  3. Fast QList search/access
    By tryinghard in forum Newbie
    Replies: 4
    Last Post: 15th January 2011, 02:00
  4. Replies: 4
    Last Post: 20th August 2010, 13:54
  5. BEst way to search QList for item
    By steg90 in forum Qt Programming
    Replies: 11
    Last Post: 18th July 2007, 09:41

Tags for this Thread

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.