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

后端 未结 2 805
小鲜肉
小鲜肉 2020-12-29 07:27

I\'m using Qt5.1 and I\'m trying to create a QApplication without a display. I need to draw text with QPainter, so I need to use QApplication (or QGuiApplication), otherwise

相关标签:
2条回答
  • 2020-12-29 08:01

    Yes, that's a Qt 3 (?) thing that is gone in Qt 5. Try running your application with the -platform offscreen command line option instead.

    Note that you don't need QApplication or linking to QtWidgets to just draw upon a QImage, using QGuiApplication (and linking to QtGui) is sufficient.

    0 讨论(0)
  • 2020-12-29 08:15

    If you want to create an app without GUI, you need to use QCoreApplication instead of QApplication.

    0 讨论(0)
提交回复
热议问题