Quick GUI: Tweak styling for Android
This commit is contained in:
parent
10ab060568
commit
c0c2ee997f
|
@ -149,6 +149,11 @@ endif()
|
|||
find_package(passwordfile 3.1.0 REQUIRED)
|
||||
use_password_file()
|
||||
|
||||
# require Qt AndroidExtras
|
||||
if(ANDROID AND QUICK_GUI)
|
||||
list(APPEND ADDITIONAL_QT_MODULES AndroidExtras)
|
||||
endif()
|
||||
|
||||
# include modules to apply configuration
|
||||
if(WIDGETS_GUI OR QUICK_GUI)
|
||||
include(QtGuiConfig)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
#include <QIcon>
|
||||
|
@ -18,10 +19,27 @@
|
|||
#include <QApplication>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <QtAndroid>
|
||||
#endif
|
||||
|
||||
using namespace ApplicationUtilities;
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
namespace Android {
|
||||
namespace WindowManager {
|
||||
namespace LayoutParams {
|
||||
enum RelevantFlags {
|
||||
TranslucentStatus = 0x04000000,
|
||||
DrawsSystemBarBackgrounds = 0x80000000,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int runQuickGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs, const QString &file)
|
||||
{
|
||||
// init application
|
||||
|
@ -63,11 +81,21 @@ int runQuickGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs, c
|
|||
// init Quick GUI
|
||||
QQmlApplicationEngine engine;
|
||||
Controller controller(settings, file);
|
||||
QQmlContext *const context(engine.rootContext());
|
||||
auto *const context(engine.rootContext());
|
||||
context->setContextProperty(QStringLiteral("userPaths"), userPaths);
|
||||
context->setContextProperty(QStringLiteral("nativeInterface"), &controller);
|
||||
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
QtAndroid::runOnAndroidThread([=]() {
|
||||
QAndroidJniObject window = QtAndroid::androidActivity().callObjectMethod("getWindow", "()Landroid/view/Window;");
|
||||
window.callMethod<void>("addFlags", "(I)V", Android::WindowManager::LayoutParams::DrawsSystemBarBackgrounds);
|
||||
window.callMethod<void>("clearFlags", "(I)V", Android::WindowManager::LayoutParams::TranslucentStatus);
|
||||
window.callMethod<void>("setStatusBarColor", "(I)V", QColor("#2196f3").rgba());
|
||||
window.callMethod<void>("setNavigationBarColor", "(I)V", QColor("#2196f3").rgba());
|
||||
});
|
||||
#endif
|
||||
|
||||
// run event loop
|
||||
return a.exec();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>qtquickcontrols2.conf</file>
|
||||
</qresource>
|
||||
<qresource prefix="/qml">
|
||||
<file alias="main.qml">../qml/main.qml</file>
|
||||
<file alias="BasicDialog.qml">../qml/BasicDialog.qml</file>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
[Material]
|
||||
Primary=#2196F3
|
||||
Accent=#2196F3
|
||||
Theme=System
|
||||
|
||||
[Universal]
|
||||
Accent=#2196F3
|
||||
Theme=System
|
Loading…
Reference in New Issue