user15857247
user15857247

Reputation:

Make an Independent Popup in Qt Quick

I have an app which is small in terms of width and height, I want a popup to show when a button is clicked. Problem is the popup is larger than the app window and when i open it, it scales down and looks weird

APP

f572d9c0-7ff4-4797-b5de-84c68b456dc4-image.png

APP WITH POPUP

7824844e-c884-484a-9f33-e14fb00c2d73-image.png

POPUP CONTENT IN DESIGNER

24317906-ffa6-4132-bf03-aac773542d7f-image.png

How can i make the popup independent from the app window, like this:

33c43137-9827-4f18-9afc-8c49c3c323c6-image.png

Or is there a better approach rather than using popup, it would be nice if i were able to move the popup/window around. It still needs to be somehow connected to the main app because it get's data from there

Upvotes: 0

Views: 1286

Answers (2)

user15857247
user15857247

Reputation:

I've gotten it sorted out. I encapsulated the component i wanted to show inside a window and created it using Qt.createComponent()

var playListComponent = Qt.createComponent("CustomPlaylist.qml")
var window = playListComponent.createObject(rootWindow)
window.show()

The root element of CustomPlaylist.qml is a Window

Nipsie

Upvotes: 0

André
André

Reputation: 590

A Popup in QML appears as a layer on top of the parent window, so it cannot be bigger than the parent window. If you want a separate, top level window, you should use a Window or a Dialog instead.

Upvotes: 1

Related Questions