Results 1 to 3 of 3

Thread: do we can't compare QIcon or QPixmap????

  1. #1
    Join Date
    Nov 2007
    Posts
    42
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question do we can't compare QIcon or QPixmap????

    hi
    do we can't compare (or can't use ' == ' operator for) QIcon objects directly like this

    Qt Code:
    1. QIcon icon1,icon2;
    2. if (icon1 == icon2)
    To copy to clipboard, switch view to plain text mode 
    because when i make my project it displays on terminal as

    error: no match for 'operator==' in '((studylistdialog1*)this)->studylistdialog1::buttonicon == testicon12'
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qglobal.h:1491: note: candidates are: bool operator==(QBool, bool)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qglobal.h:1492: note: bool operator==(bool, QBool)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qglobal.h:1493: note: bool operator==(QBool, QBool)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qchar.h:352: note: bool operator==(QChar, QChar)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qbytearray.h:454: note: bool operator==(const QByteArray&, const QByteArray&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qbytearray.h:456: note: bool operator==(const QByteArray&, const char*)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qbytearray.h:458: note: bool operator==(const char*, const QByteArray&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:833: note: bool operator==(QString::Null, QString::Null)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:834: note: bool operator==(QString::Null, const QString&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:835: note: bool operator==(const QString&, QString::Null)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:862: note: bool operator==(const char*, const QString&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:875: note: bool operator==(const char*, const QLatin1String&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:888: note: bool operator==(const QLatin1String&, const QLatin1String&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:1083: note: bool operator==(const QStringRef&, const QStringRef&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:1086: note: bool operator==(const QString&, const QStringRef&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:1090: note: bool operator==(const QStringRef&, const QString&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:1093: note: bool operator==(const QLatin1String&, const QStringRef&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:1097: note: bool operator==(const QStringRef&, const QLatin1String&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:1118: note: bool operator==(const char*, const QStringRef&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qstring.h:1120: note: bool operator==(const QStringRef&, const char*)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qhash.h:176: note: bool operator==(const QHashDummyValue&, const QHashDummyValue&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qvariant.h:519: note: bool operator==(const QVariant&, const QVariantComparisonHelper&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qpoint.h:142: note: bool operator==(const QPoint&, const QPoint&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qpoint.h:298: note: bool operator==(const QPointF&, const QPointF&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qsize.h:150: note: bool operator==(const QSize&, const QSize&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qsize.h:306: note: bool operator==(const QSizeF&, const QSizeF&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qrect.h:491: note: bool operator==(const QRect&, const QRect&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qrect.h:828: note: bool operator==(const QRectF&, const QRectF&)
    /usr/local/Trolltech/Qt-4.3.2/include/QtGui/qevent.h:703: note: bool operator==(QKeyEvent*, QKeySequence::StandardKey)
    /usr/local/Trolltech/Qt-4.3.2/include/QtGui/qevent.h:704: note: bool operator==(QKeySequence::StandardKey, QKeyEvent*)
    Last edited by jpn; 12th May 2008 at 13:07. Reason: missing tags

  2. #2
    Join Date
    Apr 2008
    Location
    Pavlodar, Kazakhstan
    Posts
    22
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: do we can't compare QIcon or QPixmap????

    No, you cannot compare QIcon's this way. There is no overloaded '==' operator for this class. You can get QPixmap from QIcon using QIcon:ixmap() function. Then in turn you can obtain QImage object from QPixmap with QPixmap::toImage() call. And finally you can compare QImage objects with '==' operator.

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

    sudheer (13th May 2008)

  4. #3
    Join Date
    Nov 2007
    Posts
    42
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Smile Re: do we can't compare QIcon or QPixmap????

    thank q.................

    i got my solution

Similar Threads

  1. Make error with Qt Jambi 4.3.2_01
    By pamalite in forum Installation and Deployment
    Replies: 0
    Last Post: 22nd November 2007, 12:05
  2. QPixmap and HBITMAP
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 16:24

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.