Skip to content

chore: ajust window flags - #380

Closed
kegechen wants to merge 1 commit into
linuxdeepin:masterfrom
kegechen:fix_windowflags
Closed

chore: ajust window flags#380
kegechen wants to merge 1 commit into
linuxdeepin:masterfrom
kegechen:fix_windowflags

Conversation

@kegechen

Copy link
Copy Markdown
Contributor

fix window flags is always Qt::Window

deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Aug 19, 2024
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#380
@deepin-bot

deepin-bot Bot commented Aug 19, 2024

Copy link
Copy Markdown
Contributor

Doc Check bot
🟢 Document Coverage Check Passed!

Comment thread src/dquickwindow.cpp
{
auto windowFlags = window->flags();
if (window->isTopLevel()) {
fixTopLevelWindowFlags(windowFlags);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个行为,应该让window的创建者自己设置吧?

@kegechen kegechen Aug 20, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

widget 里面是 qwidgetwindow 主动做了这个事,默认窗口只有 Qt::Window 这个 flag
如果让创建者自己设置,那么所有的窗口都需要自行处理一次,包括我的example也没有最大化、最小化、关闭按钮

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flags: Qt.Window | Qt.WindowCloseButtonHint | Qt.WindowTitleHint | Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint
应用 倒是也可以这么设置

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个操作会不会覆盖了应用在Window设置的flags,

@kegechen
kegechen requested a review from zccrs August 20, 2024 03:36
FeiWang1119
FeiWang1119 previously approved these changes Aug 21, 2024
@deepin-bot

deepin-bot Bot commented Aug 21, 2024

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.6.34
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #382

deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Aug 22, 2024
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#380
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

关键摘要:

  • fixTopLevelWindowFlags函数中,对于Qt::WindowFullscreenButtonHint的移除操作可能不必要,因为该属性在Qt的文档中没有说明是否支持在顶层窗口上设置。
  • fixTopLevelWindowFlags函数中的switch语句可以简化,使用casedefault直接关联所有可能的窗口类型,而不是使用Qt::WindowQt::Dialog等。
  • fixTopLevelWindowFlags函数中的if语句可以简化,直接在switch语句中设置所有所需的标志,而不是检查Qt::WindowType_Mask
  • fixTopLevelWindowFlags函数中的if语句检查(flags & Qt::WindowType_Mask) == Qt::SplashScreen,但没有考虑到Qt::SplashScreen窗口类型可能不会出现在flags中,这可能会导致未定义行为。
  • fixTopLevelWindowFlags函数中的if语句检查window->isTopLevel(),但没有考虑到window可能不是顶级窗口的情况,这可能会导致未定义行为。
  • fixTopLevelWindowFlags函数中的window->setFlags(windowFlags);可能会覆盖窗口的现有属性,应该先获取当前的窗口属性,然后与需要设置的属性进行合并。

是否建议立即修改:

@deepin-bot

deepin-bot Bot commented Sep 23, 2024

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.0.35
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #400

Comment thread src/dquickwindow.cpp Outdated
Comment thread src/dquickwindow.cpp
@zccrs

zccrs commented Oct 8, 2024

Copy link
Copy Markdown
Member

这是解决啥bug?

fix window flags is always Qt::Window
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kegechen

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kegechen

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Oct 16, 2024
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#380
@kegechen

Copy link
Copy Markdown
Contributor Author

这是解决啥bug?

不算是bug,应用如果直接用dtk的 window, 就算有标题栏默认是没有最大最小关闭这些按钮的。需要手动设置 flags 才行。这里 参考widget 主动设置一下flags,当然也可以不加,要求用户自己设置。 改的就是一个默认行为而已

@deepin-bot

deepin-bot Bot commented Oct 31, 2024

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.7.1
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #401

@deepin-bot

deepin-bot Bot commented Nov 15, 2024

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.7.2
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #416

@deepin-bot

deepin-bot Bot commented Nov 22, 2024

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.7.3
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #419

@deepin-bot

deepin-bot Bot commented Dec 4, 2024

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.7.4
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #424

@kegechen kegechen closed this Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants