| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- import QtQuick
- import QtQuick.Controls
- import QtQuick.Layouts
- Window {
- id: materialdialogmisplace
- minimumWidth: 800
- maximumWidth: 800
- minimumHeight: 600
- maximumHeight: 600
- flags: Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint
- modality: Qt.ApplicationModal
- title: ""
- color: "white"
- visible: true
- ListModel {
- id: materialdialogmisplace_materialtakelistModel
- // ListElement { rfid: "0000000000" }
- // ListElement { rfid: "11111111" }
- // ListElement { rfid: "11111111" }
- // ListElement { rfid: "11111111" }
- }
- ListModel {
- id: materialdialogmisplace_materialbacklistModel
- ListElement { rfid: "0000000000" }
- ListElement { rfid: "222222222" }
- ListElement { rfid: "3333333" }
- ListElement { rfid: "44444444" }
- }
- Rectangle {
- x: 0
- y: 0
- width: parent.width
- height: 50 // 设置标题栏高度
- color: "#ff3968e9" // 设置标题栏背景色
- Text {
- x: 20
- y: 0
- width: 80
- height: 50 // 设置标题栏高度
- text: "物资错放提醒"
- font.pixelSize: 25
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "white"
- }
- }
- Rectangle {
- x: 0
- y: 75
- width: parent.width
- height: 400
- color: "white"
- Rectangle {
- x: 0
- y: 0
- width: parent.width
- height: (parent.height) / 2
- color: "#002b7ae9"
- Text {
- x: 50
- y: 0
- width: 260
- height: 50
- visible: true
- text: "不是本柜子的物资"
- font.pixelSize: 25
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.bold: true
- color: "#000000"
- }
- GridView {
- x: 25
- y: 50
- width: parent.width - 50
- height: parent.height - 50
- cellWidth: 250 // 每个单元格的宽度,这里是平均分配宽度给5列
- cellHeight: 350 // 每个单元格的高度
- model: materialdialogmisplace_materialtakelistModel
- delegate: Rectangle{
- width: 250
- height: 50
- color: "#00ffffff"
- Rectangle {
- x: 0
- y: 0
- width: 250
- height: 50
- color: "#00ffffff"
- Text {
- x: 0
- y: 0
- width: parent.width
- height: 50
- visible: true
- text: model.rfid
- font.pixelSize: 12
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#000000"
- }
- }
- }
- }
- }
- Rectangle {
- x: 0
- y: (parent.height) / 2
- width: parent.width
- height: (parent.height) / 2
- color: "#002b7ae9"
- Text {
- x: 50
- y: 0
- width: 260
- height: 50
- visible: true
- text: "不是本柜子的物资"
- font.pixelSize: 25
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.bold: true
- color: "#000000"
- }
- GridView {
- x: 25
- y: 50
- width: parent.width - 50
- height: parent.height - 50
- cellWidth: 250 // 每个单元格的宽度,这里是平均分配宽度给5列
- cellHeight: 350 // 每个单元格的高度
- model: materialdialogmisplace_materialbacklistModel
- delegate: Rectangle{
- width: 250
- height: 50
- color: "#00ffffff"
- Rectangle {
- x: 0
- y: 0
- width: 250
- height: 50
- color: "#00ffffff"
- Text {
- x: 0
- y: 0
- width: parent.width
- height: 50
- visible: true
- text: model.rfid
- font.pixelSize: 12
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#000000"
- }
- }
- }
- }
- }
- Canvas {
- anchors.fill: parent
- onPaint: {
- var ctx = getContext("2d");
- ctx.lineWidth = 5; // 设置线的宽度
- ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
- ctx.beginPath();
- ctx.moveTo(5, (parent.height) / 2 ); // 直线的起点
- ctx.lineTo(parent.width - 5, (parent.height) / 2); // 直线的终点
- ctx.stroke(); // 绘制直线
- }
- }
- }
- DialogButtonBox {
- id: materialdialogmisplace_buttonBox
- x: 0
- y: 500
- width: parent.width
- height: 100
- // 自定义按钮
- Button {
- implicitWidth: 120
- implicitHeight: 50
- text: "关闭"
- background: Rectangle {
- color: "green"
- radius: 5
- }
- contentItem: Text {
- text: parent.text
- font.pixelSize: 30
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- onClicked: {
- materialdialogmisplace.hide();
- }
- }
- }
- function slot_misplaceRefresh()
- {
- materialdialogmisplace_materialtakelistModel.clear();
- materialdialogmisplace_materialbacklistModel.clear()
- var takelist = pConfig.stakeElseMaterialList;
- var backlist = pConfig.sbackElseMaterialList;
- var materialname = pConfig.smaterialNameList;
- var materialpicture = pConfig.smaterialPictureList;
- for (var i = 0; i < takelist.length; i++) {
- materialdialogmisplace_materialtakelistModel.append({png:materialpicture[takelist[i]], name: materialname[takelist[i]], rfid: takelist[i]});
- }
- for (var j = 0; j < backlist.length; j++) {
- materialdialogmisplace_materialbacklistModel.append({png:materialpicture[backlist[j]], name: materialname[backlist[j]], rfid: backlist[j]});
- }
- }
- }
|