Important: Please read the Qt Code of Conduct -

QPixmap and non X11 environments

  • Hi!
    Just right now I am dealing with an issue very similar to this:

    I need to run some kind of service from a Linux server with no X server installed. My application requires several methods of the QPixmap class, but any time I call loadFromData() then I get a QPixmap exception.

    Of course, to fix the problem I need an X11 server running and the variable DISPLAY well-defined. I understand the solution, but I can't help thinking about this: Is there any other way to deal with image processing from the classic Unix server with no X11 installed at all?

    I would like to read some ideas about how to deal with this problem. Because the QImage/QPixmap APIs are very handy and I don't want to quite using them from my Internet server. Any hints?

  • Why you can't use QImage instead of QPixmap ?

    If you don't want to paint it over a QGraphicsView, i think
    QImage can replace the QPixmap.

    PS: Tupi is great...

  • My first thought about it was to change all the code related to the problem from QPixmap to QImage, but after several days studying the code, I realized that it would take several weeks of hard work to redefine the whole service (weeks that I don't have).

    Looking for an alternative solution, I decided to try this resource:
    using these commands:

    % /usr/bin/Xvfb :0 -screen 0 1600x1200x24 &
    % export DISPLAY=localhost:0.0
    % xhost localhost
    % /usr/bin/myservice &

    Additionally, I added a rule into my firewall to avoid external connections to the X11 port (6000). And that's it. The service is running and working pretty well :)

Log in to reply