Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. Run Environment is missing DISPLAY env variable
Forum Updated to NodeBB v4.3 + New Features

Run Environment is missing DISPLAY env variable

Scheduled Pinned Locked Moved Solved QtonPi
3 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vikramg
    wrote on 28 Jun 2017, 06:37 last edited by
    #1

    When deploying to a device (Odroid in this case, but the specific device is not significant), the Run Environment is lacking the DISPLAY env variable. This causes the deployment to fail with a QXcbConnection: Could not connect to display error. Adding the DISPLAY variable set to :0 allows the application to launch correctly.

    If I check env in a shell on the target device, the DISPLAY variable is of course set to :0, as expected. But hitting "Fetch Device Environment" in QtCreator pulls in only a small subset (crucially, missing DISPLAY) from the device environment.

    How can this be fixed, besides adding that variable manually every time I open a project?

    R 1 Reply Last reply 28 Jun 2017, 06:52
    0
    • V vikramg
      28 Jun 2017, 06:37

      When deploying to a device (Odroid in this case, but the specific device is not significant), the Run Environment is lacking the DISPLAY env variable. This causes the deployment to fail with a QXcbConnection: Could not connect to display error. Adding the DISPLAY variable set to :0 allows the application to launch correctly.

      If I check env in a shell on the target device, the DISPLAY variable is of course set to :0, as expected. But hitting "Fetch Device Environment" in QtCreator pulls in only a small subset (crucially, missing DISPLAY) from the device environment.

      How can this be fixed, besides adding that variable manually every time I open a project?

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 28 Jun 2017, 06:52 last edited by
      #2

      @vikramg
      you can try qputenv before creating a QApplication instance.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      V 1 Reply Last reply 28 Jun 2017, 18:37
      0
      • R raven-worx
        28 Jun 2017, 06:52

        @vikramg
        you can try qputenv before creating a QApplication instance.

        V Offline
        V Offline
        vikramg
        wrote on 28 Jun 2017, 18:37 last edited by
        #3

        Thanks @raven-worx
        I'm not convinced that any proactive action ought to be required, but I have verified that adding qputenv("DISPLAY", ":0"); before creating the QApplication instance does indeed work.

        1 Reply Last reply
        0

        1/3

        28 Jun 2017, 06:37

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved