Browse Source

initial commit

master
Hendrik Schutter 4 months ago
parent
commit
249a8ac56b
7 changed files with 201 additions and 0 deletions
  1. +8
    -0
      .gitignore
  2. +11
    -0
      demo/untitled/main.cpp
  3. +24
    -0
      demo/untitled/mainwindow.cpp
  4. +24
    -0
      demo/untitled/mainwindow.h
  5. +76
    -0
      demo/untitled/mainwindow.ui
  6. +27
    -0
      demo/untitled/untitled.pro
  7. +31
    -0
      sysroot-relativelinks.py

+ 8
- 0
.gitignore View File

@ -65,3 +65,11 @@ compile_commands.json
CTestTestfile.cmake
_deps
build/
tools/
sysroot/
qt_src/
.kate-swp

+ 11
- 0
demo/untitled/main.cpp View File

@ -0,0 +1,11 @@
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}

+ 24
- 0
demo/untitled/mainwindow.cpp View File

@ -0,0 +1,24 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
static uint32_t counter = 0U;
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
counter++;
ui->lcdNumber->display(QString::number(counter));
}

+ 24
- 0
demo/untitled/mainwindow.h View File

@ -0,0 +1,24 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void on_pushButton_clicked();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

+ 76
- 0
demo/untitled/mainwindow.ui View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>140</x>
<y>250</y>
<width>541</width>
<height>121</height>
</rect>
</property>
<property name="font">
<font>
<family>Adobe Courier [Adobe]</family>
</font>
</property>
<property name="text">
<string>Hello World on a RasperryPi without Xserver!</string>
</property>
</widget>
<widget class="QLCDNumber" name="lcdNumber">
<property name="geometry">
<rect>
<x>80</x>
<y>30</y>
<width>301</width>
<height>161</height>
</rect>
</property>
<property name="smallDecimalPoint">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>440</x>
<y>140</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>Push ME!!</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

+ 27
- 0
demo/untitled/untitled.pro View File

@ -0,0 +1,27 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
#target.path = /home/pi/$${TARGET}/bin
#INSTALLS += target

+ 31
- 0
sysroot-relativelinks.py View File

@ -0,0 +1,31 @@
#!/usr/bin/env python
import sys
import os
# Take a sysroot directory and turn all the abolute symlinks and turn them into
# relative ones such that the sysroot is usable within another system.
if len(sys.argv) != 2:
print("Usage is " + sys.argv[0] + "<directory>")
sys.exit(1)
topdir = sys.argv[1]
topdir = os.path.abspath(topdir)
def handlelink(filep, subdir):
link = os.readlink(filep)
if link[0] != "/":
return
if link.startswith(topdir):
return
#print("Replacing %s with %s for %s" % (link, topdir+link, filep))
print("Replacing %s with %s for %s" % (link, os.path.relpath(topdir+link, subdir), filep))
os.unlink(filep)
os.symlink(os.path.relpath(topdir+link, subdir), filep)
for subdir, dirs, files in os.walk(topdir):
for f in files:
filep = os.path.join(subdir, f)
if os.path.islink(filep):
#print("Considering %s" % filep)
handlelink(filep, subdir)

Loading…
Cancel
Save