Browse Source

Add probe selection dropDown menue

emulator-with-probes
pouya 10 months ago
parent
commit
06cf192488
  1. 3
      logic/include/viewModel/MainViewModel.h
  2. 71
      ui/emulator/items/TopLeftTop.qml

3
logic/include/viewModel/MainViewModel.h

@ -4,6 +4,7 @@
#include <QtMvvmCore/ViewModel>
#include "utils/Property.h"
#include "model/Console.h"
#include <QList>
#define LED_OFF 0x00
#define LED_COLOR_WHITE 0x01
@ -140,7 +141,7 @@ class MainViewModel : public QtMvvm::ViewModel
//BUTTON_LED_PROPERTY(probe3, Probe3, false, LED_OFF)
//BUTTON_LED_PROPERTY(probe4, Probe4, false, LED_OFF)
MVVM_PROPERTY(QList<QString>, probeList, QList<QString>())
MVVM_PROPERTY(QList<QVariant>, probeList, QList<QVariant>({"Pouya", "Mamad"}))
MVVM_PROPERTY(int, currentSelectedProbe1, 0)
MVVM_PROPERTY(int, currentSelectedProbe2, 0)

71
ui/emulator/items/TopLeftTop.qml

@ -1,28 +1,87 @@
import QtQuick 2.0
import QtQuick.Layouts 1.13
import QtQuick.Controls 2.12
import de.skycoder42.QtMvvm.Core 1.0
import de.skycoder42.QtMvvm.Quick 1.0
import com.example.consoleemulator 1.0
import "qrc:/emulator/elements"
import "qrc:/emulator/components"
import "qrc:/const"
import "qrc:/qtmvvm/views"
RowLayout {
GridLayout {
x: 70
y: 50
spacing: 36
rowSpacing: 36
columns: 4
ProbeButton {
name: "probe"
name: "probe1"
image: "qrc:/icons/topLeft/probe.png"
}
ProbeButton {
name: "probe"
name: "probe2"
image: "qrc:/icons/topLeft/probe.png"
}
ProbeButton {
name: "probe"
name: "probe3"
image: "qrc:/icons/topLeft/probe.png"
}
ProbeButton {
name: "probe"
name: "probe4"
image: "qrc:/icons/topLeft/probe.png"
}
property var widthOfBtns: 130
property var probeList: []
MvvmBinding {
viewModel: mainView.viewModel
viewProperty: "probeList"
viewModelProperty: "probeList"
}
ComboBox {
model: probeList
width: widthOfBtns
implicitWidth: width
implicitHeight: 25
MvvmBinding {
viewModel: mainView.viewModel
viewProperty: "currentIndex"
viewModelProperty: "currentSelectedProbe1"
}
}
ComboBox {
model: probeList
width: widthOfBtns
implicitWidth: width
implicitHeight: 25
MvvmBinding {
viewModel: mainView.viewModel
viewProperty: "currentIndex"
viewModelProperty: "currentSelectedProbe2"
}
}
ComboBox {
model: probeList
width: widthOfBtns
implicitWidth: width
implicitHeight: 25
MvvmBinding {
viewModel: mainView.viewModel
viewProperty: "currentIndex"
viewModelProperty: "currentSelectedProbe3"
}
}
ComboBox {
model: probeList
width: widthOfBtns
implicitWidth: width
implicitHeight: 25
MvvmBinding {
viewModel: mainView.viewModel
viewProperty: "currentIndex"
viewModelProperty: "currentSelectedProbe4"
}
}
}

Loading…
Cancel
Save