Make an Independent Popup in Qt Quick - qt

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
APP WITH POPUP
POPUP CONTENT IN DESIGNER
How can i make the popup independent from the app window, like this:
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

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.

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

Related

GTK# button drawn incorrectly?

My GTK# (v2.12.44) app has a single Window with a single button on it. The button appears to be centered on the Window, because that's where the text appears, but the border/background for the button is shifted up and to the left for no reason I can see. Has anyone seen this before? I saw similar behavior from an Image widget. Note this only happens in Windows, not on (for example) Raspberry Pi/Jesse.
Here's the code:
Application.Init();
var window = new Window("test") {new Button("testing 1, 2, 3")};
window.Maximize();
window.ShowAll();
Application.Run();
Your code works well. Try to add a container before adding a button and set some parametrs you want to. Fill and Expand when adding Button.

How do I find the part of a NSScrollView's documentView that's not beneath a window's toolbar?

I have a very simple setup. It's a single window with a toolbar, completely filled with a NSScrollView. The window is setup as follows:
window.styleMask = [.titled, .resizable, .closable, .fullSizeContentView]
window.titleVisibility = .hidden
This looks pretty gorgeous! However, I need to change how the content of the document view behaves as its frame changes. The problem is that docuentView.visibleRect reports that the minY is 0.0 until it hits the top of the window, not the bottom of the toolbar! So some of my custom drawing and behavior is cut off, and that is not so gorgeous.
How do I find the actually-usable rect of that document view, which excludes the part of it beneath the toolbar?
There is a property on the window called contentLayoutRect, which represents the portion of the window content that is visible (using non-flipped coordinates). You can use this to position the content view and rest assured that this will still work if Apple decides some other edge of the window becomes obscured.

How can I allow user resize on elements within the window using Qt designer?

I want to allow a user using my application to be able to drag a boundary between two widgets in my window which will resize the two (i.e. you drag it down and the top one will get bigger while the bottom gets smaller, and vice-versa).
Is there anything in Qt designer that will allow a user to resize an element in the window, within certain constraints?
Thank you
What you're describing is called a QSplitter widget. In Qt Designer, you can create one by selecting 2 or more widgets, and then clicking the splitter button on the toolbar at the top. It's in the same location as the layout buttons. It will place those widgets inside a QSplitter. You still need to place the splitter widget inside another layout. It will create a handle between them to let you resize the portion that each widget gets.
You're looking for the QDockWidget. It can do all that you described above and more. The user can dock the widget to different sides of the window, changing which widget is on the top or bottom. You can customize the minimum and maximum sizes, as well as default sizes.

Resize QDialog at a runtime

I have a QDialog subclass containing some options of my application. Some of the options are core, the other are advanced, so I decided to put them into separeted checkable QGroupBox.
I want my dialog to shrink verticaly when the user checked off advanced options box, but I can't find the way to do it properly - the dialog size stays exactle the same
I set dialog's size policy to Expanding, tried to call adjustSize() and tried to call resize() method - nothing helps. I can't resize programmaticaly dialog to be smaller then it's current size (it only can become larger). At the same time, it is possible to resize it manualy.
Can anybody help me?
If you don't need manual resize, you can add
layout()->setSizeConstraint(QLayout::SetFixedSize);
to the dialog constructor, then the layout takes over the responsibility to automatically resize when widgets are shown or hidden.

QT - sliding widget

I'm new in QT interfaces. I would like to create sliding widget in my desktop application (no QML). Idea is to create sliding menu like facebook component on some web pages.
For example:
I have main window and I want to have small part of widget on the right window edge
When mouse move on this widget (or click on it) then this widget slide to show all its content.
I know how to create animation and handle mouse events. There is a lot of examples about it. The problem is that this menu widget should not interact with other layouts and widgets. I mean, main window has root horizontal layout and I don't know how to exclude this widget from it and place widget in front of all widgets on main window. Are exists some layers in QT?
You could accomplish similar functionality by overlaying a custom QDockWidget. This widget could then float above the other widgets in a fixed position relative to your mainwindow. Connect the main window's resize/move events to slots on your QDockWidget that keeps their positions in sync.

Resources