Home QDmx ql console Developer

Introduction Guide Admin tool Observer Qt API Java API Command Line Interface Download

QDmx Library for Qt 4.5

This page give you examples on how to use the QDmx Library with Qt 4.5

See also API Documentation

To get a real example, you can have a look to the cli program source

To start, you simply require Qt 4.5, and qdmx client library.

1. Get library

Go to download page and take the appropriate binary version. You may also compile from sources (instructions on download page).

You will also require Qt 4.5 SDK

2. Setup your project

You have simply to add the following line in your .pro, it will add all required dependencies.


In your .cpp files, simply include "qdmxclient.h"

#include "qdmxclient.h"

3. Establish connection to server, get available universes

Simple example : connect to server, and display universes list

The first step is to create an instance of QDmxClient, then you have to connect to server. There is multiple strategies :

Finally, you have to retreive universes list using fetchUniverses()

QDmxClient *client = new QDmxClient(); // Create a client

if ( !client->connectAutoLocal() ) // Connect to local server (using default hostname and default port)

if ( !client->fetchUniverses() ) // Fetch available universe list

for (int i=0; j < client->universesCount(); i++) // Display all available universes
  QDmxClientUniverse* univ= client->getUniverse(i);
  // Note: QDmxClientUniverse provide more informations, see documentation for details


delete client;

4. Send DMX data

You first have to get the universe using getUniverseByXXX() (you must have called fetchUniverses() before).

Then you have to start the universe with start(), and setup how many channels are active using setActiveChannelsCount().

From this point you can can send data using setChannels().

Once you have done, don't forget to call stop().


if ( !client->fetchUniverses() ) // Never forget to call this before trying to get some universe !

QDmxClientUniverse* univ = client->getUniverseByPermaId("dummy:0"); // Get sandbox

univ->start(); // Start universe

univ->setActiveChannelsCount(12); // Set how many channels are active

quint8 data[12]; // Array of unsigned 8 bits integers (unsigned char)

while ( /* ... some condition ... */ )
  // ... generate data ...
  univ->setChannels(0,12,data); // Send data


univ->stop(); // Stop universe

To be continued...

(c) Copyright 2006, 2009 Julien Etelain. All rights reserved. - Icons (c) Copyright Everaldo.com

Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.