Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# CMakeLists.txt fuer test_qledline
#
SET(test_qledline_SRCS
content.cpp
fullline.cpp
main.cpp
mainwindow.cpp
props.cpp
)
SET(test_qledline_HDRS
content.h
fullline.h
mainwindow.h
props.h
)
SET(test_qledline_UICS
ui/mainwindow.ui
ui/content.ui
ui/fullline.ui
ui/props.ui
)
NGL_TARGET_INCLUDE_DIRECTORIES(test_qledline
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
)
NGL_WRAP_UI(test_qledline_SRCS ${test_qledline_UICS})
NGL_ADD_EXECUTABLE(WS NO_TRANSLATION test_qledline ${test_qledline_SRCS} ${test_qledline_HDRS} ${test_qledline_UICS})
NGL_TARGET_LINK_LIBRARIES(test_qledline
qledline
)
+92
View File
@@ -0,0 +1,92 @@
#include <QLayout>
#include "content.h"
#include "fullline.h"
#include "ui_content.h"
Content::Content(QWidget *parent) : QWidget(parent)
, m_ui(new Ui::Content)
{
m_ui->setupUi(this);
}
Content::~Content()
{
delete m_ui;
}
void Content::init()
{
delete layout();
m_layout = new QVBoxLayout(this);
m_layout->setSpacing(0);
while (!m_lines.isEmpty())
deleteLastLine();
while (m_lines.size() < m_lineCount)
newLine();
}
void Content::setLineCount(int lineCount)
{
while(lineCount != m_lines.size())
{
if(lineCount > m_lineCount)
newLine();
else if (lineCount < m_lineCount)
deleteLastLine();
}
m_lineCount = m_lines.size();
}
void Content::setCharCount(int charCount)
{
m_charCount = charCount;
for (FullLine * l : qAsConst(m_lines))
l->setCharCount(m_charCount);
}
int Content::charCount() const
{
return m_charCount;
}
void Content::setHeight(int height)
{
m_height = height;
for (FullLine * l : qAsConst(m_lines))
l->setHeight(height);
}
int Content::height() const
{
return m_height;
}
void Content::setCharCountAndHeight(int charCount, int height)
{
m_charCount = charCount;
m_height = height;
init();
}
void Content::newLine()
{
FullLine *line = new FullLine(m_lines.count()+1, m_height, m_charCount, this);
m_layout->addWidget(line);
m_lines.append(line);
}
void Content::deleteLastLine()
{
if (m_lines.isEmpty())
return;
delete m_lines.last();
m_lines.remove(m_lines.size()-1);
}
+44
View File
@@ -0,0 +1,44 @@
#pragma once
#include <QWidget>
#include <QVector>
class QVBoxLayout;
class FullLine;
namespace Ui {
class Content;
}
class Content : public QWidget
{
Q_OBJECT
public:
explicit Content(QWidget *parent = nullptr);
~Content();
int charCount() const;
int height() const;
public slots:
void setLineCount(int lineCount);
void setCharCount(int charCount);
void setHeight(int height);
void setCharCountAndHeight(int charCount, int height);
private:
void init();
void newLine();
void deleteLastLine();
Ui::Content *m_ui = nullptr;
int m_lineCount = 0;
int m_charCount = 0;
int m_height = 0;
QVBoxLayout *m_layout = nullptr;
QVector<FullLine*> m_lines;
};
+39
View File
@@ -0,0 +1,39 @@
#include <QLayout>
#include "fullline.h"
#include "ui_fullline.h"
FullLine::FullLine(int lineIndex, int height, int charcount, QWidget *parent) :
QWidget(parent)
, m_ui(new Ui::FullLine)
{
m_ui->setupUi(this);
m_ui->props->setLineIndex(lineIndex);
m_ui->ledLine->setCharCountAndHeight(charcount, height);
connect(m_ui->props, &Props::flashTimeChanged, m_ui->ledLine, &QLedLine::setFlashing);
connect(m_ui->props, &Props::colorChanged, m_ui->ledLine, &QLedLine::setColor);
connect(m_ui->props, &Props::textChanged, m_ui->ledLine, &QLedLine::setText);
connect(m_ui->props, &Props::showText, m_ui->ledLine, &QLedLine::setTextVisible);
}
FullLine::~FullLine()
{
delete m_ui;
}
void FullLine::setCharCount(int count)
{
m_ui->ledLine->setCharCount(count);
}
int FullLine::charCount() const
{
return m_ui->ledLine->charCount();
}
void FullLine::setHeight(int height)
{
m_ui->ledLine->setHeight(height);
}
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#include <QWidget>
namespace Ui {
class FullLine;
}
class FullLine : public QWidget
{
Q_OBJECT
public:
explicit FullLine(int lineIndex, int height, int charcount, QWidget *parent = nullptr);
~FullLine();
void setCharCount(int count);
int charCount() const;
void setHeight(int height);
private:
Ui::FullLine *m_ui;
};
+15
View File
@@ -0,0 +1,15 @@
#include <QApplication>
#include "mainwindow.h"
int main(int argc, char* argv[])
{
QApplication app( argc, argv );
//Testing examples ░ ▒ ▓ ☺ Hello world! العربي☺Üة
MainWindow *w = new MainWindow(1, 13, 13);
w->show();
return app.exec();
}
+30
View File
@@ -0,0 +1,30 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "content.h"
MainWindow::MainWindow(int lineCount, int charCount, int height, QWidget *parent)
: QMainWindow(parent)
, m_ui(new Ui::MainWindow)
{
m_ui->setupUi(this);
m_ui->sbLineCount->setValue(lineCount);
m_ui->sbCharCount->setValue(charCount);
m_ui->sbHeight->setValue(height);
Content *content = new Content(this);
content->setCharCountAndHeight(charCount, height);
content->setLineCount(lineCount);
m_ui->scrollArea->setWidget(content);
connect(m_ui->sbLineCount, QOverload<int>::of(&QSpinBox::valueChanged), content, &Content::setLineCount);
connect(m_ui->sbCharCount, QOverload<int>::of(&QSpinBox::valueChanged), content, &Content::setCharCount);
connect(m_ui->sbHeight, QOverload<int>::of(&QSpinBox::valueChanged), content, &Content::setHeight);
connect(m_ui->pbClose, &QPushButton::clicked, this, &MainWindow::close);
}
MainWindow::~MainWindow()
{
delete m_ui;
}
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(int lineCount, int charCount, int height, QWidget *parent = nullptr);
~MainWindow();
signals:
void onSbLineCountValueChanged(int lineCount);
private:
Ui::MainWindow *m_ui;
};
+47
View File
@@ -0,0 +1,47 @@
#include <QColorDialog>
#include "props.h"
#include "ui_props.h"
Props::Props(QWidget *parent) : QWidget(parent)
, m_ui(new Ui::Props)
{
m_ui->setupUi(this);
connect(m_ui->slFlashTime, &QSlider::valueChanged, this, &Props::flashTimeChanged);
connect(m_ui->leInput, &QLineEdit::textChanged, this, &Props::textChanged);
connect(m_ui->pbTextVisible, &QPushButton::clicked, this, &Props::showText);
connect(m_ui->pbColor, &QPushButton::clicked, this, &Props::onPbColorClicked);
}
Props::~Props()
{
delete m_ui;
}
int Props::lineIndex() const
{
return m_lineIndex;
}
void Props::setLineIndex(int lineIndex)
{
m_lineIndex = lineIndex;
m_ui->lbTitle->setText(tr("%1. Line").arg(m_lineIndex));
}
void Props::onPbColorClicked()
{
m_color = QColorDialog::getColor(m_color, this, tr("Farbe wählen"));
emit colorChanged(m_color);
}
QString Props::inputText() const
{
return m_ui->leInput->text();
}
void Props::setInputText(const QString &inputText)
{
m_ui->leInput->setText(inputText);
}
+34
View File
@@ -0,0 +1,34 @@
#pragma once
#include <QWidget>
namespace Ui {
class Props;
}
class Props : public QWidget
{
Q_OBJECT
public:
explicit Props(QWidget *parent = nullptr);
~Props();
int lineIndex() const;
void setLineIndex(int lineIndex);
QString inputText() const;
void setInputText(const QString &inputText);
signals:
void textChanged(const QString& newText);
void showText(bool visible);
void flashTimeChanged(int msecs);
void colorChanged(const QColor &newColor);
private slots:
void onPbColorClicked();
private:
int m_lineIndex = 0;
QColor m_color;
Ui::Props *m_ui = nullptr;
};
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Content</class>
<widget class="QWidget" name="Content">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>435</width>
<height>266</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout"/>
</widget>
<resources/>
<connections/>
</ui>
+92
View File
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FullLine</class>
<widget class="QWidget" name="FullLine">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>871</width>
<height>130</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>130</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>4</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="Props" name="props" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>100</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLedLine" name="ledLine" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>100</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Props</class>
<extends>QWidget</extends>
<header>props.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QLedLine</class>
<extends>QWidget</extends>
<header location="global">QLedLine/qledline.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
+218
View File
@@ -0,0 +1,218 @@
<?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>823</width>
<height>458</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<widget class="Content" name="content">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>813</width>
<height>204</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="lbCharCount">
<property name="text">
<string>Charcount:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="sbCharCount">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbHeight">
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="sbHeight">
<property name="suffix">
<string>px</string>
</property>
<property name="minimum">
<number>7</number>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="value">
<number>20</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbLineCount">
<property name="text">
<string>Linecount:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="sbLineCount">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbClose">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>823</width>
<height>19</height>
</rect>
</property>
<property name="nativeMenuBar">
<bool>false</bool>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>Content</class>
<extends>QWidget</extends>
<header>content.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
+125
View File
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Props</class>
<widget class="QWidget" name="Props">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<height>100</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="verticalLayout_2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lbTitle">
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
<kerning>false</kerning>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leInput">
<property name="frame">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Input Text</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pbTextVisible">
<property name="text">
<string>On</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbColor">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSlider" name="slFlashTime">
<property name="maximum">
<number>1500</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>