8
votes

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.

2
Though I'm not sure about the aero snap you can implement this by using QWidget::setWindowFlags() which will allow you to draw these controls yourself (which is probably what the battle.net app is doing seeing as it has pretty much custom menu controls). There is a really nice article on this: qt.developpez.com/tutoriels/braindeadbzh/customwindow - Downside is that it is in French.Floris Velleman
My application works like that now. Aero snap doesn't work. When minimized, window disappears without any animation.PKE
I am looking for the same behaviour. Have you found a solution? Thanks in advance.Kévin Renella

2 Answers

7
votes

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.

1
votes

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