qmainwindow

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

active resizing of widgets inside mainwindow

不羁的心 提交于 2019-12-07 04:02:44
问题 I have a few widgets in a main window. i want the user to be able to resize the widgets inside the window as they please, just like how one would resize the main window. Do I have to make a layout container to enable this? or ....layout? Buh the layout contains are static once the window is rendered. In the picture the three widgets should be enable with resizing such that the user can drag their sides/corners to expand or minimize the widget size. 回答1: One thing you could do is to use some

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,

Widgets are not shown in basic Qt application (QMainWindow)

独自空忆成欢 提交于 2019-12-06 07:08:15
问题 I am new to Qt and I am doing some practice with simple examples. I just wanted to test my knowledge with a simple application, by coding, in which user types a text in QLineEdit widget and the text will be shown in QLabel. There is no need for it to be useful. I just want to try. While compiling the application, I get no errors. However, QLabel and QLineEdit widgets are not visible when the window is opened. My codes are here: Window.h #ifndef WINDOW_H #define WINDOW_H #include <QMainWindow>

PyQt: Accesing Main Window's Data from a dialog?

╄→гoц情女王★ 提交于 2019-12-06 03:53:11
So, I'm using Python and PyQt. I have a Main Window that contains a QTableWidget, and a dialog that opens modally and has some QLineEdit widgets... All right so far, but I have 2 problems: When the dialog opens, my Main Window freezes, and I don't really like that... What I want, when I finish editing a QLineEdit, is that the program will search the QTableWidget, and if the text from the QLineEdit exists in the table, a dialog will come up and informe about that. That's the general idea. But, so far, I seem to only be able to create a new QTableWidget instance, and I can't use the data from

How to set QMainWindow as the modal one?

我怕爱的太早我们不能终老 提交于 2019-12-05 19:35:57
I am using QMainWindow for GUI development of my project..One problem I am Stuck with is blocking all other visible windows from getting input, while one is in operation. I can not use QDialog.Because rich features of QMainWindow is required. How can I declare a particular window as modal? I tried with QWidget::setWindowMOdality() . Here is a demo program, what I tried but it didnt work. #include <QApplication> #include <QMainWindow> #include <QPushButton> int main(int argc, char **argv){ QApplication a(argc, argv); QMainWindow *w1 = new QMainWindow(); w1->resize(500,800); w1->move(100,50); w1

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 =

active resizing of widgets inside mainwindow

早过忘川 提交于 2019-12-05 09:06:37
I have a few widgets in a main window. i want the user to be able to resize the widgets inside the window as they please, just like how one would resize the main window. Do I have to make a layout container to enable this? or ....layout? Buh the layout contains are static once the window is rendered. In the picture the three widgets should be enable with resizing such that the user can drag their sides/corners to expand or minimize the widget size. One thing you could do is to use some QSplitter 's though it isn't directly as nuanced as you pointed out. Have a look at the image (you can drag

How to resize QMainWindow after removing all DockWidgets?

◇◆丶佛笑我妖孽 提交于 2019-12-05 07:58:59
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, QMainWindow ’s geometry is set back to (0,0,800,24) with setGeometry() . What I want to achieve is to resize