Testing designed widgets



  • Hello forum

    I started to write a widget library in Qt. I found that testing a newly designed widget is very error prone and a little boring! Currently I'm doing this:

    Compile project

    Install it system-wide (sudo make uninstall && sudo make install)

    Restrart Qt Creator

    Open testing application (which is a test application using widgets) and recompile it

    When found a small bug, I have to do all above steps again...

    I think there should be some tool for this. Something that let developers to test widgets in widget application itself (without actually installing it in system)



  • No, you need to do so much things ;-)

    Step1, Write your own custom widget. (which include x.h, x.cpp and optional x.ui, x.qrc, ...)

    Step1.5(Optional), Make such a custom widget as a shared or static libaray.

    Step2, Write A test application which use your above widget.

    Step3(Optional), Write a plugin for designer if you want.


    BTW, it's not required to create plugin if such a custom widget used in you designer not very often. Promote method will be easy and convenient to use in such cases. However, If your custom widgets will be used by many projects or by many user, feel free to implement one plugin.



  • @1+1-2

    Currently I'm sharing widget files (h+cpp+ui) between a test application (in a folder other than widget library), and a widget plugin project. Someone should write add a feature to Qt Creator for it.

    Thanks.



  • [quote author="soroush" date="1337631794"]1+1-2

    Currently I'm sharing widget files (h+cpp+ui) between a test application (in a folder other than widget library), and a widget plugin project. Someone should write add a feature to Qt Creator for it.

    Thanks.[/quote]

    Sorry for my poor English, I can not fully catch up with you.

    Perhaps a normal custom widgets library like this:

    @
    rootdir
    |-- project.pro (TEMPLATE=subdirs )
    |-- libwidget
    | |-- libwidget.pro (TEMPLATE=lib, static or shared library)
    | |-- x.h
    | |-- x.cpp
    | -- ... |-- tests\ | |-- tests.pro (TEMPLATE=app, depends on above library) | |-- tst_x.cpp |-- ...
    -- designerplugin(optional)\ |-- designerplugin.pro (TEMPLATE=lib, dpends on above library)-- main.cpp
    @

    And IMO, all the features more or less have been provided by QtCreator.



  • This looks like to be a better solution. I'm going to convert project to that structure.

    Thank you :)


Log in to reply
 

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