Fixed resource compilation

This commit is contained in:
2023-02-18 18:58:42 +01:00
parent bf96d4d0fe
commit 3f50b4c6bf
6 changed files with 21 additions and 29 deletions

View File

@ -4,14 +4,12 @@ project(lightcontrol VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON) set(CMAKE_CXX_EXTENSIONS ON)
find_package(Qt6 6.2 REQUIRED COMPONENTS SerialPort Quick) find_package(Qt6 6.2 REQUIRED COMPONENTS SerialPort Quick)
qt_add_executable(applightcontrol qt_add_executable(applightcontrol
resources.qrc
main.cpp main.cpp
devicetypesmodel.h devicetypesmodel.cpp devicetypesmodel.h devicetypesmodel.cpp
dmxcontroller.h dmxcontroller.cpp dmxcontroller.h dmxcontroller.cpp
@ -23,6 +21,10 @@ qt_add_executable(applightcontrol
qt_add_qml_module(applightcontrol qt_add_qml_module(applightcontrol
URI lightcontrol URI lightcontrol
RESOURCES
icons/movinghead.png
icons/nebelmaschine.png
icons/rgbstrahler.png
VERSION 1.0 VERSION 1.0
QML_FILES QML_FILES
main.qml main.qml

View File

@ -8,14 +8,6 @@ ColumnLayout {
Label { Label {
text: qsTr("Device Types Settings") text: qsTr("Device Types Settings")
} }
Image {
height: 64
width: 64
source: ":/lightcontrol/icons/movinghead.png"
onStatusChanged: console.log(status)
Component.onCompleted: console.log(status)
}
RowLayout { RowLayout {
//Layout.fillWidth: true //Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
@ -70,9 +62,9 @@ ColumnLayout {
} }
model: ListModel { model: ListModel {
id: cbItems id: cbItems
ListElement { imageSource: ":/lightcontrol/icons/movinghead.png" } ListElement { imageSource: "qrc:/lightcontrol/icons/movinghead.png" }
ListElement { imageSource: ":/lightcontrol/icons/nebelmaschine.png" } ListElement { imageSource: "qrc:/lightcontrol/icons/nebelmaschine.png" }
ListElement { imageSource: ":/lightcontrol/icons/rgbstrahler.png" } ListElement { imageSource: "qrc:/lightcontrol/icons/rgbstrahler.png" }
} }
} }
Label { text: qsTr("Registers:") } Label { text: qsTr("Registers:") }

View File

@ -172,26 +172,26 @@ bool DeviceTypeRegistersModel::setData(const QModelIndex &index, const QVariant
if (!index.isValid()) if (!index.isValid())
{ {
qWarning() << "hilfe" << __LINE__; qWarning() << "hilfe" << __LINE__;
return {}; return true;
} }
if (!m_controller) if (!m_controller)
{ {
qWarning() << "hilfe" << __LINE__; qWarning() << "hilfe" << __LINE__;
return {}; return true;
} }
if (m_deviceTypeId == -1) if (m_deviceTypeId == -1)
{ {
qWarning() << "hilfe" << __LINE__; qWarning() << "hilfe" << __LINE__;
return {}; return true;
} }
auto deviceTypePtr = m_controller->lightProject().deviceTypes.findById(m_deviceTypeId); auto deviceTypePtr = m_controller->lightProject().deviceTypes.findById(m_deviceTypeId);
if (!deviceTypePtr) if (!deviceTypePtr)
{ {
qWarning() << "hilfe" << __LINE__; qWarning() << "hilfe" << __LINE__;
return {}; return true;
} }
auto &deviceType = *deviceTypePtr; auto &deviceType = *deviceTypePtr;
@ -199,24 +199,25 @@ bool DeviceTypeRegistersModel::setData(const QModelIndex &index, const QVariant
if (index.row() < 0 || index.row() >= deviceType.registers.size()) if (index.row() < 0 || index.row() >= deviceType.registers.size())
{ {
qWarning() << "hilfe" << __LINE__; qWarning() << "hilfe" << __LINE__;
return {}; return true;
} }
if (index.column() != 0) if (index.column() != 0)
{ {
qWarning() << "hilfe" << __LINE__; qWarning() << "hilfe" << __LINE__;
return {}; return true;
} }
qDebug() << value.value<DeviceTypeRegisterType>();
auto &deviceTypeRegister = deviceType.registers.at(index.row()); auto &deviceTypeRegister = deviceType.registers.at(index.row());
deviceTypeRegister.type = value.value<DeviceTypeRegisterType>(); deviceTypeRegister.type = value.value<DeviceTypeRegisterType>();
emit dataChanged(index, index, { Qt::DisplayRole, Qt::EditRole }); emit dataChanged(index, index, { Qt::DisplayRole, Qt::EditRole });
return true; return true;
}
bool DeviceTypeRegistersModel::removeRows(int row, int count, const QModelIndex &parent)
{
return false;
} }
namespace { namespace {

View File

@ -26,6 +26,7 @@ public:
QHash<int, QByteArray> roleNames() const override; QHash<int, QByteArray> roleNames() const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override; bool setData(const QModelIndex &index, const QVariant &value, int role) override;
bool removeRows(int row, int count, const QModelIndex &parent) override;
signals: signals:
void controllerChanged(DmxController *controller); void controllerChanged(DmxController *controller);

View File

@ -3,6 +3,7 @@
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QQmlContext> #include <QQmlContext>
#include <QDebug> #include <QDebug>
#include <QDir>
#include "dmxcontroller.h" #include "dmxcontroller.h"
@ -23,6 +24,8 @@ int main(int argc, char *argv[])
QGuiApplication app{argc, argv}; QGuiApplication app{argc, argv};
qDebug() << QDir{":/lightcontrol"}.entryInfoList();
QCommandLineParser parser; QCommandLineParser parser;
parser.addHelpOption(); parser.addHelpOption();
parser.addVersionOption(); parser.addVersionOption();

View File

@ -1,7 +0,0 @@
<RCC>
<qresource prefix="/lightcontrol">
<file>icons/movinghead.png</file>
<file>icons/nebelmaschine.png</file>
<file>icons/rgbstrahler.png</file>
</qresource>
</RCC>