mercredi 3 mai 2023

Qt::Copying QHash to other classes

dialog.h

QHash<QString, QWidget*> treeFormHash;

dialog.cpp I have a QTreeWidget which is a list of all tests that I want to perform.

    treeFormHash.clear();    
    treeFormHash.insert("Test 1",    pCTest1FormObj);
    treeFormHash.insert("Test 2",    pCTest2FormObj);
    treeFormHash.insert("Test 3",    pCTest3FormObj);
    treeFormHash.insert("Test 4",    pCTest4FormObj);
    treeFormHash.insert("Test 5",    pCTest5FormObj);
    treeFormHash.insert("Test 6",    pCTest6FormObj);
    treeFormHash.insert("Test 7",    pCTest7FormObj);

On currentItemChanged() I want to kick off the test associated with the currentItem in the QTreeWidget. I have got the test methods defined in a separate QThread file called testThread.cpp. I would like to kick off the test in the testThread.cpp based on the currentItem in dialog.cpp. Need help here as I'm not a C++ expert.

Any help is much appreciated.

Aucun commentaire:

Enregistrer un commentaire