Results 1 to 3 of 3

Thread: QPair<T1, T2> == operator is not working as expected?

  1. #1
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default QPair<T1, T2> == operator is not working as expected?

    Hello Community,

    i have the following codelines which gives a result of "true" out of the console.

    Qt Code:
    1. QPair<QString, QString> blub, bla;
    2.  
    3. blub.first=="a";
    4. blub.second=="b";
    5. bla.first=="a";
    6. bla.second=="z";
    7.  
    8. qDebug() << (blub == bla);
    To copy to clipboard, switch view to plain text mode 
    Why is this equal?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QPair<T1, T2> == operator is not working as expected?

    Ehm, notice the difference between = and ==

    Line 3 to 6 are wrong. And the result is quite fine since both pairs are empty...

  3. The following user says thank you to Lykurg for this useful post:

    70thCommander (22nd December 2010)

  4. #3
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPair<T1, T2> == operator is not working as expected?

    Quote Originally Posted by Lykurg View Post
    Ehm, notice the difference between = and ==

    Line 3 to 6 are wrong. And the result is quite fine since both pairs are empty...
    Right, I see ....
    this is just a test of the forum user skillz ...

    Oh my god it was late yesterday!

Similar Threads

  1. Qt Multi-touch Dials example not working as expected
    By dpatel in forum Qt Programming
    Replies: 1
    Last Post: 2nd December 2010, 07:50
  2. Replies: 0
    Last Post: 17th August 2010, 15:37
  3. Replies: 10
    Last Post: 2nd August 2010, 15:07
  4. Indirection operator not working from QProcess
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2010, 15:06
  5. QTableView not working as expected.
    By junxuan in forum Qt Programming
    Replies: 7
    Last Post: 30th July 2009, 09:17

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.