How to define structure inside hash?



  • Hi is it possible to define a hash function with a structure inside it?
    I tried to define as shown below,....
    But getting link error saying..."exited with code -1073741819"
    @
    class FilterColl : public QDialog
    {
    Q_OBJECT

    public:
    struct StructCheckedEntries {
    QString filename;
    QCheckBox *checkbox;
    QComboBox *combobox;
    QLineEdit *lineedit;
    };
    QHash<QString,StructCheckedEntries *> HCheckedEntries;
     
     
    private:
    Ui::FilterColl *ui;
    StructCheckedEntries *structentry;
    };
    

    @



  • You can basically use any type in the collections. Judging from your exit code you have most probably an access violation somewhere, which results in an segmentation fault.



  • We're not talking about a hash function for your class, that would take an instance of that class and return an integer, but about dealing with an QHash based member attribute. Correct wording is essential in programming...

    For the linker error, isn't there more than one single number?



  • @ QHash<QString,FilterColl::StructCheckedEntries *> HCheckedEntries;@



  • Thank u all...
    I did it....
    Thank u so much....


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.