Results 1 to 4 of 4

Thread: [QTest] adding class column and row

  1. #1
    Join Date
    Aug 2015
    Posts
    14
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default [QTest] adding class column and row

    I've created a class named foo like:
    Qt Code:
    1. class foo {
    2. public:
    3. int bar;
    4. }
    To copy to clipboard, switch view to plain text mode 

    How can I add a column and row in QTest?

    I've tried:
    Qt Code:
    1. QTest::addColumn<foo>("f");
    2. QTest::addColumn<foo*>("f");
    3.  
    4. //and
    5. QTest::row("id1") << new foo();
    6. QTest::row("id1") << foo();
    To copy to clipboard, switch view to plain text mode 

    but I've got a error like
    Qt Code:
    1. /home/amreo/src/src-public/qt5/qt5/qtbase/include/QtCore/qglobal.h:703: error: invalid application of 'sizeof' to incomplete type 'QStaticAssertFailure<false>'
    2. enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __COUNTER__) = sizeof(QStaticAssertFailure<!!(Condition)>)}
    3. ^
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: [QTest] adding class column and row

    The test data mechanism stores data in QVariant.
    You need to make your type known to the Qt meta type system

    Qt Code:
    1. Q_DECLARE_METATYPE(foo);
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  3. #3
    Join Date
    Aug 2015
    Posts
    14
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default Re: [QTest] adding class column and row

    When do I put it? In test class or in class?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: [QTest] adding class column and row

    In the header of foo.

    Cheers,
    _

Similar Threads

  1. Problem when adding a column to a QAbstractProxyModel.
    By ma.renaud in forum Qt Programming
    Replies: 1
    Last Post: 4th March 2014, 23:20
  2. QListView: how to adding column text?
    By richardander in forum Qt Programming
    Replies: 2
    Last Post: 31st December 2013, 10:40
  3. Replies: 7
    Last Post: 18th August 2011, 14:43
  4. adding elements to QTreeWidget column 2
    By mastupristi in forum Qt Programming
    Replies: 3
    Last Post: 25th May 2011, 15:31
  5. QAbstractProxyModel: adding a virtual column
    By ultim8 in forum Qt Programming
    Replies: 6
    Last Post: 28th August 2008, 17:10

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.