This commit is contained in:
朱子楚\zhuzi 2024-03-31 21:52:06 +08:00
parent d222cb640c
commit 68015776ab
12 changed files with 27 additions and 17 deletions

View File

@ -344,7 +344,7 @@ FluWindow {
id:callable id:callable
property bool silent: true property bool silent: true
onStart: { onStart: {
console.debug("satrt check update...") console.debug("start check update...")
} }
onFinish: { onFinish: {
console.debug("check update finish") console.debug("check update finish")

View File

@ -16,7 +16,7 @@ FluWindow {
onInitArgument: onInitArgument:
(arg)=>{ (arg)=>{
window.title = arg.title window.title = arg.title
loader.setSource( arg.url,{animDisabled:true}) loader.setSource(arg.url,{animationEnabled:false})
} }
FluLoader{ FluLoader{
id: loader id: loader

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 MiB

After

Width:  |  Height:  |  Size: 5.1 MiB

View File

@ -94,7 +94,7 @@ int main(int argc, char *argv[])
engine.load(url); engine.load(url);
const int exec = QGuiApplication::exec(); const int exec = QGuiApplication::exec();
if (exec == 931) { if (exec == 931) {
QProcess::startDetached(qApp->applicationFilePath(), QStringList()); QProcess::startDetached(qApp->applicationFilePath(), qApp->arguments());
} }
return exec; return exec;
} }

View File

@ -45,6 +45,9 @@ FluFrameless::FluFrameless(QQuickItem *parent)
} }
FluFrameless::~FluFrameless(){ FluFrameless::~FluFrameless(){
}
void FluFrameless::onDestruction(){
qApp->removeNativeEventFilter(this); qApp->removeNativeEventFilter(this);
} }
@ -142,7 +145,6 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message,
}else{ }else{
offsetSize = 1; offsetSize = 1;
} }
_maximizeButton->setProperty("hover",false);
if(!isCompositionEnabled()){ if(!isCompositionEnabled()){
offsetSize = 0; offsetSize = 0;
} }
@ -152,6 +154,7 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message,
clientRect->left = originalLeft + offsetSize; clientRect->left = originalLeft + offsetSize;
clientRect->right = originalRight - offsetSize; clientRect->right = originalRight - offsetSize;
} }
_setMaximizeHovered(false);
*result = WVR_REDRAW; *result = WVR_REDRAW;
return true; return true;
}else if(uMsg == WM_NCHITTEST){ }else if(uMsg == WM_NCHITTEST){
@ -159,10 +162,10 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message,
if (*result == HTNOWHERE) { if (*result == HTNOWHERE) {
*result = HTZOOM; *result = HTZOOM;
} }
_setMaximizeHoverd(true); _setMaximizeHovered(true);
return true; return true;
} }
_setMaximizeHoverd(false); _setMaximizeHovered(false);
_setMaximizePressed(false); _setMaximizePressed(false);
*result = 0; *result = 0;
POINT nativeGlobalPos{GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; POINT nativeGlobalPos{GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
@ -341,7 +344,7 @@ void FluFrameless::_setMaximizePressed(bool val){
_maximizeButton->setProperty("down",val); _maximizeButton->setProperty("down",val);
} }
void FluFrameless::_setMaximizeHoverd(bool val){ void FluFrameless::_setMaximizeHovered(bool val){
_maximizeButton->setProperty("hover",val); _maximizeButton->setProperty("hover",val);
} }

View File

@ -36,6 +36,7 @@ public:
Q_INVOKABLE void showMinimized(); Q_INVOKABLE void showMinimized();
Q_INVOKABLE void showNormal(); Q_INVOKABLE void showNormal();
Q_INVOKABLE void setHitTestVisible(QQuickItem*); Q_INVOKABLE void setHitTestVisible(QQuickItem*);
Q_INVOKABLE void onDestruction();
protected: protected:
bool eventFilter(QObject *obj, QEvent *event) override; bool eventFilter(QObject *obj, QEvent *event) override;
private: private:
@ -48,7 +49,7 @@ private:
bool _hitAppBar(); bool _hitAppBar();
bool _hitMaximizeButton(); bool _hitMaximizeButton();
void _setMaximizePressed(bool val); void _setMaximizePressed(bool val);
void _setMaximizeHoverd(bool val); void _setMaximizeHovered(bool val);
private: private:
qint64 _current; qint64 _current;
int _edges = 0; int _edges = 0;

View File

@ -76,7 +76,7 @@ QObject* FluTreeModel::getRow(int row){
return _rows.at(row); return _rows.at(row);
} }
void FluTreeModel::checkRow(int row,bool chekced){ void FluTreeModel::checkRow(int row,bool checked){
auto itemData = _rows.at(row); auto itemData = _rows.at(row);
if(itemData->hasChildren()){ if(itemData->hasChildren()){
QList<FluNode*> stack = itemData->_children; QList<FluNode*> stack = itemData->_children;
@ -85,7 +85,7 @@ void FluTreeModel::checkRow(int row,bool chekced){
auto item = stack.at(stack.count()-1); auto item = stack.at(stack.count()-1);
stack.pop_back(); stack.pop_back();
if(!item->hasChildren()){ if(!item->hasChildren()){
item->_checked = chekced; item->_checked = checked;
} }
QList<FluNode*> children = item->_children; QList<FluNode*> children = item->_children;
if(!children.isEmpty()){ if(!children.isEmpty()){
@ -96,10 +96,10 @@ void FluTreeModel::checkRow(int row,bool chekced){
} }
} }
}else{ }else{
if(itemData->_checked == chekced){ if(itemData->_checked == checked){
return; return;
} }
itemData->_checked = chekced; itemData->_checked = checked;
} }
Q_EMIT layoutChanged(QList<QPersistentModelIndex>(),QAbstractItemModel::VerticalSortHint); Q_EMIT layoutChanged(QList<QPersistentModelIndex>(),QAbstractItemModel::VerticalSortHint);
QList<FluNode*> data; QList<FluNode*> data;
@ -201,7 +201,7 @@ void FluTreeModel::expand(int row){
insertRows(row+1,insertData); insertRows(row+1,insertData);
} }
void FluTreeModel::dragAnddrop(int dragIndex,int dropIndex,bool isDropTopArea){ void FluTreeModel::dragAndDrop(int dragIndex,int dropIndex,bool isDropTopArea){
if(dropIndex>_rows.count() || dropIndex<0){ if(dropIndex>_rows.count() || dropIndex<0){
return; return;
} }

View File

@ -102,10 +102,10 @@ public:
Q_INVOKABLE void setDataSource(QList<QMap<QString,QVariant>> data); Q_INVOKABLE void setDataSource(QList<QMap<QString,QVariant>> data);
Q_INVOKABLE void collapse(int row); Q_INVOKABLE void collapse(int row);
Q_INVOKABLE void expand(int row); Q_INVOKABLE void expand(int row);
Q_INVOKABLE void dragAnddrop(int dragIndex,int dropIndex,bool isDropTopArea); Q_INVOKABLE void dragAndDrop(int dragIndex,int dropIndex,bool isDropTopArea);
Q_INVOKABLE FluNode* getNode(int row); Q_INVOKABLE FluNode* getNode(int row);
Q_INVOKABLE void refreshNode(int row); Q_INVOKABLE void refreshNode(int row);
Q_INVOKABLE void checkRow(int row,bool chekced); Q_INVOKABLE void checkRow(int row,bool checked);
Q_INVOKABLE bool hitHasChildrenExpanded(int row); Q_INVOKABLE bool hitHasChildrenExpanded(int row);
Q_INVOKABLE void allExpand(); Q_INVOKABLE void allExpand();
Q_INVOKABLE void allCollapse(); Q_INVOKABLE void allCollapse();

View File

@ -224,7 +224,7 @@ Item {
onReleased: { onReleased: {
loader_container.sourceComponent = undefined loader_container.sourceComponent = undefined
if(d.dropIndex !== -1){ if(d.dropIndex !== -1){
tree_model.dragAnddrop(d.dragIndex,d.dropIndex,d.isDropTopArea) tree_model.dragAndDrop(d.dragIndex,d.dropIndex,d.isDropTopArea)
} }
d.dropIndex = -1 d.dropIndex = -1
d.dragIndex = -1 d.dragIndex = -1

View File

@ -103,6 +103,9 @@ Window {
frameless.setHitTestVisible(appBar.layoutMacosButtons) frameless.setHitTestVisible(appBar.layoutMacosButtons)
frameless.setHitTestVisible(appBar.layoutStandardbuttons) frameless.setHitTestVisible(appBar.layoutStandardbuttons)
} }
Component.onDestruction: {
frameless.onDestruction()
}
} }
Component{ Component{
id:com_background id:com_background

View File

@ -224,7 +224,7 @@ Item {
onReleased: { onReleased: {
loader_container.sourceComponent = undefined loader_container.sourceComponent = undefined
if(d.dropIndex !== -1){ if(d.dropIndex !== -1){
tree_model.dragAnddrop(d.dragIndex,d.dropIndex,d.isDropTopArea) tree_model.dragAndDrop(d.dragIndex,d.dropIndex,d.isDropTopArea)
} }
d.dropIndex = -1 d.dropIndex = -1
d.dragIndex = -1 d.dragIndex = -1

View File

@ -102,6 +102,9 @@ Window {
frameless.setHitTestVisible(appBar.layoutMacosButtons) frameless.setHitTestVisible(appBar.layoutMacosButtons)
frameless.setHitTestVisible(appBar.layoutStandardbuttons) frameless.setHitTestVisible(appBar.layoutStandardbuttons)
} }
Component.onDestruction: {
frameless.onDestruction()
}
} }
Component{ Component{
id:com_background id:com_background