سؤال

I am trying to make gui Qxt Application, but when launches it creates a console window. I don't need console window, how can I hide it?

I'm using mingw gcc4.4 qt4.8 libqxt-0.6.2

.pro file:

QT       += core gui network testlib

CONFIG  += qxt
QXT     += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = yascreens
TEMPLATE = app


SOURCES += main.cpp \
    application.cpp \
    configwidget.cpp \
    network.cpp \
    imageselectwidget.cpp

HEADERS  += \
    application.h \
    configwidget.h \
    network.h \
    defines.h \
    imageselectwidget.h

RESOURCES += \
    resources.qrc

QMAKE_CXXFLAGS += -std=c++0x

FORMS += \
    config.ui

Full sources here (github).

هل كانت مفيدة؟

المحلول 2

The problem was that I was usting QTest and testlib in pro file. Just don't use QTest :)

نصائح أخرى

I found a partitial solution (console window appears for a moment and then hides). You should modify your main.cpp file like:

#if defined(Q_OS_WIN)
    #define _WIN32_WINNT 0x0500
    #include <windows.h>
    HWND WINAPI GetConsoleWindow(void);     // For hiding console in windows
#endif

int main(int argc, char *argv[])
{
    #if defined(Q_OS_WIN)
        HWND hwnd = GetConsoleWindow();
        ShowWindow(hwnd, 0);               // For hiding console in windows
    #endif

    // Your application code here
    // ...
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top