update
parent
875d8896d8
commit
744102e034
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,7 @@
|
||||||
|
TempMode
|
||||||
|
|
||||||
|
Silent=1
|
||||||
|
|
||||||
|
Overwrite=1
|
||||||
|
|
||||||
|
Setup=./example.exe
|
|
@ -0,0 +1,3 @@
|
||||||
|
@echo off
|
||||||
|
WinRAR.exe a FluentUI.exe ../*
|
||||||
|
rar.exe c -znote.txt FluentUI.exe
|
|
@ -5,10 +5,10 @@ import FluentUI 1.0
|
||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
// width: 800
|
width: 800
|
||||||
// height: 400
|
height: 400
|
||||||
// maximumSize: Qt.size(800,400)
|
maximumSize: Qt.size(800,400)
|
||||||
// minimumSize: Qt.size(800,400)
|
minimumSize: Qt.size(800,400)
|
||||||
title:"安装向导"
|
title:"安装向导"
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
|
|
|
@ -8,7 +8,15 @@
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
qputenv("QSG_RENDER_LOOP","basic");
|
qputenv("QSG_RENDER_LOOP","basic");
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
||||||
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
|
#endif
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round);
|
||||||
|
#endif
|
||||||
|
// QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
#if defined(STATICLIB)
|
#if defined(STATICLIB)
|
||||||
|
|
|
@ -42,15 +42,8 @@ void FluApp::navigate(const QString& route){
|
||||||
}
|
}
|
||||||
bool isAppWindow = route==initialRoute();
|
bool isAppWindow = route==initialRoute();
|
||||||
FramelessView *view = new FramelessView();
|
FramelessView *view = new FramelessView();
|
||||||
view->setProperty("winId","1234243");
|
|
||||||
qDebug()<<"-----FramelessView--------->";
|
|
||||||
// view->setWidth(800);
|
|
||||||
// view->setHeight(500);
|
|
||||||
// view->setMaximumSize(QSize(800,500));
|
|
||||||
// view->setMinimumSize(QSize(800,500));
|
|
||||||
view->setColor(isDark() ? QColor(0,0,0,1) : QColor(255, 255, 255, 1));
|
view->setColor(isDark() ? QColor(0,0,0,1) : QColor(255, 255, 255, 1));
|
||||||
QObject::connect(view, &QQuickView::statusChanged, view, [&](QQuickView::Status status) {
|
QObject::connect(view, &QQuickView::statusChanged, view, [&](QQuickView::Status status) {
|
||||||
qDebug()<<"-------------->";
|
|
||||||
if (status == QQuickView::Status::Ready) {
|
if (status == QQuickView::Status::Ready) {
|
||||||
Q_EMIT windowReady(view);
|
Q_EMIT windowReady(view);
|
||||||
|
|
||||||
|
@ -58,7 +51,6 @@ void FluApp::navigate(const QString& route){
|
||||||
view->show();
|
view->show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
qDebug()<<"-----view->setSource((routes().value(route).toString()))--------->";
|
|
||||||
view->setSource((routes().value(route).toString()));
|
view->setSource((routes().value(route).toString()));
|
||||||
if(isAppWindow){
|
if(isAppWindow){
|
||||||
QObject::connect(view->engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit);
|
QObject::connect(view->engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit);
|
||||||
|
@ -69,10 +61,5 @@ void FluApp::navigate(const QString& route){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FluApp::equalsWindow(FramelessView *view,QWindow *window){
|
bool FluApp::equalsWindow(FramelessView *view,QWindow *window){
|
||||||
qDebug()<<"-----equalsWindow--------->";
|
|
||||||
view->setWidth(800);
|
|
||||||
view->setHeight(500);
|
|
||||||
view->setMaximumSize(QSize(800,500));
|
|
||||||
view->setMinimumSize(QSize(800,500));
|
|
||||||
return view->winId() == window->winId();
|
return view->winId() == window->winId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
Q_INVOKABLE bool equalsWindow(FramelessView *view,QWindow *window);
|
Q_INVOKABLE bool equalsWindow(FramelessView *view,QWindow *window);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static FluApp* m_instance;
|
static FluApp* m_instance;
|
||||||
QWindow *appWindow;
|
QWindow *appWindow;
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ public:
|
||||||
{
|
{
|
||||||
borderless = enabled;
|
borderless = enabled;
|
||||||
//todo 有待研究这个
|
//todo 有待研究这个
|
||||||
// ::SetWindowLongPtrW(handle, GWL_STYLE, static_cast<LONG>(newStyle));
|
::SetWindowLongPtrW(handle, GWL_STYLE, static_cast<LONG>(newStyle));
|
||||||
|
|
||||||
// when switching between borderless and windowed, restore appropriate shadow state
|
// when switching between borderless and windowed, restore appropriate shadow state
|
||||||
setShadow(handle, borderless_shadow && (newStyle != Style::windowed));
|
setShadow(handle, borderless_shadow && (newStyle != Style::windowed));
|
||||||
|
@ -348,20 +348,19 @@ bool FramelessView::nativeEvent(const QByteArray& eventType, void* message, long
|
||||||
{
|
{
|
||||||
RECT winrect;
|
RECT winrect;
|
||||||
GetWindowRect(HWND(winId()), &winrect);
|
GetWindowRect(HWND(winId()), &winrect);
|
||||||
|
|
||||||
long x = GET_X_LPARAM(msg->lParam);
|
long x = GET_X_LPARAM(msg->lParam);
|
||||||
long y = GET_Y_LPARAM(msg->lParam);
|
long y = GET_Y_LPARAM(msg->lParam);
|
||||||
|
|
||||||
*result = 0;
|
*result = 0;
|
||||||
if (!isMaxWin(this) && !isFullWin(this))
|
if (!isMaxWin(this) && !isFullWin(this))
|
||||||
{ //非最大化、非全屏时,进行命中测试,处理边框拖拽
|
{ //非最大化、非全屏时,进行命中测试,处理边框拖拽
|
||||||
*result = hitTest(winrect, x, y, border_width);
|
if(!((maximumHeight()==minimumHeight())&&(maximumWidth()==minimumWidth()))){
|
||||||
if (0 != *result)
|
*result = hitTest(winrect, x, y, border_width);
|
||||||
{
|
if (0 != *result)
|
||||||
return true;
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_titleItem)
|
if (d->m_titleItem)
|
||||||
{
|
{
|
||||||
auto titlePos = d->m_titleItem->mapToGlobal({ 0, 0 });
|
auto titlePos = d->m_titleItem->mapToGlobal({ 0, 0 });
|
||||||
|
|
|
@ -22,6 +22,7 @@ void WindowHelper::setMaximumSize(const QSize &size){
|
||||||
this->window->setMaximumSize(size);
|
this->window->setMaximumSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::setSize(const QSize &size){
|
void WindowHelper::refreshWindow(){
|
||||||
|
this->window->setFlag(Qt::FramelessWindowHint,true);
|
||||||
|
this->window->setFlag(Qt::FramelessWindowHint,false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
Q_INVOKABLE void setTitle(const QString& text);
|
Q_INVOKABLE void setTitle(const QString& text);
|
||||||
Q_INVOKABLE void setMinimumSize(const QSize &size);
|
Q_INVOKABLE void setMinimumSize(const QSize &size);
|
||||||
Q_INVOKABLE void setMaximumSize(const QSize &size);
|
Q_INVOKABLE void setMaximumSize(const QSize &size);
|
||||||
Q_INVOKABLE void setSize(const QSize &size);
|
Q_INVOKABLE void refreshWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FramelessView* window;
|
FramelessView* window;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,14 +15,22 @@ Rectangle{
|
||||||
|
|
||||||
property string title: "标题"
|
property string title: "标题"
|
||||||
|
|
||||||
|
property bool resizable: {
|
||||||
|
if(Window.window == null){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return !(Window.window.minimumHeight === Window.window.maximumHeight && Window.window.maximumWidth === Window.window.minimumWidth)
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
property var lastClickTime: new Date()
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: 5
|
anchors.topMargin: 5
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
|
hoverEnabled: true
|
||||||
onPressed: Window.window.startSystemMove()
|
onPressed: Window.window.startSystemMove()
|
||||||
onDoubleClicked: {
|
onDoubleClicked: {
|
||||||
toggleMaximized();
|
if(resizable)
|
||||||
|
toggleMaximized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,8 +42,6 @@ Rectangle{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FluText {
|
FluText {
|
||||||
text: title
|
text: title
|
||||||
anchors{
|
anchors{
|
||||||
|
@ -54,10 +60,10 @@ Rectangle{
|
||||||
spacing: 5
|
spacing: 5
|
||||||
|
|
||||||
TFpsMonitor{
|
TFpsMonitor{
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.rightMargin: 12
|
Layout.rightMargin: 12
|
||||||
Layout.topMargin: 5
|
Layout.topMargin: 5
|
||||||
visible: FluApp.isFps
|
visible: FluApp.isFps
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
|
@ -91,6 +97,7 @@ Rectangle{
|
||||||
return Window.Maximized === Window.window.visibility ? FluentIcons.FA_window_restore : FluentIcons.FA_window_maximize
|
return Window.Maximized === Window.window.visibility ? FluentIcons.FA_window_restore : FluentIcons.FA_window_maximize
|
||||||
}
|
}
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
visible: resizable
|
||||||
text:{
|
text:{
|
||||||
if(Window.window == null)
|
if(Window.window == null)
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -43,7 +43,7 @@ Rectangle {
|
||||||
color : FluApp.isDark ? "#202020" : "#F3F3F3"
|
color : FluApp.isDark ? "#202020" : "#F3F3F3"
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.debug("Component.onCompleted:"+root.winId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
|
@ -58,11 +58,7 @@ Rectangle {
|
||||||
if(maximumSize){
|
if(maximumSize){
|
||||||
helper.setMaximumSize(maximumSize)
|
helper.setMaximumSize(maximumSize)
|
||||||
}
|
}
|
||||||
if(maximumSize&&minimumSize){
|
helper.refreshWindow()
|
||||||
if(maximumSize.width === minimumSize.width && maximumSize.height === minimumSize.height){
|
|
||||||
helper.disResizable()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue