How to avoid console window in Qt application, even after Including "testlib" package (for qWait()) in my .pro file?

Hallo everyone,

I have gone through various threads on this topic but, nothing seems to solve my particular problem. Including testlib, makes the console window appear and there I didnot find any option to suppress this behaviour.

But my application still demands testlib to be present (because i badly wanted to use QTest::qWait() method), and no console window to appear. I tried a few options from the other threads but nothing is working. what should i do to suppress this console window even after using 'testlib"?

The options I tried are

  1. adding CONFIG -= console to my .pro file.

        QT += gui \    
            xml \
            core \
            testlib    
        CONFIG += qt \
            windows \
            uitools \
            release        
        CONFIG -= console        
        LIBS += extern/ftd2xx.lib        
        RC_FILE = res/AC-Core.rc        
        QMAKE_CXXFLAGS += -Wall \
    
  2. editing the qmake.conf file, the lines

    QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,console, to    
    QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,windows
    

Any other ideas to suppress the appearing of console window are welcome?

Thanks!

Answers


You don't have to use QTest to get the functionality of QTest::qWait(). If you look at the source code for qWait() you can see how it works and implement this function yourself:

inline static void qWait(int ms)
{
    Q_ASSERT(QCoreApplication::instance());

    QTime timer;
    timer.start();
    do {
        QCoreApplication::processEvents(QEventLoop::AllEvents, ms);
        QTest::qSleep(10);
    } while (timer.elapsed() < ms);
}

Need Your Help

AngularJS. Set default header depending on current route

angularjs

I need to set default header in $http service depending on current route. This is the code:

Why TableView makes NullPointerException?

javafx tableview javafx-8

I have this controller class for showing the data of the method "getProduct" in a TableView, but I have a NullPointerException related to "tableViewItem.setItems(itemData)". I read some posts about...