mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-03 08:35:28 +08:00
update
This commit is contained in:
@ -25,8 +25,9 @@ FluApp::FluApp(QObject *parent)
|
||||
isDark(false);
|
||||
}
|
||||
|
||||
void FluApp::setAppWindow(QWindow *window){
|
||||
appWindow = window;
|
||||
void FluApp::init(QWindow *window,QMap<QString, QVariant> properties){
|
||||
this->appWindow = window;
|
||||
this->properties = properties;
|
||||
}
|
||||
|
||||
void FluApp::run(){
|
||||
@ -40,6 +41,14 @@ void FluApp::navigate(const QString& route){
|
||||
}
|
||||
bool isAppWindow = route == initialRoute();
|
||||
FramelessView *view = new FramelessView();
|
||||
|
||||
QMapIterator<QString, QVariant> iterator(properties);
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next();
|
||||
QString key = iterator.key();
|
||||
QVariant value = iterator.value();
|
||||
view->engine()->rootContext()->setContextProperty(key,value);
|
||||
}
|
||||
view->setColor(QColor(Qt::transparent));
|
||||
QObject::connect(view, &QQuickView::statusChanged, view, [&](QQuickView::Status status) {
|
||||
if (status == QQuickView::Status::Ready) {
|
||||
|
14
src/FluApp.h
14
src/FluApp.h
@ -27,7 +27,7 @@ public:
|
||||
|
||||
Q_INVOKABLE void navigate(const QString& route);
|
||||
|
||||
Q_INVOKABLE void setAppWindow(QWindow *window);
|
||||
Q_INVOKABLE void init(QWindow *window,QMap<QString, QVariant> properties);
|
||||
|
||||
Q_SIGNAL void windowReady(FramelessView *view);
|
||||
|
||||
@ -37,20 +37,10 @@ public:
|
||||
|
||||
Q_INVOKABLE void clipText(const QString& text);
|
||||
|
||||
Q_INVOKABLE void setContextProperty(const QString &name, QObject *data){
|
||||
if(engine){
|
||||
engine->rootContext()->setContextProperty(name,data);
|
||||
}
|
||||
}
|
||||
|
||||
void setEngine(QQmlEngine *engine){
|
||||
this->engine = engine;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static FluApp* m_instance;
|
||||
QQmlEngine *engine;
|
||||
QMap<QString, QVariant> properties;
|
||||
QWindow *appWindow;
|
||||
|
||||
};
|
||||
|
@ -72,6 +72,5 @@ void Fluent::initializeEngine(QQmlEngine *engine, const char *uri)
|
||||
QGuiApplication::setFont(font);
|
||||
QFontDatabase::addApplicationFont(":/com.zhuzichu/res/font/fontawesome-webfont.ttf");
|
||||
FluApp* app = FluApp::getInstance();
|
||||
app->setEngine(engine);
|
||||
engine->rootContext()->setContextProperty("FluApp",app);
|
||||
}
|
||||
|
@ -8,13 +8,10 @@ class Fluent: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static Fluent *getInstance();
|
||||
|
||||
Q_INVOKABLE QString version() const;
|
||||
|
||||
void registerTypes(const char *uri);
|
||||
|
||||
void initializeEngine(QQmlEngine *engine, const char *uri);
|
||||
static Fluent *getInstance();
|
||||
private:
|
||||
static Fluent* m_instance;
|
||||
};
|
||||
|
@ -13,6 +13,7 @@ Rectangle {
|
||||
property color primaryColor : "#0064B0"
|
||||
signal clicked
|
||||
radius: 4
|
||||
|
||||
color:{
|
||||
if(FluApp.isDark){
|
||||
if(disabled){
|
||||
|
@ -20,11 +20,6 @@ MouseArea {
|
||||
propagateComposedEvents: true
|
||||
z: -65535
|
||||
|
||||
onReleased: {
|
||||
Window.window.width = Window.window.width+1
|
||||
Window.window.width = Window.window.width-1
|
||||
}
|
||||
|
||||
onPressed :
|
||||
(mouse)=> {
|
||||
if (fixedSize) {
|
||||
|
Reference in New Issue
Block a user