diff --git a/qml/Components/CompatibleToolButton.qml b/qml/Components/CompatibleToolButton.qml
new file mode 100644
index 0000000..9fdbcca
--- /dev/null
+++ b/qml/Components/CompatibleToolButton.qml
@@ -0,0 +1,92 @@
+import QtQuick 2.0
+import QtQuick.Controls 2.1
+import QtQuick.Controls.Material 2.1
+
+ Loader {
+ id: control
+
+ property QIconSource icon: QIconSource {}
+
+ property int fontPixelSize
+
+ property string text: ""
+
+ signal clicked
+
+ Connections {
+ target: icon
+ onNameChanged: {
+ control.syncProperties()
+ }
+ }
+
+ onTextChanged: {
+ control.syncProperties()
+ }
+
+ function syncProperties() {
+ if(QtCompatiblityMode) {
+ control.sourceComponent = ancientToolButtonCp
+ control.item.text = control.text
+ control.item.font = control.font
+
+ if(control.fontPixelSize !== undefined) {
+ control.item.font.pixelSize = control.fontPixelSize
+ }
+ }
+ else {
+ control.sourceComponent = modernToolButtonCp
+
+ control.item.icon.name = control.icon.name
+ control.item.icon.color = control.icon.color
+
+ control.item.icon.width = control.icon.width
+ control.item.icon.height = control.icon.height
+ }
+ }
+
+ onItemChanged: {
+ control.syncProperties()
+ }
+
+ Component.onCompleted: {
+ control.syncProperties()
+ }
+
+ Connections {
+ target: control.item
+
+ onClicked: {
+ control.clicked()
+ }
+ }
+
+ Component {
+ id: ancientToolButtonCp
+
+ ToolButton {
+ id: tb
+
+ opacity: enabled ? 1.0 : 0.3
+
+ contentItem: Text {
+ text: tb.text
+ font: tb.font
+ color: app.style.style.textColor
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ }
+ }
+ }
+
+ Component {
+ id: modernToolButtonCp
+
+ ToolButton {
+ height: implicitHeight
+ width: implicitWidth
+ }
+ }
+
+ }
diff --git a/qml/Components/PullRefresher.qml b/qml/Components/PullRefresher.qml
index e24560a..2375287 100644
--- a/qml/Components/PullRefresher.qml
+++ b/qml/Components/PullRefresher.qml
@@ -17,7 +17,7 @@
*/
import QtQuick 2.9
-import QtQuick.Controls 2.4
+import QtQuick.Controls 2.1
import QtGraphicalEffects 1.0
Item {
diff --git a/qml/Components/QIconSource.qml b/qml/Components/QIconSource.qml
new file mode 100644
index 0000000..46b81c2
--- /dev/null
+++ b/qml/Components/QIconSource.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property string name: ""
+ property int height
+ property int width
+ property color color: "black"
+}
diff --git a/qml/Forms/FilterForm.qml b/qml/Forms/FilterForm.qml
index 7d99c2e..cf3f1e2 100644
--- a/qml/Forms/FilterForm.qml
+++ b/qml/Forms/FilterForm.qml
@@ -281,7 +281,7 @@ Page {
}
}
- ToolButton {
+ CompatibleToolButton {
id: deleteButton
anchors {
@@ -294,6 +294,8 @@ Page {
icon.name: "delete"
+ text: "X"
+
onClicked: {
deleteAnimation.start()
}
diff --git a/qml/Pages/LoginPage.qml b/qml/Pages/LoginPage.qml
index 29b5e97..2a59e82 100644
--- a/qml/Pages/LoginPage.qml
+++ b/qml/Pages/LoginPage.qml
@@ -140,7 +140,7 @@ Page {
rightMargin: root.width * 0.05
}
- ToolButton{
+ CompatibleToolButton{
id: passwordHideShow
anchors {
top: parent.top
@@ -148,8 +148,6 @@ Page {
right: parent.right
}
- icon.height: parent.height * 0.5
- icon.width: parent.height * 0.5
icon.color: app.style.style.textColor
onClicked: {
@@ -169,6 +167,7 @@ Page {
PropertyChanges {
target: passwordHideShow
icon.name: "hide"
+ text: "show"
}
PropertyChanges {
@@ -181,6 +180,7 @@ Page {
PropertyChanges {
target: passwordHideShow
icon.name: "view"
+ text: "hide"
}
PropertyChanges {
target: tipasswd
diff --git a/qml/Pages/MainPage.qml b/qml/Pages/MainPage.qml
index 1d6530e..806621a 100644
--- a/qml/Pages/MainPage.qml
+++ b/qml/Pages/MainPage.qml
@@ -146,8 +146,8 @@ Page {
spacing: width * 0.02
- ToolButton {
- id: toolButton
+ CompatibleToolButton {
+ id: backTb
enabled: !formStack.currentItem.locked
@@ -156,6 +156,9 @@ Page {
icon.name: "back"
icon.color: app.style.style.textColor
+ text: "\u2039"
+ fontPixelSize: height * 0.7
+
onClicked: {
if(!formStack.currentItem.locked){
formStack.pop()
@@ -186,8 +189,8 @@ Page {
}
}
- ToolButton {
- id: pdfToolButton
+ CompatibleToolButton {
+ id: pdfTb
enabled: !formStack.currentItem.locked
@@ -198,6 +201,8 @@ Page {
icon.name: "pdf"
icon.color: app.style.style.textColor
+ text: "pdf ansehen"
+
onClicked: {
if(formStack.currentItem.pdfAction !== undefined) {
formStack.currentItem.pdfAction()
diff --git a/qml/main.qml b/qml/main.qml
index 2776072..6eca7d4 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -91,16 +91,16 @@ ApplicationWindow {
mainStack.replace(currPage)
}
- //initialItem: mainPage
-
Component {
id: loginPage
- LoginPage {}
+ LoginPage {
+ }
}
Component {
id: mainPage
- MainPage {}
+ MainPage {
+ }
}
}
diff --git a/qml/qml.qrc b/qml/qml.qrc
index 90268f7..972427e 100644
--- a/qml/qml.qrc
+++ b/qml/qml.qrc
@@ -18,5 +18,7 @@
Components/FannyDataListView.qml
Components/ProgressCircle.qml
Components/PullRefresher.qml
+ Components/CompatibleToolButton.qml
+ Components/QIconSource.qml
diff --git a/sources/main.cpp b/sources/main.cpp
index 652c026..651e3c2 100644
--- a/sources/main.cpp
+++ b/sources/main.cpp
@@ -58,15 +58,25 @@ int main(int argc, char *argv[])
qmlRegisterType("Backend", 1, 0, "AppStyle");
QQuickStyle::setStyle("Material");
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) )
QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << ":/shared/icons");
QIcon::setThemeName("ibmaterial");
+#endif
QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
- QQmlContext *context = engine.rootContext();
- // context->setContextProperty("_cppServerConn", pServerConn);
+ QQmlContext *context = engine.rootContext();
context->setContextProperty("_cppAppSettings", pAppSettings);
+ context->setContextProperty("QtCompatiblityMode",
+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) )
+ false
+ #else
+ true
+ #endif
+ );
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
if (engine.rootObjects().isEmpty())
return -1;