Icon selector for device types
This commit is contained in:
@@ -30,6 +30,7 @@ qt_add_qml_module(applightcontrol
|
|||||||
main.qml
|
main.qml
|
||||||
HomePage.qml
|
HomePage.qml
|
||||||
SettingsPage.qml
|
SettingsPage.qml
|
||||||
|
IconChooserDelegateLayout.qml
|
||||||
LightControlWindow.qml
|
LightControlWindow.qml
|
||||||
LightSliderPane.qml
|
LightSliderPane.qml
|
||||||
EditableListView.qml
|
EditableListView.qml
|
||||||
|
@@ -2,10 +2,17 @@ import QtQuick
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Controls.Material
|
import QtQuick.Controls.Material
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import Qt.labs.folderlistmodel 2.4
|
||||||
|
|
||||||
import com.büro 1.0
|
import com.büro 1.0
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
FolderListModel {
|
||||||
|
id: iconsModel
|
||||||
|
folder: "qrc:/lightcontrol/icons/"
|
||||||
|
showDirs: false
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("Device Types Settings")
|
text: qsTr("Device Types Settings")
|
||||||
}
|
}
|
||||||
@@ -81,22 +88,27 @@ ColumnLayout {
|
|||||||
Label { text: qsTr("Icon:") }
|
Label { text: qsTr("Icon:") }
|
||||||
ComboBox {
|
ComboBox {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 64
|
||||||
id: iconCombobox
|
id: iconCombobox
|
||||||
//textRole: "imageSource"
|
textRole: "fileName"
|
||||||
//valueRole: "imageSource"
|
valueRole: "fileUrl"
|
||||||
//currentIndex: iconCombobox.indexOfValue(listView.currentData.deviceTypeId)
|
delegate: ItemDelegate {
|
||||||
//onActivated: if (listView.currentData) listView.currentData.deviceTypeId = currentValue; else console.warn('discarded');
|
height: 64
|
||||||
delegate: Image {
|
anchors.left: parent.left
|
||||||
height: 64
|
anchors.right: parent.right
|
||||||
fillMode: Image.PreserveAspectFit
|
contentItem: IconChooserDelegateLayout {
|
||||||
source: imageSource
|
anchors.top: parent.top
|
||||||
}
|
anchors.bottom: parent.bottom
|
||||||
model: ListModel {
|
text: fileName
|
||||||
id: cbItems
|
iconSource: fileUrl
|
||||||
ListElement { imageSource: "qrc:/lightcontrol/icons/movinghead.png" }
|
}
|
||||||
ListElement { imageSource: "qrc:/lightcontrol/icons/nebelmaschine.png" }
|
}
|
||||||
ListElement { imageSource: "qrc:/lightcontrol/icons/rgbstrahler.png" }
|
contentItem: IconChooserDelegateLayout {
|
||||||
}
|
text: iconCombobox.currentText
|
||||||
|
iconSource: iconCombobox.currentValue
|
||||||
|
}
|
||||||
|
|
||||||
|
model: iconsModel
|
||||||
}
|
}
|
||||||
Label { text: qsTr("Registers:") }
|
Label { text: qsTr("Registers:") }
|
||||||
RegistersSettingsItem {
|
RegistersSettingsItem {
|
||||||
|
24
IconChooserDelegateLayout.qml
Normal file
24
IconChooserDelegateLayout.qml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls.Material
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
property string text
|
||||||
|
property string iconSource
|
||||||
|
|
||||||
|
id: layout
|
||||||
|
|
||||||
|
Image {
|
||||||
|
Layout.topMargin: 15
|
||||||
|
Layout.bottomMargin: 15
|
||||||
|
Layout.fillHeight: true
|
||||||
|
source: layout.iconSource
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: layout.text
|
||||||
|
}
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
}
|
@@ -4,7 +4,10 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
|
||||||
constexpr auto IdRole = Qt::UserRole;
|
enum {
|
||||||
|
IdRole = Qt::UserRole,
|
||||||
|
IconRole
|
||||||
|
};
|
||||||
|
|
||||||
void DeviceTypesModel::setController(DmxController *controller)
|
void DeviceTypesModel::setController(DmxController *controller)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user