Nominate our 2022 Qt Champions!

Modeltest from official Qt5 doc is definitly not for Qt5, and testmodel find on git for qt5 not works too...

  • someone know a serious modeltest who really works ?
    this from Qt5 doc is not for qt5 (i don't know why it is inside this doc... serve nothing)
    and this one from git (seems to be for Qt5 but 2 years old...):

    don't woks too: compil well but have a segment fault error directly at the start of first function...

    is there a modeltest who really works ? or do you know why no one works ?
    (maybe you can test by yourself)

  • Hi,

    I had same problem.

    I modified modeltest and succesfully compiled with Qt5.4.
    I must warn that my modifications of modeltest is maybe not in consistency with original purpouse of this project: I dont want to use this project in unit testing and i want to see all mistakes at runtime (see below in point 3).

    What I did:

    1. Replace qVariantCanConvert with QVariant::canConvert (according to

    if ( variant.isValid() ) myVERIFY( variant.canConvert(QMetaType::QString));

    1. Add function DynamicTreeModel::reset() which missing in QAbstractItemModel in latest Qt versions.
      void reset()

    2. Replace QVERIFY and QCOMPARE with my own macros (To report failed tests at runtime).

    #define myVERIFY(statement)
    if(!(statement)) { qCritical() << "ModelTest myVERIFY failed at line " << LINE; return; }

    #define myCOMPARE(actual, expected)
    if((actual)!=(expected)) { qCritical() << "ModelTest myCOMPARE failed at line " << LINE << "(actual="<< (actual) << ";expected=" << (expected) << ")"; return; }

    I am realy not sure if I did all theese changes right so any prompts are welcome...

  • thanks for answer wydesenej
    i try to download the files from same link than before without any succes due ti the page has bben removed (i hope she will go back soon).
    So maybe you have a git repository to provide the code with or an other idea ?

    But anyway, maybe someone see your post and do something at the same time i try to have it.

    thanks again for fix.

Log in to reply