Yuhang Zhao
2023-12-19 f9aa4aacae56e3a82bce492196ff1802f3ecaf02
add a convenient API
4个文件已修改
19 ■■■■■ 已修改文件
examples/mainwindow/main.cpp 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/mainwindow/mainwindow.cpp 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/quick/quickwindowagent.h 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/widgets/widgetwindowagent.h 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/mainwindow/main.cpp
@@ -1,6 +1,4 @@
#include <QtWidgets/QApplication>
#include <QtGui/QFont>
#include <QtCore/QDebug>
#include "mainwindow.h"
examples/mainwindow/mainwindow.cpp
@@ -107,10 +107,7 @@
void MainWindow::installWindowAgent() {
    // 1. Setup window agent
    auto agent = new QWK::WidgetWindowAgent(this);
    if (!agent->setup(this)) {
        qFatal("QWK failed to initialize.");
    }
    QWK::WidgetWindowAgent *agent = QWK::QWK_Initialize(this);
    // 2. Construct your title bar
    auto menuBar = []() {
src/quick/quickwindowagent.h
@@ -38,6 +38,12 @@
        QuickWindowAgent(QuickWindowAgentPrivate &d, QObject *parent = nullptr);
    };
    inline QuickWindowAgent *QWK_Initialize(QQuickWindow *window) {
        auto agent = new QuickWindowAgent(window);
        agent->setup(window);
        return agent;
    }
}
#endif // QUICKWINDOWAGENT_H
src/widgets/widgetwindowagent.h
@@ -42,6 +42,12 @@
        WidgetWindowAgent(WidgetWindowAgentPrivate &d, QObject *parent = nullptr);
    };
    inline WidgetWindowAgent *QWK_Initialize(QWidget *w) {
        auto agent = new WidgetWindowAgent(w);
        agent->setup(w);
        return agent;
    }
}
#endif // WIDGETWINDOWAGENT_H