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
get at the low level mouse signals
PRAGMA INCLUDE <QtWidgets/QApplication> <QtWidgets/QMainWindow>
PRAGMA INCLUDE <QtCore/QDebug> <QtGui/QResizeEvent>
PRAGMA INCLUDE <iostream>
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
DECLARE app TYPE QApplication*
DECLARE w TYPE QWidget*
'---must include this <QtCore/QDebug>
'--- a new macro without formatting or casting or c++
DEF FN PRINTOUT(x) = qDebug() << (x)
app = new QApplication(argc, argv)
'--- Create a widget instead of a window
w = new QWidget()
DECLARE event TYPE QKeyEvent*
'------------------------------------------------
SUB QWidget::resizeEvent(QResizeEvent *event)
'------------------------------------------------
'---how to get around using debug for the terminal and use PRINT
PRINT "Old size:"
PRINTOUT(event->oldSize() )
PRINT "New size:"
PRINTOUT( event->size() )
END SUB
'------------------------------------------------
SUB QWidget::keyPressEvent(QKeyEvent *event)
'------------------------------------------------
IF event->key() == Qt::Key_Escape THEN
close()
END IF
PRINT "you pressed escape "
END SUB
'------------------------------------------------
SUB QWidget::keyReleaseEvent(QKeyEvent *event)
'------------------------------------------------
PRINT "has been released"
PRINTOUT( event->text() )
END SUB
'------------------------------------------------
SUB QWidget::mouseMoveEvent(QMouseEvent *event)
'------------------------------------------------
PRINT "Position: "
PRINTOUT( event->pos() )
END SUB
'------------------------------------------------
SUB QWidget::mousePressEvent(QMouseEvent *event)
'------------------------------------------------
PRINT "Mouse pressed:"
PRINTOUT( event->button() )
END SUB
'------------------------------------------------
SUB QWidget::mouseReleaseEvent(QMouseEvent *event)
'------------------------------------------------
PRINT "Mouse released:"
PRINTOUT( event->button() )
END SUB
w->resize(500, 200)
w->setWindowTitle("mouse events in terminal")
w->show()
return app->exec()