I'm trying to output a very basic (one-window based) QT application on my screen:
.. and a mainwindow.ui that looks like this:
Nothing fancy. This code works fine on my Ubuntu machine. Now, I understand that FrameBuffer is not an option on FreeBSD, so I have xorg installed.
This is how my QT project folder looks like:
When I launch TestWindow
I looked up this error, but I can't seem to make much sense of it. Would I need to first use
Code:
// this is mainwindow.cpp
#include"mainwindow.h"
#include"ui_mainwindow.h"
MainWindow::MainWindow(QWidget*parent):
QMainWindow(parent),
ui(newUi::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
deleteui;
}
Code:
// this is the main.cpp
#include"mainwindow.h"
#include<QApplication>
intmain(intargc,char*argv[])
{
QApplicationa(argc,argv);
MainWindoww;
w.show();
returna.exec();
}
Code:
<?xmlversion="1.0"encoding="UTF-8"?>
<uiversion="4.0">
<class>MainWindow</class>
<widgetclass="QMainWindow"name="MainWindow">
<propertyname="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<propertyname="windowTitle">
<string>MainWindow</string>
</property>
<widgetclass="QWidget"name="centralWidget"/>
<widgetclass="QMenuBar"name="menuBar">
<propertyname="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>25</height>
</rect>
</property>
</widget>
<widgetclass="QToolBar"name="mainToolBar">
<attributename="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attributename="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widgetclass="QStatusBar"name="statusBar"/>
</widget>
<layoutdefaultspacing="6"margin="11"/>
<resources/>
<connections/>
</ui>
Nothing fancy. This code works fine on my Ubuntu machine. Now, I understand that FrameBuffer is not an option on FreeBSD, so I have xorg installed.
This is how my QT project folder looks like:
Code:
Makefile
main.o
moc_mainwindow.cpp
TestWindow
mainwindow.cpp
moc_mainwindow.o
TestWindow.core
mainwindow.h
ui_mainwindow.h
TestWindow.pro
mainwindow.o
main.cpp
mainwindow.ui
When I launch TestWindow
./TestWindow I get the following error:
Code:
QXcbConnection: Could not connect to display
Abort trap (core dumped)
I looked up this error, but I can't seem to make much sense of it. Would I need to first use
xinit before launching any GUI QT-based app.? I have tried to launch this app. via ssh and also locally (on the FreeBSD machine) getting the same error.