fix show messages

This commit is contained in:
Andrei Yankovich 2019-11-19 18:09:01 +03:00
parent 7dbe411c66
commit 6359c79833
8 changed files with 53 additions and 4 deletions

27
NotifyModule/Metrix.qml Normal file
View File

@ -0,0 +1,27 @@
import QtQuick 2.0
import QtQuick.Window 2.12
import QtQuick.Controls.Material 2.0
import QtQuick.Controls 2.3
Item {
readonly property int pointCount: 100;
readonly property real mm: Screen.pixelDensity
readonly property real sm: 10 * mm
readonly property real dsm: Math.sqrt(Math.pow(Screen.desktopAvailableWidth, 2) + Math.pow(Screen.desktopAvailableHeight, 2)) / sm
readonly property real pt: getfactor(dsm) * sm
readonly property real controlPtMaterial: Material.buttonHeight
readonly property real gamePt: (width < height) ? width / pointCount : height / pointCount;
function getfactor(dsm) {
if (dsm < 30) {
return 0.5
} else if ( dsm < 70) {
return 1
} else if (dsm < 140) {
return 2;
} else
return 4;
}
anchors.fill: parent;
}

View File

@ -9,6 +9,9 @@ Item {
readonly property var msg: model.notify
readonly property var history: model.history
Metrix {
id: metrix
}
NotificationForm {
id: notyfyView

5
NotifyModule/qmldir Normal file
View File

@ -0,0 +1,5 @@
module NotifyModule
BasePopUp 1.0 BasePopUp.qml
NotificationForm 1.0 NotificationForm.qml
NotificationServiceView 1.0 NotificationServiceView.qml
Metrix 1.0 Metrix.qml

10
QML.qrc
View File

@ -1,7 +1,9 @@
<RCC>
<qresource prefix="/QmlNotyfy">
<file>NotificationServiceView.qml</file>
<file>NotificationForm.qml</file>
<file>BasePopUp.qml</file>
<qresource prefix="/">
<file>NotifyModule/qmldir</file>
<file>NotifyModule/NotificationServiceView.qml</file>
<file>NotifyModule/NotificationForm.qml</file>
<file>NotifyModule/BasePopUp.qml</file>
<file>NotifyModule/Metrix.qml</file>
</qresource>
</RCC>

View File

@ -21,3 +21,10 @@ INCLUDEPATH += "$$PWD/"
QML2_IMPORT_PATH += \
"$$PWD/" \
"$$PWD/"
QML_IMPORT_PATH += \
"$$PWD/" \
"$$PWD/"

View File

@ -7,10 +7,15 @@
namespace QmlNotificationService {
bool init(QQmlApplicationEngine *engine) {
if (!engine)
return false;
auto root = engine->rootContext();
if (!root)
return false;
engine->addImportPath(":/");
root->setContextProperty("notificationService", NotificationService::getService());
return true;
}