Borderless window in Qt on Windows which supports native features: aero snap, DWM resize and minimization

梦想的初衷 提交于 2019-12-05 21:30:47

问题


I'm trying to create a borderless window in Qt on Windows which supports native features: aero snap, DWM resize and minimization, shake, etc. Like Office 2013 or Visual Studio 2012. But they are written in wpf. There are a lot of examples in wpf and pure WinApi, but I wasn't able to find any Qt example.

Recently I've found Blizzard's Battle.net App(screenshot). They are using QT 4.8.5 and their main window looks and behaves exactly as I want in my app.

Does anyone know how to do that?

Thanks for your help.


回答1:


I've found a workaround for this problem.

Instead of using Qt main window, i've created a simple WinAPI borderless window, like in this SO discussion. Then i added QWinWidget from QtWinMigrate project, and filled window with it.

As result, main window and resizable edges are handled by WinAPI, and everything inside main window is handled by QWinWidget. And with QWinWidget you can create Qt gui like in any other Qt app.

Here is a small example project on GitHub.




回答2:


Perhaps this might help you, Windows specific Qt classes WinExtras

http://qt-project.org/doc/qt-5/qtwin.html

http://qt-project.org/doc/qt-5/qtwinextras-module.html

Besides you can use QT Quick 2.0 to design UI similar to WPF



来源:https://stackoverflow.com/questions/22158445/borderless-window-in-qt-on-windows-which-supports-native-features-aero-snap-dw

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!