mirror of
https://github.com/qmlnet/qmlnet.git
synced 2026-05-16 14:15:57 -06:00
[GH-ISSUE #157] Frameless window with aero snap functionalities support #97
Labels
No labels
bug
enhancement
help wanted
help wanted
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/qmlnet#97
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MosiQt on GitHub (Aug 8, 2019).
Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/157
I'm trying to build a frame-less qml application with having aero snap functionalities work like a normal window. So I tried this in main.qml:
this makes the app frameless but I can't find any solution to make the aero snap working. I have a solution in C++/Qt but I don't know how this should be handled in C#? (Stackoverflow)
@pauldotknopf commented on GitHub (Aug 8, 2019):
What is the solution in C++?
@MosiQt commented on GitHub (Aug 8, 2019):
by using windows api : dwmapi.h (for example: https://github.com/deimos1877/BorderlessWindow)
@pauldotknopf commented on GitHub (Aug 8, 2019):
You could probably PInvoke Win32, but I'm not sure how'd you get the native
HWNDfrom theApplicationWindow. You might have to subclassApplicationWindowin a custom QML plugin that you can import and use within Qml.Net.@MosiQt commented on GitHub (Aug 8, 2019):
Thanks for helping. Let me try that. I'll update the post
@MosiQt commented on GitHub (Aug 11, 2019):
Actually I'm confused how should I subclass ApplicationWindow in qml.net since I'm new in .Net. I'll appreciated if give me some help?
@pauldotknopf commented on GitHub (Aug 11, 2019):
You need to use Qt Creator and C++ to create the plugin: https://doc.qt.io/qt-5/qtqml-tutorials-extending-qml-example.html
@MosiQt commented on GitHub (Aug 11, 2019):
I can do that, but my question is how to use the plugin in qml.net?
@pauldotknopf commented on GitHub (Aug 11, 2019):
Ah, when you create the plugin, you'll install it into your Qt's plugin directory.
See some existing plugins:
These plugins will be available from any QML file, via imports. You can use it in .NET like you would any other QML plugin (like QtQuick.Controls, etc).
@MosiQt commented on GitHub (Aug 11, 2019):
Interesting, So qml.Net will search that directory to load all the plugins?
@pauldotknopf commented on GitHub (Aug 11, 2019):
Yes.
Well, Qml.Net won't load them, Qt itself will find and load them. It's a feature of Qt/QML and it's built-in plugin system.
@MosiQt commented on GitHub (Aug 11, 2019):
Understood. At first I thought you have built an engine like qt simulator or something like that for running qml in .Net!
@MosiQt commented on GitHub (Aug 13, 2019):
Thank you Paul. It helped.
I created the plugin with QtCreator and now my applicationWindow has aero snap functionalities completely. But there is another issue. Although the plugin is detected and loaded in QtCreator, it is not loaded while running with vscode (qml.net). I have moved the plugin folder into "/Qt/Local/qml/" folder and its working in QtCreator, but in qml.net gives following error:
(I just have to mention that I launched the qml.net for the first time with different Qt version in path. Now the plugin is installed for the qt version that is in path. I suspect that maybe the qml.net is pointing to a wrong qt version (previous version) in spite that the correct version is in the paths. )
This is my plugin folder:

And this is the main.qml where it works in qtcreator:

@MosiQt commented on GitHub (Sep 22, 2019):
I've fixed this issue by pasting the plugin folder into downloaded qt runtimes. At first I thought paste the plugin into Qt installed path. But, after searching a lot, I've found that I have to paste it into qt runtimes for .Net. It's usually in user path. you can find it by searching qt dlls.