qdockwidget

Prevent QDockWidget autosizing behaviour

天涯浪子 提交于 2019-12-10 15:54:46
问题 Qt 5.5.0 In my application, I have a QGraphicsView as the main widget and a QDockWidget for properties. The goal is for the user to select an item in the graphics view and, depending on the item, present the appropriate properties for that item. I achieve this by having a properties manager widget with a layout containing each of the properties widgets. I have signals and slots hooked up for getting the currently selected item, and then show() the widget I need and hide() the rest. This works

Multiple widgets on a QDockWidget

故事扮演 提交于 2019-12-10 14:44:52
问题 I'm making a little app for applying various filters on an image using Qt and C++. My question is, is it possible to add multiple widgets on a QDockWidget ? As i want to add buttons for re-applying the last 5 filters on the dock. Here is an example of what i want to achieve. 回答1: It is possible add to multiple QWidget s into any QWidget . It looks like you probably want to do something like this: QDockWidget dock(QLatin1String("Last filters")); QWidget* multiWidget = new QWidget();

How to disable the context menu of a QDockWidget title bar

跟風遠走 提交于 2019-12-10 07:53:22
问题 I have a couple of QDockWidgets that are all not closabale (using Qt 5.6). Therefore, the context menu that is displayed when right-clicking a title bar of one of them only has disabled entries, and I would like to disable the whole context menu. I tried to set the contextMenuPolicy to NoContextMenu without success. I then tried to use a subclass of QDockWidget, override the ContextMenuEvent and ignore it. The menu is still displayed. I then tried to install an event filter to catch the

QDockWidget causes qt to crash

只愿长相守 提交于 2019-12-08 21:53:50
问题 I Have the version of Qt that is built into ubuntu 11.10. And am trying to use a QDockWidget that cannot actually dock (basically, I just want a window that floats. I don't want to just make the view be a top level view because then I would have the OS window bar up there, which I don't want, and if I were to hide it, then the window won't be movable). So, I basically make a new Qt Gui project, and don't change any of the files, except for the mainwindow.cpp file, which I change to: #include

Tabify 3 QDockWidget

ぐ巨炮叔叔 提交于 2019-12-07 11:41:44
问题 How can I create a tabified dock for 3 widgets in QMainWindow? I'm using the code bellow: widget1 = new QDockWidget(this); widget1 ->setObjectName("name1"); addDockWidget(Qt::LeftDockWidgetArea, widget1); widget2 = new QDockWidget(this); widget2 ->setObjectName("name2"); addDockWidget(Qt::LeftDockWidgetArea, widget2); tabifyDockWidget(widget2, widget1); widget3 = new QDockWidget(this); widget3->setObjectName("name3"); addDockWidget(Qt::LeftDockWidgetArea, widget3); tabifyDockWidget(widget3,

QDockWidget::restoreGeometry not working correctly when QMainWindow is maximized

故事扮演 提交于 2019-12-07 07:05:27
问题 I have a number of QDockWidgets , all docked in a single QMainWindow . I have overridden the showEvent , and after passing the event on to the base class I am restoring the dock widget's geometry void DockWidget::showEvent(QShowEvent* ev) { QDockWidget::showEvent(ev); QByteArray byte_array = settings_.value(id + ".geometry").toByteArray(); LOG("rest: %s", QString(byte_array.toHex())); QDockWidget::restoreGeometry(byte_array); } In my QMainWindow::closeEvent I am calling saveSettings for each

How to resize QMainWindow after removing all DockWidgets?

这一生的挚爱 提交于 2019-12-07 03:25:11
问题 I’m trying to make an application consisting of a QMainWindow , the central widget of which is a QToolBar (it may not be usual, but for my purpose the toolbar’s well suited). Docks are allowed below only. I added a QDockWidget to it, and a QAction on the QToolBar toggles the QDockWidget on and off with removeDockWidget() and restoreDockWidget() . The default size of the QMainWindow is 800 by 24, QToolBar ’s maximumHeight is set to 24 too. Right after the removeDockWidget() is called,

QDockWidget - window with no borders when floating

谁都会走 提交于 2019-12-06 11:43:46
问题 Win 7, Qt 5.3 I use a QDockWidget with my application. Works as intended. Now I hide the title bar by setting setTitleBarWidget(new QWidget(this)) to a default constructed widget. This is the standard way according to Qt documentation. Also works, title bar is gone. In order to undock my widget as window, I use myDockWidget->setFloating(true) (in my own slot). But now, when the widget is undocked, the floating window has no longer borders (hence cannot be moved). If I comment out

Qt resize event for docks

孤街浪徒 提交于 2019-12-06 02:58:40
问题 Is there a way to catch resize events for docks in Qt? I need to be able to detect when a dock is resized (and not only when its location or 'features' change). It looks like there is no 'resized' signal for QDockWidget. 回答1: If you do not wish to subclass to just get resize event control, you can installEventFilter Small example would look like ( MainWindow.h ): (MainWindow holds DockWidget Here) protected: bool eventFilter(QObject *obj, QEvent *event); and in ( MainWindow.cc ): MainWindow:

QDockWidget::restoreGeometry not working correctly when QMainWindow is maximized

北城余情 提交于 2019-12-05 18:19:48
I have a number of QDockWidgets , all docked in a single QMainWindow . I have overridden the showEvent , and after passing the event on to the base class I am restoring the dock widget's geometry void DockWidget::showEvent(QShowEvent* ev) { QDockWidget::showEvent(ev); QByteArray byte_array = settings_.value(id + ".geometry").toByteArray(); LOG("rest: %s", QString(byte_array.toHex())); QDockWidget::restoreGeometry(byte_array); } In my QMainWindow::closeEvent I am calling saveSettings for each of my dock widgets void MainWindow::closeEvent(QCloseEvent* ev) { QList<DockWidget*> dock_widgets =