2023-02-27 18:46:39 +08:00
|
|
|
|
#include "WindowHelper.h"
|
|
|
|
|
|
|
|
|
|
WindowHelper::WindowHelper(QObject *parent)
|
|
|
|
|
: QObject{parent}
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-27 23:04:52 +08:00
|
|
|
|
void WindowHelper::setTitle(const QString& text){
|
|
|
|
|
window->setTitle(text);
|
2023-02-27 18:46:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-13 18:23:46 +08:00
|
|
|
|
QJsonObject WindowHelper::initWindow(FramelessView* window){
|
2023-02-27 23:04:52 +08:00
|
|
|
|
this->window = window;
|
2023-03-13 18:23:46 +08:00
|
|
|
|
return window->property("argument").toJsonObject();
|
2023-02-27 18:46:39 +08:00
|
|
|
|
}
|
2023-03-01 11:58:30 +08:00
|
|
|
|
|
2023-03-02 18:21:43 +08:00
|
|
|
|
void WindowHelper::setMinimumWidth(int width){
|
|
|
|
|
this->window->setMinimumWidth(width);
|
2023-03-01 11:58:30 +08:00
|
|
|
|
}
|
2023-03-02 18:21:43 +08:00
|
|
|
|
void WindowHelper::setMaximumWidth(int width){
|
|
|
|
|
this->window->setMaximumWidth(width);
|
2023-03-01 11:58:30 +08:00
|
|
|
|
}
|
2023-03-02 18:21:43 +08:00
|
|
|
|
void WindowHelper::setMinimumHeight(int height){
|
|
|
|
|
this->window->setMinimumHeight(height);
|
|
|
|
|
}
|
|
|
|
|
void WindowHelper::setMaximumHeight(int height){
|
|
|
|
|
this->window->setMaximumHeight(height);
|
2023-03-01 22:06:48 +08:00
|
|
|
|
}
|
2023-03-13 18:23:46 +08:00
|
|
|
|
void WindowHelper::updateWindow(){
|
|
|
|
|
this->window->setFlag(Qt::Window,false);
|
|
|
|
|
this->window->setFlag(Qt::Window,true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WindowHelper::setModality(int type){
|
|
|
|
|
if(type == 0){
|
|
|
|
|
this->window->setModality(Qt::NonModal);
|
|
|
|
|
}else if(type == 1){
|
|
|
|
|
this->window->setModality(Qt::WindowModal);
|
|
|
|
|
}else if(type == 2){
|
|
|
|
|
this->window->setModality(Qt::ApplicationModal);
|
|
|
|
|
}else{
|
|
|
|
|
this->window->setModality(Qt::NonModal);
|
|
|
|
|
}
|
|
|
|
|
}
|