Resize QDockWidget without undocking and docking - c++

I found a weird behaviour of QDockWidget when I tried to insert it into own application. The problem is that after dragging border of widget, it size goes back, so I can't change its size. So then I opened official qt example. But the same problem exist in this example. You can see it below. (After undocking and docking again problem disappears)
Another KDE applications in my system doesn't have such bug, so I think there is some function in Qt wich fixes this problem. Please help me to fix this example.

The only thing you need to do is to call QMainWindow::resizeDocks. After that the bug will disappear.

Related

Can't rearrange `QDockWidget` on Ubuntu 14.04

I have a UI written in Qt that makes extensive use of dock widgets, primarily so that end users can customize which which docks are available, and how they are arranged.
We recently upgraded to Qt 5.6.1, and the dock widgets can no longer be rearranged on Ubuntu, although they still work on windows and other OS's. When you try to move the docks, the rubber band still appears as usual showing the new location, but when dropped the dock just snaps back into whichever position it started in, which is always tabbed somehow.
After several hours of searching, I think the problem is related to QTBUG-54185, and I'm wondering if there is any way to work around the bug while we wait for the Qt 5.6.2 release which fixes it.
The bug is related to having the AnimatedDocks property disabled. QDockWidget rearranging still works, even in spite of the bug, for dock widgets which are animated.
The problem was that in the code, the main window was setting the dock options manually as
mainWindow->setDockOptions(AllowTabbedDocks);
Since DockOptions are OR'd, what is happening here is that the AnimatedDocks property, which is enabled by default, is being unintentionally disabled. The solution for me was to delete the offending line, since the default options are AllowedTabbedDocks|AnimatedDocks, which is actually what I wanted all along.

Dockable windows are not reinstated correctly

This is my first question in this community. I always search a lot when having problems and I always find an answer. But not in this one. Maybe I am not asking Google correctly.
Anyways this looks like a bug to me but I might get it wrong.
Using VS2012 (or 2013) I create the default Multiple documents MFC application. I do not write a single line of code. I compile and run. Then as a user I dock the properties window which by default is at the right to the output window as shown below .
Then I close the application and restart. The window is where it should be but with different width as shown below
If you dock the window to the right (in the view and not in another window) then there is no problem. The position and width are restored just fine. Also this only happens if the main window is maximized. The behaviour, if the main window is not, is as expected.
Do you think it is actually how Microsoft wanted to make this work or they missed that? Is there a workaround for this?
Again forgive me if this question has been asked before but really...
I couldn't find anything.
Appreciate any kind of help.

How to add the OS X flavor to a Qt app

I have used Qt previously only in the form of PyQt, and today I tried the original version of Qt in C++.
I got it working, however, when if start up my app, I have several problems with it:
it's stationary, which means, I cannot drag it across the screen
I cannot change the size of the window
it does not have a OS X type status bar (which contains the three colored buttons and the name of the window)
How can I add these features to my C++ Qt app?
I have tried to look for a solution, but only found QtApplication::setStyle();, which did not solve my problem.
You can see the code here.
The code inside your subclass of QMainWindow contains this line:
setWindowFlags(Qt::FramelessWindowHint);
That is probably causing most of the problems you describe. Try removing that line.

QDialog or QMessageBox show Qt::BusyCursor when added to existing application

I am new to qt and I have an issue I cannot understand.
I have created my own QDialog and now I want to add it to an existing application.
In QT creator, everything works fine but when I add either my custom dialogue or even a
message box to the existing code, something odd happens.
The dialogue works just fine but when I hover over the main area of the dialogue
the icon changes to a Qt::BusyCursor the busy wait icon.
At first I assumed this must be a threading issue but then isn't .exec() suppose to block?
Also when I hover over the title bar or the message box / dialogue, it seems fine i.e it shows a Qt::ArrowCursor, in both cases the dialogue functionally works fine also.
I have tried to set the .setCursor() on both and it did not work still a busy icon.
can anyone give me some hints as to what I might look at to investigate this more.
Thanks a lot!!!
I can suggest you to use
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
and reset it with
QApplication::restoreOverrideCursor();.

Qt setWindowTitle on Mac does not change icon in dock

The problem appears when I try to build a single binary on Mac. It is working fine when building my application as a bundle. Then it just takes the icon defined in the info.plist.
Another thing is that I want to avoid displaying my application icon in the dock at all? Any way to do that?
I need a solution for one of the issues, either show a custom icon in dock, or don't show any icon.
Have somebody had the same issue and maybe found a workaround or solution?