stdware / qwindowkit

Cross-platform frameless window framework for Qt. Support Windows, macOS, Linux.
Apache License 2.0
601 stars 95 forks source link

feature:example示例友好化 #88

Open L-Super opened 6 months ago

L-Super commented 6 months ago

想使用qwindowkit项目实现完善的无边框方案,但是看example,写的有些随意,不利于去理解,影响上手。以及会产生很多疑问,如:menu是否必需,agent->setup()ui->setup()之前还是之后,希望能更完善example以及文档,降低上手门槛。

SineStriker commented 6 months ago

怎么上手都写在 README 的 Quick Start 里了啊,example 理论上就是根本不需要用到的

L-Super commented 5 months ago

那么,按照README步骤之后:

#include "MainWindow.h"
#include "QWKWidgets/widgetwindowagent.h"
#include "ui_MainWindow.h"

MainWindow::MainWindow(QWidget *parent) : QWidget(parent), ui(new Ui::MainWindow) {
    ui->setupUi(this);

    auto agent = new QWK::WidgetWindowAgent(this);
    agent->setup(this);
    windowBar = new QWK::WindowBar();
    windowBar->setMinButton(ui->minButton);
    windowBar->setMaxButton(ui->maxButton);
    windowBar->setCloseButton(ui->closeButton);
    ui->verticalLayout->insertWidget(0,windowBar);
    agent->setTitleBar(windowBar);
#if defined(Q_OS_WIN32)
    agent->setSystemButton(QWK::WindowAgentBase::WindowIcon, windowBar->iconButton());
    agent->setSystemButton(QWK::WindowAgentBase::Minimize, windowBar->minButton());
    agent->setSystemButton(QWK::WindowAgentBase::Maximize, windowBar->maxButton());
    agent->setSystemButton(QWK::WindowAgentBase::Close, windowBar->closeButton());
    agent->setHitTestVisible(windowBar->menuBar(), true);
#endif
}

此代码就能完成了?显然没有。