qdialog

Derrived Widget not centered on parent when shown as dialog

余生长醉 提交于 2019-12-02 13:51:53
问题 I have a class MyListWidget derrived from QWidget. I passed parent and flags to the base class QWidget constructor (tried both Qt::Dialog and Qt::Popup in tests) but the custom widget is shown in the center of the screen instead centered to its parent. MyListWidget* myListWidget = new MyListWidget(this, Qt::Dialog); This is the constructor: MyListWidget::MyListWidget(QWidget* parent, Qt::WindowFlags flags) : QWidget(parent, flags), ui(std::auto_ptr<Ui::MyListWidget>(new Ui::MyListWidget)) {

How to get value from QDialog using multiple class

≡放荡痞女 提交于 2019-12-02 10:22:08
问题 I am currently working in a panel in Nuke 11 that opens a QDialog and I was wondering how to get a value from it into my main class when I close my QDialog ? The QDialog is in a different class. This is a simplified example that shows my problem : import nuke from nukescripts import panels try: ## < Nuke11 import PySide.QtGui as QtGui import PySide.QtCore as QtCore except: ## >= Nuke11 import PySide2.QtCore as QtCore import PySide2.QtGui as QtGui import PySide2.QtWidgets as QtGui from PySide2

How to get value from QDialog using multiple class

耗尽温柔 提交于 2019-12-02 05:24:07
I am currently working in a panel in Nuke 11 that opens a QDialog and I was wondering how to get a value from it into my main class when I close my QDialog ? The QDialog is in a different class. This is a simplified example that shows my problem : import nuke from nukescripts import panels try: ## < Nuke11 import PySide.QtGui as QtGui import PySide.QtCore as QtCore except: ## >= Nuke11 import PySide2.QtCore as QtCore import PySide2.QtGui as QtGui import PySide2.QtWidgets as QtGui from PySide2.QtWidgets import QWidget as QWidget class Example(QtGui.QWidget): def __init__(self): super(Example

Opening a QDialog and saving last state

断了今生、忘了曾经 提交于 2019-12-02 02:11:57
I am trying to open a QDialog from a QMainWindow , and after closing the `QDialog, if I need to open it again, it has to open and show the same information that had when I close it. Here is the code of the QMainWindow : class A (QMainWindow): def __init__(self): QMainWindow.__init__(self) #I create a QPushButton to open the QDialog self.axes1 = self.figure_canvas.figure.add_axes ([0.8, 0.01, 0.19, 0.05]) self.button = QPushButton(self.axes1,"Open Dialog") self.button.on_clicked(self.OpenDialog) #This is the method to open the QDialog which is in another module def OpenDialog(self, event): text

Can't add minimize button to QDialog under linux

柔情痞子 提交于 2019-12-02 02:03:43
问题 I'm trying to add a minimize button to my QDialog using this code in the constructor: Qt::WindowFlags flags = windowFlags(); flags |= Qt::WindowMinMaxButtonsHint; setWindowFlags(flags); It's working on Windows but not on Linux. 回答1: Its a late answer but could be useful to others, I had the same problem and fixed like so: Qt::WindowFlags flags = Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint; this->setWindowFlags(flags); inside the overridden

Can't add minimize button to QDialog under linux

微笑、不失礼 提交于 2019-12-02 01:37:08
I'm trying to add a minimize button to my QDialog using this code in the constructor: Qt::WindowFlags flags = windowFlags(); flags |= Qt::WindowMinMaxButtonsHint; setWindowFlags(flags); It's working on Windows but not on Linux. Its a late answer but could be useful to others, I had the same problem and fixed like so: Qt::WindowFlags flags = Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint; this->setWindowFlags(flags); inside the overridden dialog constructor. 来源: https://stackoverflow.com/questions/4699808/cant-add-minimize-button-to-qdialog

PyQt self.close() in __init__()

北战南征 提交于 2019-12-01 14:14:28
I encountered a few minor issues while working with PyQt4 under Python 2.7 I'm writing a little project where there are some QDialogs opening each other. So there is one Dialog I open and instantly open another Dialog to check something and when there is an error checking, i want the whole dialog to close. it looks like this: class MyDialog(QtGui.QDialog): def __init__(self): ## should get me a 10 digit number input text, ok = QtGui.QInputDialog.getText(self, u'Enter check') if ok: ## if clicked ok, assign tID tID = text else: ## else close self.close() try: ## checker is a plausibilty check

PyQt self.close() in __init__()

江枫思渺然 提交于 2019-12-01 14:03:09
问题 I encountered a few minor issues while working with PyQt4 under Python 2.7 I'm writing a little project where there are some QDialogs opening each other. So there is one Dialog I open and instantly open another Dialog to check something and when there is an error checking, i want the whole dialog to close. it looks like this: class MyDialog(QtGui.QDialog): def __init__(self): ## should get me a 10 digit number input text, ok = QtGui.QInputDialog.getText(self, u'Enter check') if ok: ## if

Qt: How to give focus to a modeless QDialog created from the main window when the main window is blocked by a modal QDialog

为君一笑 提交于 2019-12-01 08:49:49
In my Qt Application I'm facing the following scenario: When a specific event is raised I show a modeless QDialog which asks the user for a confirmation. The Dialog is showed using show() function from a QMainWindow . Anytime the event is raised and no other modal QDialog are shown, the user is able to click the confirmation button. Unfortunately if a modal QDialog is visible when the event is raised, the modeless QDialog is unaccessible. This means that the user cannot click the confirmation button. The following code is a simplified version that causes the same problem In this example the

Qt: How to give focus to a modeless QDialog created from the main window when the main window is blocked by a modal QDialog

孤人 提交于 2019-12-01 05:54:53
问题 In my Qt Application I'm facing the following scenario: When a specific event is raised I show a modeless QDialog which asks the user for a confirmation. The Dialog is showed using show() function from a QMainWindow . Anytime the event is raised and no other modal QDialog are shown, the user is able to click the confirmation button. Unfortunately if a modal QDialog is visible when the event is raised, the modeless QDialog is unaccessible. This means that the user cannot click the confirmation