Samuel Martin
Samuel Martin

Reputation: 63

Alternative to QImage when using QT-=gui

QImage has a lot of nice functionality for image file I/O

However, if you need to compile a command-line application to run on a linux server (specifically without X), you need to compile with QT-=gui, which means no QImage, (also no QVector3d, and no QMatrix4x4 among others, which I really don't understand why these basic data types have a GUI dependency). Do I really have to use a separate library for image file handling in GUI and non-GUI apps, or is there something I'm missing?

This is with Qt 5.4.2. The executable fails to start with:

QXcbConnection: Could not connect to display

Upvotes: 3

Views: 1008

Answers (1)

Samuel Martin
Samuel Martin

Reputation: 63

I came across a solution here:

Qt 5.1 QApplication Without Display - QXcbConnection: Could not connect to display

TL;DR, you CAN run Qt-applications on headless instances (without running X) as long as you add -platform offscreen to the program arguments at run-time

This works even if you link to QtGUI and QtOpenGL for basic datatypes

Upvotes: 3

Related Questions