Jump to content
  • 0
John User

Running GUI APP inside Development VM with NO WBT available

Question

I am resource sharing my WBT and do not have it till next week. I would like to run,and test my GUI app with out the WBT available.
I used the QRC Wizard to create my app (WBT App in the wizard).
When i select debug build and step through the execution, it blocks on the following line:
MainWindow w; 

int main( int argc, char *argv[] )
{
    //    Initializes the WBT Client's image resource file.
    //    Images can be accessed by addressing to ":/images/file-name.png"
    Q_INIT_RESOURCE( images );
    
    QApplication a( argc, argv );
    MainWindow w;   //comment: its blocking here!!!!
    w.show();
    
    return a.exec();
}
Any suggestions?
 

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 1

There are multiple ways to skin the cat...
This is what i do...

1. From inside the DEV VM: Create Project, then select WBT App. Finish going through the wizard by fill in all the settings as you wish!
2. Open up the mainwindow.h... and make the following mods:
    //NOTE: warning:  The following line blocks the instantiation  of MainWindow
    //WbtBroadcastMessenger m_messenger;
    WbtApi::WbtBroadcastMessenger* m_wbtBroadcastMessenger; //ONLY INSTANTIATED if WBT IS ON THE LAN

3. In the same file (mainwindow.h), use the following code (i place mine right under the 'using namespace std;' on LINE#7:
//IF    : this is a RELEASE build...
//THEN  : ALLOW m_wbtBroadcastMessenger TO BE instantiate
#ifdef QT_NO_DEBUG
#define WBT_ON_LAN true
#else
#define WBT_ON_LAN false
#endif

4. In the file mainwindow.cpp, place the following code in your constructor:
    m_wbtBroadcastMessenger = NULL;
    if (WBT_ON_LAN)
    {
        m_wbtBroadcastMessenger = new WbtApi::WbtBroadcastMessenger;
        m_wbtBroadcastMessenger->broadcastFilter( "wbtclient", "", "" );
        m_wbtBroadcastMessenger->setIncomingMessageCallback( MessageCallback, this );
    }

5. Choose a build type (are you running it in the DEV VM?, OR are you running it with  WBT resource?)
Select DEBUG build if you want to run it in your DEV VM with no WBT resource.
Select RELEASE build if you want to build for with a WBT unit.

note: build for DEBUG, and it will not block! When your ready to test on your WBT, build for RELEASE.

 

  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0

What is the code for MainWindow? If you aren't connecting to a WBT and you instantiate a data structure that requires a connection to a WBT the software will hang.

The classes that require a connection should all have a note in their general description indicating that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×