QtMvvm  1.1.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
AlertDialog.qml
1 import QtQuick 2.10
2 import QtQuick.Controls 2.3
3 import QtQuick.Window 2.2
4 
12 Dialog {
13  id: _alertDialog
14 
28  property real extraHeight: 0
43  property real baseWidth: 300
44 
45  x: parent ? (parent.width - width) / 2 : 0
46  y: parent ? deltaY() : 0
47  width: parent ? Math.min(Math.max(implicitWidth, baseWidth), parent.width - 24) : implicitWidth
48  height: parent ? Math.min(implicitHeight, parent.height - 24) : implicitWidth
49  modal: true
50  focus: true
51 
62  function deltaY() {
63  var unscaled = Qt.inputMethod.keyboardRectangle.height / Screen.devicePixelRatio;
64  var availHeight = (parent.height + extraHeight) - unscaled - 24; //margins
65  var rawDelta = (Math.max(0, availHeight - height) / 2);
66  return rawDelta + 12 - extraHeight; //spacing
67  }
68 }