mirror of
https://github.com/QuasarApp/SimpleQmlNotify.git
synced 2025-04-26 13:44:34 +00:00
fix show messages
This commit is contained in:
parent
7dbe411c66
commit
6359c79833
27
NotifyModule/Metrix.qml
Normal file
27
NotifyModule/Metrix.qml
Normal 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;
|
||||
}
|
@ -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
5
NotifyModule/qmldir
Normal 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
10
QML.qrc
@ -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>
|
||||
|
@ -21,3 +21,10 @@ INCLUDEPATH += "$$PWD/"
|
||||
|
||||
|
||||
|
||||
QML2_IMPORT_PATH += \
|
||||
"$$PWD/" \
|
||||
"$$PWD/"
|
||||
|
||||
QML_IMPORT_PATH += \
|
||||
"$$PWD/" \
|
||||
"$$PWD/"
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user