Results 1 to 9 of 9

Thread: QHash with key and struct problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QHash with key and struct problem

    Well, is it possible to get value of key if there is a value known from QHash?

    Ok, that was another stupid question, it is all in docs ... there is a key() method ...

    But, following method:
    Qt Code:
    1. inline qint16 merchandiseId(const QString& strKey) const
    2. { return m_strNames.key(strKey).iLanguageId; };
    To copy to clipboard, switch view to plain text mode 
    produces following errors:
    Qt Code:
    1. In file included from CMerchandizeElement.cpp:8:
    2. CMerchandizeElement.h: In member function `qint16 CMerchandizeElement::merchandiseId(const QString&) const':
    3. CMerchandizeElement.h:95: error: no matching function for call to `QHash<qint16, merchandiseLangStruct>::key(const QString&) const'
    4. c:/Qt/4.4.3/include/QtCore/../../src/corelib/tools/qhash.h:652: note: candidates are: const Key QHash<K, V>::key(const T&) const [with Key = qint16, T = merchandiseLangStruct]
    5. c:/Qt/4.4.3/include/QtCore/../../src/corelib/tools/qhash.h:658: note: const Key QHash<K, V>::key(const T&, const Key&) const [with Key = qint16, T = merchandiseLangStruct]
    6. mingw32-make[1]: *** [debug/CMerchandizeElement.o] Error 1
    7. mingw32-make: *** [debug] Error 2
    To copy to clipboard, switch view to plain text mode 
    Can someone help me please?
    Last edited by MarkoSan; 6th October 2008 at 22:16.
    Qt 5.3 Opensource & Creator 3.1.2

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.