Results 1 to 4 of 4

Thread: program cannot connect to X server

  1. #1
    Join Date
    Jun 2006
    Location
    Colorado
    Posts
    12
    Thanks
    5
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default program cannot connect to X server

    I have written rather simple application that parses a data file then based on the command line arguments set by the user the app will generate a plot (using the qwt lib) and saves it as a .png file. The plot is never displayed by the actual application. The purpose of the app is to only parse and generate the .png file.

    How the plot application is even called is a slightly more complicated matter. The user interface is provided through a web browser that eventually passes the desired settings to a python script that actually calls my executable.

    The problem I have is that instead of a .png file being generated the following debug statement is displayed on the webpage

    dwp: cannot connect to X server

    I really have no idea how to fix this. I'm trying to demonstrate the power and usability of Qt and the derived libraries to my co-workers.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 162 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: program cannot connect to X server

    a guess: see the QApplication constructor that takes a bool (3rd arg) to disable a gui.

    Otherwise creating a QApplication will (under X11) cause Qt to try to open a connection to an X server.

  3. #3
    Join Date
    Jun 2006
    Location
    Colorado
    Posts
    12
    Thanks
    5
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: program cannot connect to X server

    That seems to be a step in the right directionI've changed the app line in my main to the following.

    QApplication app(argc, argv, QApplication::Tty);

    I'm not getting the 'cannot connect to X server' error message, but I'm now getting the following error message.

    QWidget: Cannot create a QWidget when no GUI is being used
    Aborted

    The only reason I'm using the QWidget class because I'm using qwtplot & QwtPlotCurve

  4. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 162 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: program cannot connect to X server

    Bad luck: you need a gui when you want to create widgets.
    You might have to setup a "dummy" X server (not necessarily on the same machine your app is running on) and set DISPLAY to point to that machine.

    You might be lucky (doubt it) and it might be possible to create a QImage without creating a QWidget. But I don't think qwt's api supports that.

Similar Threads

  1. Trying to Connect To SQL Server 2005
    By rossd in forum Installation and Deployment
    Replies: 0
    Last Post: 6th March 2009, 19:56
  2. Connect to a server, send data and exit
    By Pepe in forum Newbie
    Replies: 6
    Last Post: 27th July 2007, 11:29
  3. cannot connect to X server
    By jcr in forum Qt Programming
    Replies: 1
    Last Post: 18th April 2007, 14:22
  4. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19
  5. connect to sql server
    By raphaelf in forum Qt Programming
    Replies: 15
    Last Post: 27th February 2006, 18:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.