Add StyleSheet automatic reload function
This commit is contained in:
14
src/main.cpp
14
src/main.cpp
@@ -19,6 +19,7 @@
|
||||
#include "utilities/TouchScreenSignalSender.h"
|
||||
#include "keyboard/KeyboardManager.h"
|
||||
#include "appvals/AppGlobalValues.h"
|
||||
#include <QFileSystemWatcher>
|
||||
|
||||
QString loadFontFromFile(QString path)
|
||||
{
|
||||
@@ -75,6 +76,19 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
a.setStyleSheet(QLatin1String(file.readAll()));
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
QFileSystemWatcher fileWatcher;
|
||||
fileWatcher.addPath("../src/stylesheet/Dark2.css");
|
||||
QObject::connect(&fileWatcher, &QFileSystemWatcher::fileChanged, [](const QString &path){
|
||||
QFile file(path);
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qobject_cast<QApplication*>(QApplication::instance())->setStyleSheet(file.readAll());
|
||||
file.close();
|
||||
qDebug()<<"style updated!";
|
||||
}
|
||||
});
|
||||
#endif
|
||||
AppGlobalValues::setDBconnected(false);
|
||||
MainWindow w;
|
||||
DialogManager::Default()->init(&w);
|
||||
|
||||
Reference in New Issue
Block a user