added default icons

This commit is contained in:
Andrei Yankovich 2021-01-19 21:35:18 +03:00
parent 0964928742
commit f6bc28041e
8 changed files with 21 additions and 12 deletions

View File

@ -18,15 +18,20 @@ BasePopUp {
property string titleText: qsTr("Message") property string titleText: qsTr("Message")
property int type: 0 property int type: 0
function _getBackGraundColor(type) { readonly property string defImgI: "qrc:/icons/info"
readonly property string defImgW: "qrc:/icons/warning"
readonly property string defImgE: "qrc:/icons/error"
function getDefaultImage(type) {
switch(type) { switch(type) {
case 1: return "#FFC107" case 1: return defImgW
case 2: return "#FF5722" case 2: return defImgE
} }
return Material.background return defImgI
} }
autoClose: true; autoClose: true;
@ -37,7 +42,7 @@ BasePopUp {
spacing: 0 spacing: 0
backgroundColor: _getBackGraundColor(type); backgroundColor: Material.background
contentItem: contentItem:
Item { Item {
@ -105,9 +110,5 @@ BasePopUp {
} }
} }
title: titleText
header: Label {
text: titleText
horizontalAlignment: Text.AlignHCenter
}
} }

View File

@ -26,7 +26,7 @@ Item {
id: notyfyView id: notyfyView
titleText : msg.title; titleText : msg.title;
text: (msg)? msg.text: ""; text: (msg)? msg.text: "";
img: (msg)? msg.img: ""; img: (msg && msg.img.length)? msg.img: getDefaultImage((msg)? msg.type: 0);
type: (msg)? msg.type: 0; type: (msg)? msg.type: 0;
x: parent.width - width - margin; x: parent.width - width - margin;
@ -40,7 +40,7 @@ Item {
id: questionMsgBox id: questionMsgBox
titleText : qst.title; titleText : qst.title;
text: (qst)? qst.text: ""; text: (qst)? qst.text: "";
img: (qst)? qst.img: ""; img: (qst && qst.img.length)? qst.img: defImg;
type: 0; type: 0;
x: parent.width / 2 - width / 2; x: parent.width / 2 - width / 2;

View File

@ -6,6 +6,8 @@ import QtQuick.Layouts 1.15
NotificationForm { NotificationForm {
id: questionDialog id: questionDialog
readonly property string defImg: "qrc:/icons/question"
autoClose: false autoClose: false
clickClose: false clickClose: false

View File

@ -7,4 +7,10 @@
<file>NotifyModule/Metrix.qml</file> <file>NotifyModule/Metrix.qml</file>
<file>NotifyModule/YesNoQuestion.qml</file> <file>NotifyModule/YesNoQuestion.qml</file>
</qresource> </qresource>
<qresource prefix="/icons">
<file alias="warning">icons/Warning.png</file>
<file alias="question">icons/Question.png</file>
<file alias="info">icons/Info.png</file>
<file alias="error">icons/Error.png</file>
</qresource>
</RCC> </RCC>

BIN
icons/Error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
icons/Info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
icons/Question.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
icons/Warning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB