February 1, 2012

aurora aurora
Lab Rat
137 posts

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”

  1.     class FilterColl : public QDialog
  2.     {
  3.     Q_OBJECT
  4.      
  5.     public:
  6.     struct StructCheckedEntries {
  7.     QString filename;
  8.     QCheckBox *checkbox;
  9.     QComboBox *combobox;
  10.     QLineEdit *lineedit;
  11.     };
  12.     QHash<QString,StructCheckedEntries *> HCheckedEntries;
  13.      
  14.      
  15.     private:
  16.     Ui::FilterColl *ui;
  17.     StructCheckedEntries *structentry;
  18.     };

4 replies

February 1, 2012

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

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.

February 1, 2012

Volker Volker
Ant Farmer
5428 posts

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?

February 1, 2012

AcerExtensa AcerExtensa
Lab Rat
667 posts

  1.  QHash<QString,FilterColl::StructCheckedEntries *> HCheckedEntries;

 Signature 

God is Real unless explicitly declared as Integer.

February 1, 2012

aurora aurora
Lab Rat
137 posts

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

 
  ‹‹ Pixmap to be added to icon      [Solved] setWindowTitle was not declared in this scope ››

You must log in to post a reply. Not a member yet? Register here!