Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

基于MainWindow示例代码新增QVideoWidget后导致标题栏无法拖动窗口 #32

Open
LeoLei8060 opened this issue Jan 28, 2024 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@LeoLei8060
Copy link

After adding a QVideoWidget object to the QWKExample_MainWindow project, I encountered an issue where clicking and dragging the title bar does not move the window. The code is as follows:

MainWindow::MainWindow(QWidget *parent) 
: QMainWindow(parent), m_videoWidget(new QVideoWidget(this)), m_player(new QMediaPlayer(this)) {
    installWindowAgent();

    //auto clockWidget = new ClockWidget();
    //clockWidget->setObjectName(QStringLiteral("clock-widget"));
    //clockWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    //setCentralWidget(clockWidget);

    setCentralWidget(m_videoWidget);
    m_player->setVideoOutput(m_videoWidget);

    loadStyleSheet(Dark);

    setWindowTitle(tr("Example MainWindow"));
    resize(800, 600);
}

After invoking the QMediaPlayer::setVideoOutput interface, there are issues with the window's title bar area, as well as problems with window rendering. However, if you resize the window vertically by dragging the top or bottom borders, the mouse can once again move the window by dragging the title bar area. I encountered the same issue with a simple custom frameless window implementation I had developed earlier. I haven't identified the specific cause yet and hope you can provide a solution.

@LeoLei8060
Copy link
Author

I just tested the FramelessHelper library and found that adding QVideoWidget does not cause this issue. I'm curious about the differences in the underlying implementations of the two libraries.

@wangwenx190
Copy link
Collaborator

FramelessHelper has many workarounds but they are not quite related the "frameless" keyword, so we removed many of them in this new project. But some of them may fix some weird issues. And QVideoWidget internally is embeding a QWindow into the QWidget to display video images, this embeded QWindow may cause issues such as confuse our native event handling logic.

@wangwenx190 wangwenx190 self-assigned this Jan 30, 2024
@wangwenx190 wangwenx190 added the bug Something isn't working label Jan 30, 2024
@wangwenx190
Copy link
Collaborator

But indeed this needs to be fixed. I'll investigate it

@mitosuzu
Copy link

mitosuzu commented Feb 22, 2024

@wangwenx190 我遇到了同样的问题,当我放入的窗口中包含QAxWidget时,在程序界面最大化一次后,标题栏的拖动和双击最大最小化失效。

@SineStriker
Copy link
Contributor

@onecodeWorld24 现在还有这个问题吗?

@mitosuzu
Copy link

@onecodeWorld24 现在还有这个问题吗?

出现多余标题栏的解决了,但经过一次窗口大小的变化后(最大化或窗体边缘拖拽改变大小),标题栏的双击最大最小化和拖拽移动就失效了。
image

@SineStriker
Copy link
Contributor

@onecodeWorld24 现在还有这个问题吗?

出现多余标题栏的解决了,但经过一次窗口大小的变化后(最大化或窗体边缘拖拽改变大小),标题栏的双击最大最小化和拖拽移动就失效了。 image

你的qt和系统版本?

@mitosuzu
Copy link

@SineStriker Qt 5.15.2,win11,Windows SKD是10.0

@SineStriker
Copy link
Contributor

@SineStriker Qt 5.15.2,win11,Windows SKD是10.0

确实,很复杂。。。得花点时间研究下了。

@SineStriker SineStriker removed the fixed label Feb 23, 2024
@mitosuzu
Copy link

mitosuzu commented Mar 5, 2024

@onecodeWorld24 现在还有这个问题吗?

出现多余标题栏的解决了,但经过一次窗口大小的变化后(最大化或窗体边缘拖拽改变大小),标题栏的双击最大最小化和拖拽移动就失效了。 image

#51 通过设置QGuiApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings) 这里不能拖动的问题也解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants