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 {
|
||||
|
||||
id:window
|
||||
// width: 800
|
||||
// height: 400
|
||||
// maximumSize: Qt.size(800,400)
|
||||
// minimumSize: Qt.size(800,400)
|
||||
width: 800
|
||||
height: 400
|
||||
maximumSize: Qt.size(800,400)
|
||||
minimumSize: Qt.size(800,400)
|
||||
title:"安装向导"
|
||||
|
||||
FluAppBar{
|
||||
|
|
|
@ -8,7 +8,15 @@
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
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);
|
||||
QQmlApplicationEngine engine;
|
||||
#if defined(STATICLIB)
|
||||
|
|
|
@ -42,15 +42,8 @@ void FluApp::navigate(const QString& route){
|
|||
}
|
||||
bool isAppWindow = route==initialRoute();
|
||||
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));
|
||||
QObject::connect(view, &QQuickView::statusChanged, view, [&](QQuickView::Status status) {
|
||||
qDebug()<<"-------------->";
|
||||
if (status == QQuickView::Status::Ready) {
|
||||
Q_EMIT windowReady(view);
|
||||
|
||||
|
@ -58,7 +51,6 @@ void FluApp::navigate(const QString& route){
|
|||
view->show();
|
||||
}
|
||||
});
|
||||
qDebug()<<"-----view->setSource((routes().value(route).toString()))--------->";
|
||||
view->setSource((routes().value(route).toString()));
|
||||
if(isAppWindow){
|
||||
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){
|
||||
qDebug()<<"-----equalsWindow--------->";
|
||||
view->setWidth(800);
|
||||
view->setHeight(500);
|
||||
view->setMaximumSize(QSize(800,500));
|
||||
view->setMinimumSize(QSize(800,500));
|
||||
return view->winId() == window->winId();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
Q_INVOKABLE bool equalsWindow(FramelessView *view,QWindow *window);
|
||||
|
||||
private:
|
||||
|
||||
static FluApp* m_instance;
|
||||
QWindow *appWindow;
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ public:
|
|||
{
|
||||
borderless = enabled;
|
||||
//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
|
||||
setShadow(handle, borderless_shadow && (newStyle != Style::windowed));
|
||||
|
@ -348,20 +348,19 @@ bool FramelessView::nativeEvent(const QByteArray& eventType, void* message, long
|
|||
{
|
||||
RECT winrect;
|
||||
GetWindowRect(HWND(winId()), &winrect);
|
||||
|
||||
long x = GET_X_LPARAM(msg->lParam);
|
||||
long y = GET_Y_LPARAM(msg->lParam);
|
||||
|
||||
*result = 0;
|
||||
if (!isMaxWin(this) && !isFullWin(this))
|
||||
{ //非最大化、非全屏时,进行命中测试,处理边框拖拽
|
||||
if(!((maximumHeight()==minimumHeight())&&(maximumWidth()==minimumWidth()))){
|
||||
*result = hitTest(winrect, x, y, border_width);
|
||||
if (0 != *result)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (d->m_titleItem)
|
||||
{
|
||||
auto titlePos = d->m_titleItem->mapToGlobal({ 0, 0 });
|
||||
|
|
|
@ -22,6 +22,7 @@ void WindowHelper::setMaximumSize(const QSize &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 setMinimumSize(const QSize &size);
|
||||
Q_INVOKABLE void setMaximumSize(const QSize &size);
|
||||
Q_INVOKABLE void setSize(const QSize &size);
|
||||
Q_INVOKABLE void refreshWindow();
|
||||
|
||||
private:
|
||||
FramelessView* window;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,13 +15,21 @@ Rectangle{
|
|||
|
||||
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{
|
||||
property var lastClickTime: new Date()
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 5
|
||||
acceptedButtons: Qt.LeftButton
|
||||
hoverEnabled: true
|
||||
onPressed: Window.window.startSystemMove()
|
||||
onDoubleClicked: {
|
||||
if(resizable)
|
||||
toggleMaximized();
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +42,6 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
FluText {
|
||||
text: title
|
||||
anchors{
|
||||
|
@ -91,6 +97,7 @@ Rectangle{
|
|||
return Window.Maximized === Window.window.visibility ? FluentIcons.FA_window_restore : FluentIcons.FA_window_maximize
|
||||
}
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: resizable
|
||||
text:{
|
||||
if(Window.window == null)
|
||||
return ""
|
||||
|
|
|
@ -43,7 +43,7 @@ Rectangle {
|
|||
color : FluApp.isDark ? "#202020" : "#F3F3F3"
|
||||
|
||||
Component.onCompleted: {
|
||||
console.debug("Component.onCompleted:"+root.winId)
|
||||
|
||||
}
|
||||
|
||||
Connections{
|
||||
|
@ -58,11 +58,7 @@ Rectangle {
|
|||
if(maximumSize){
|
||||
helper.setMaximumSize(maximumSize)
|
||||
}
|
||||
if(maximumSize&&minimumSize){
|
||||
if(maximumSize.width === minimumSize.width && maximumSize.height === minimumSize.height){
|
||||
helper.disResizable()
|
||||
}
|
||||
}
|
||||
helper.refreshWindow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue