qdockwidget

QDockWidget starting size

时光怂恿深爱的人放手 提交于 2019-12-13 19:04:30
问题 I'm somewhat stuck on what feels like it should be a simple problem. I've got QMainWindow with several QDockWidgets. The QDockWidget (_tree_dock in my code) starts in the LeftDockWidgetArea. It contains a QWidget (dockWidgetContents_2) which contains a QTreeWidget (_tree_view). I can resize/move around the QDockWidget at runtime without any problems, however, when the program starts up the QDockWidget is slightly too small. I'm able to shrink the QDockWidget quite a bit so I know it isn't at

Floating sub QMainWindow (QMainWindow as child widget of main QMainWindow)

痞子三分冷 提交于 2019-12-13 16:25:59
问题 I use a QMainWindow as child of my main QMainWindow . By that I get an other area which I can use for dockable widgets ( QDockWidget ). According to the following posts this is OK, it also works perfectly for me. https://qt-project.org/forums/viewthread/17519 http://www.qtcentre.org/threads/12569-QMainWindow-as-a-child-of-QMainWindow To make the QMainWindow behaving as a normal widget, I unset the window flag, this trick is mentioned in one of the posts above. Now I also want to be able to

QDockWidget change background color when floating

烂漫一生 提交于 2019-12-13 00:44:05
问题 I have a QDockWidget with a transparent background, but I would like to change the background color or background image when it is floating. It doesn't look like the qt style sheets have a pseudo state to tell you whether or not they are floating, so I'd like to know: is this possible to do? 回答1: Found the solution. Add the following connection in the code: connect(knobDock, &QDockWidget::topLevelChanged, [&] (bool isFloating) { if (isFloating) { setAttribute(Qt::WA_TranslucentBackground,

QDockWidget sized wrong when docked on right side of Main Window

折月煮酒 提交于 2019-12-12 13:01:40
问题 I am new to Qt and I am trying to create a DockWidget that docks on the right of the window. I set a maximum and minimum width for the dock (as you will see in the code below). This works if the dock widget is added with Qt::LeftDockWidgetArea , but when it is added with Qt::RightDockWidgetArea , The dock is "padded" out to the center of the window, like this: I am probably not sizing the dock in the correct way.. Here is the code for this window: int main(int argv, char** args) {

Qt - How to show tabs of tabified dockwidget at the top instead of the bottom

僤鯓⒐⒋嵵緔 提交于 2019-12-12 09:45:17
问题 In Qt, you can tabify dockWidgets. If I do that, the tabs show on the bottom of the dockWidgets, as is shown in the left sketch. This is the behavior I get under Windows 7 with the latest Qt4 and PyQt4. How can I tell Qt to place the tabs on the dockWidgets top as shown in the right sketch? default: tabs on bottom I want: tabs on top +--------------------+ +------+-----+ | dockWidget1 | | tab1 | tab2|-------+ | | | | | tab1 | tab2|-------| | dockWidget1 | +------+-----+ +--------------------+

QDockWidget splitter jumps when QMainWindow Resized

∥☆過路亽.° 提交于 2019-12-11 07:36:40
问题 In an old program of mine, I have 2-column QTableWidget inside of a QDockWidget. Building it in modern times (Qt 5.10) I seem to have to override the table's sizeHint() to get it to be a width besides 100px or something. Which was a bit annoying (didn't need this before--why isn't the table's width via headers the default?) But with that tweaked, there's now another nuisance: if the user does any moving of the splitter for the dock widget, it will be lost on any window resize. I made a little

How to correctly configure QDockWidget for it to show/hide?

丶灬走出姿态 提交于 2019-12-11 06:47:40
问题 I'm new to Qt GUI and initially wanted to configure a Qt Dock Widget which is shown when pressed a key, let's say 'A' and is hidden when pressed another key, let's say 'B'. But after researching a bit, I didn't find any relevant solution. I tried creating a toggle button which when pressed first will show the dock widget and when pressed again will hide it. It's working fine but Is there any way to do it better or assigning any key for showing and hiding dock widget? t_button = new

pyqt : resize qdockwidget in maya

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 05:58:31
问题 I've made a tool for Maya. And I used QDockWidget within QMainWindow for entire UI composition. As you and I know, I can "saveState" and "restoreState" to retain QToolBar, QDockWidget, and so on. I don't know the reason, but in Maya I can't "restoreState" the actual state. It can restore all of the state for QToolBar, QDockWidget except the size of QDockWidget. So I want to try to resize QDockWidget programmatically. Is there any way to do that? 回答1: Try reimplementing the sizeHint for the

How to detect when a QDockWidget is moved out of a QMainWindow?

不羁的心 提交于 2019-12-10 17:49:34
问题 There is a signal which allows the user to know where a QDockWidget has been moved inside a QMainWindow : void dockLocationChanged(Qt::DockWidgetArea area) The problem is that this signal is not fired when a QDockWidget is moved out of the QMainWindow (either by dragging or by double-clicking the dockwidget's title bar). Is there a way to detect that event, without reimplementing moveEvent() ? 回答1: There is a floating property exactly for that purpose, and a topLevelChanged signal. 来源: https:

QDockWidget layout with no central widget

六眼飞鱼酱① 提交于 2019-12-10 16:17:49
问题 I have a problem with QDockWidget. I'm using Qt Designer, and I would like to build an app with only dock-widgets, and have a small bar above for properties. The problem is that I cannot build the app without a main QWidget (I mean with only QDockWidgets). Here is my screenshot: Annotation 1) - this is the space that I can't remove. When I remove it from xml, Qt Designer crashes. If it is not removable, how can I set the left QDockWidget and the right QDockWidget to have half of the entire