Signals and Slots on console application

  • I am trying to make a network console application and i want to use signals and slots.
    Is there any example to use see how to?

  • Hi,
    well I'm not sure if your question is how to use Signals & Slots in a console application or how to manage a network console application.

    To use Signals & Slots in a console application, just use QCoreApplication.
    For coding a network console application, just google it, you'll get a lot of results ;-)

  • Just make a Qt Console Application in Qt Creator in the usual [File > New] way. Then, add this line to your .pro file:

    QT += network

    At this point, you're all set to start coding. Click on the "Welcome" tab in Qt Creator and then click on "Examples", then type in "Network" in the search field, a bunch of networking examples will show up. Click on one of them and learn how to use Qt's networking classes, most of those examples are graphical applications however.

    You also need to use QCoreApplication so that you have an event loop, which is necessary for signals and slots, the new Qt Console Application template in Qt Creator sets that all up for you.

  • OK, let me rephrase what I said previously: The signals and slots mechanism doesn't require an event loop, but in a networked console application you do need an event loop if you want to use signals and slots because console applications usually quit really fast, and networked applications require time to receive all the data from the network, so in this case you do need an event loop to keep the application alive. Sorry for the confusion I may have caused.

    Anyways, what seems to be your difficulty with setting up a networked console application with Qt?

  • I am trying to make an application on raspberrypi.
    The consept is a streaming video from raspberrypi as server to another pc win 7 as client receiver.
    The question is how to make a stream and how to receive it.

  • Lifetime Qt Champion


    Video streaming is not an easy topic, so I'd recommend using something already working like e.g. gstreamer to do that.

    Hope it helps

  • Is there some code example with gstreamer and qt to start?

  • Lifetime Qt Champion

    You have the QtGStreamer project which should help you

Log in to reply

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