All of these demos will be preset for the raspberry 'RPI3
but can easily be changed for x86_64 changing and uncommenting one line of code
I also tried this on Manjaro archlinux RPI3
'RPI3
PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith -I/usr/include/arm-linux-gnueabihf/qt5 -fPIC
but lets say you want to test on an x86_64
well just comment out the the PRAGMA line for the RPI3
and uncomment the x86_64 PRAGMA line
'x86_64
PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith -Wno-deprecated -fPIC -I/usr/include/x86_64-linux-gnu/qt5
I like archlinux Manjaro too very cutting edge software versions!
'Manjaro archlinux RPI
PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith -I/usr/include/qt5 -fPIC
dowload the source code
PRAGMA INCLUDE <QtWidgets/QApplication> <QtWidgets/QMainWindow> <QtWidgets/QComboBox> <QtWidgets/QHBoxLayout> <QtWidgets/QLabel>
PRAGMA INCLUDE <QtWidgets/QLabel> <QtWidgets/QPushButton> <QtWidgets/QStatusBar> <QtWidgets/QFrame>
PRAGMA LDFLAGS -lQt5Widgets -lQt5Gui -lQt5Core -lpthread -latomic
PRAGMA COMPILER g++
'RPI3
PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith -I/usr/include/arm-linux-gnueabihf/qt5 -fPIC
'x86_64
'PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith -Wno-deprecated -fPIC -I/usr/include/x86_64-linux-gnu/qt5
'Manjaro archlinux RPI
'PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith -I/usr/include/qt5 -fPIC
OPTION PARSE FALSE
'--------------------------------------
SUB OnOkPressed()
'--------------------------------------
Statusbar->showMessage( "OK button pressed", 4000)
'---note the 4000 is 4 seconds to view the message
PRINT "OK button pressed"
END SUB
'--------------------------------------
SUB OnApplyPressed()
'--------------------------------------
Statusbar->showMessage("Apply button pressed", 4000)
PRINT "Apply button pressed"
END SUB
DECLARE app TYPE QApplication*
DECLARE frame TYPE QFrame*
DECLARE hbox TYPE QHBoxLayout*
DECLARE okBtn TYPE QPushButton*
DECLARE aplBtn TYPE QPushButton*
DECLARE label TYPE QLabel*
DECLARE Statusbar TYPE QStatusBar*
DECLARE w TYPE QWidget*
app = new QApplication(argc, argv)
'--- Create a widget instead of a window
w = new QWidget()
frame = new QFrame()
'setCentralWidget(frame)
hbox = new QHBoxLayout(frame)
okBtn = new QPushButton("OK", frame)
hbox->addWidget(okBtn, 0, Qt::AlignLeft | Qt::AlignTop)
aplBtn = new QPushButton("Apply", frame)
hbox->addWidget(aplBtn, 1, Qt::AlignLeft | Qt::AlignTop)
Statusbar = new QStatusBar()
'--- Set the hbox as the layout of the widget
'--- this fixes having a window and a widget that are not joined
hbox->addWidget(Statusbar, 2)
w->setLayout(hbox )
QObject::connect(okBtn, &QPushButton::clicked, OnOkPressed)
QObject::connect(aplBtn, &QPushButton::clicked, OnApplyPressed)
Statusbar->show()
w->resize(450, 150)
w->setWindowTitle("Statusbar demo")
w->show()
return app->exec()