Comments (9)
QSizePolicy only works when the widget is in a layout because you can't disable the user from resizing the window by setting a fixed size policy when you use a plain Qt window, so FramelessHelper shouldn't do this as well. It's a mistake that FramelessHelper made, we have removed it in QWindowKit. You should use setFixedSize
or set Qt::MSWindowsFixedSizeDialogHint
flag.
from qwindowkit.
I forget to say that I need to change the feature
(whether user can resize window by dragging borders or not) frequently when the window is shown.
And after testing two methods you mentioned above, I think neither of the two methods is appropriate.
Reasons are as follows.
For setFixedSize
: after calling it, QWidget::resize
can't work, so I need to call resize
or setFixedSize
according to property resizable
, it's cumbersome and when downstream developers cast the dialog as QWidget
or QDialog
, it gets worse. Any way, the feature
is not equal to fixedSize
, it should be anything like user-fixed
.
For Qt::MSWindowsFixedSizeDialogHint
: if you change windowFlags when the window is visible, it will hide because setParent
is called in it. And the worst part is once the flag is set, a resize error occurs in dpi scale when move window between screens(tested in 1920*1080 100% and 150%).
from qwindowkit.
I agree with you that the feature
has nothing to do with QSizePolicy
, so could you please just add a flag to describe it and expose the api to change it separately?
from qwindowkit.
I agree with you that the
feature
has nothing to do withQSizePolicy
, so could you please just add a flag to describe it and expose the api to change it separately?
我认为你应该在正常的Qt窗口里尝试你想要的功能,如果正常窗口都没有这种功能,那么QWK也不会实现,没有必要实现这种多余的功能。
from qwindowkit.
我之前就是在WM_NCHITTEST中根据是否允许用户resize的flag,选择性进行HTLEFT等边框的判断。
QWK处理了WM_NCHITTEST并且没有给使用者提供修改的方式,这个功能的确和QWK无关,但是QWK也限制了使用者处理该消息,这是否不太合理呢?
from qwindowkit.
Author
你的意思是,你在自己的全局nativeEventFilter或者窗口重写的nativeEventFilter中处理了WM_NCHITTEST,处理结果仍然会被QWK的覆盖是吗?
from qwindowkit.
调试下来是这样的,QWKHookedWndProc执行在Qt的qWindowsWndProc之前
from qwindowkit.
你说的这个确实是个问题,我想办法做一些修改让你能继续处理你的事件。
from qwindowkit.
代码已提交,你可以试试看在你的窗口中重写nativeEvent,类似如下逻辑,应该可以禁止用户调整大小。
bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) {
Q_UNUSED(eventType)
auto msg = reinterpret_cast<MSG *>(message);
if (msg->message == WM_NCHITTEST) {
auto &res = *result;
if (res >= HTLEFT && res <= HTBOTTOMRIGHT) {
res = HTBORDER;
return true;
}
}
return false;
}
from qwindowkit.
Related Issues (20)
- Press win+up after win+down, the window lost focus and behind another window. HOT 1
- 在Mac上, 修改标题栏高度以及三个系统按钮的位置 HOT 1
- Qt 6.3.2构建Quick失败 HOT 4
- bug HOT 2
- 1920x1080屏幕下,设置qml窗口大小为1920x1080时,启动程序后屏幕左边会有几个像素的空白 HOT 10
- 多任务布局,显示位置不对 HOT 6
- cmake源码集成 HOT 1
- MAC OS 13.6.5 (22G621) qml(6.6.2) 系统按钮有bug HOT 7
- 在win7 x64和x86上提示“无法定位程序输入点GetSystemMetricsForDpi ” HOT 3
- Qt Creator: Cannot open file 'QWKQuickd.lib' HOT 2
- 拖拽标题栏触发最大化,还原窗口,标题栏被遮挡 HOT 7
- win11点击demo里的放大框之后闪退! HOT 1
- win7上运行错误 HOT 1
- 拖拽标题栏在屏幕切换时出现问题 HOT 1
- QT6下窗口不会自动调整布局,窗口也不会自动居中 HOT 5
- 找不到cmake文件 HOT 1
- Snap Layout位置在不同版本qt表现不一样 HOT 4
- Does not work with qmsetup (generating unnecessary outputs from a folder) HOT 15
- QML标题栏其他按钮收不到点击事件 HOT 2
- qmsetup还是需要c++20版本支持(已经看了那个closed issue) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qwindowkit.