qdialog

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

QDialog - How to remove the minimize button

寵の児 提交于 2019-12-05 22:07:23
Qt 4.8 based, application - Issue with QDialog, minimize button Windows and Gnome (linux) The modal dialog appears with the close button on the right top, and the minimize button is nonexistent . The minimize option are grayed out in every dialog. This makes sense, since the QDialog is modal - if you minimize it, the whole application will be blocked. But here comes the issue: in KDE (linux) the minimize-maximize button appears. It seems that this is a platform dependent feature - I am not quite sure on what do do. Any ideas...? (I tried already with a few windowsFlags but could not find the

Simple way to embed a QDialog into a QWidget

一曲冷凌霜 提交于 2019-12-05 19:35:25
I have been searching for a simple way to embed QDialog instances in a QWidget , but all I found used OpenGL or some rather complex stuff to achieve that. Actually, all the examples I found tried to achieve many more things than simply embed the QDialog . So, I am wondering: is there a simple and clean way to embed a QDialog in a QWidget ? P.S.: I tagged pyqt since it's what I'm using, but I will of course accept c++ answers :) Here is a screen capture of the piece of software I have to port and for which I kind of need such a feature. You should use QMdiArea . widget = QWidget() mdiarea =

Load QDialog directly from UI-File?

空扰寡人 提交于 2019-12-05 14:39:32
I work with QT Designer and create my GUIs with it. To launch the main program, I use this code: import sys from PyQt4 import uic, QtGui, QtCore from PyQt4.QtGui import * from PyQt4.QtCore import * try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) def main(): app = QtGui

QDialog not opening from Main window (pyQt)

不问归期 提交于 2019-12-05 14:08:39
I'm trying to launch a dialog by clicking a button in the main window: Here's the (qtdesigner generated) code which I modified just to test it .. I've set the showDial function to show the dial when the button is clicked. But it doesn't work : from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.setWindowModality(QtCore.Qt.WindowModal) Dialog.resize(400, 300) Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog",

How to make a dialog window always on the front at my application level

末鹿安然 提交于 2019-12-04 05:14:46
How can I make a Qt dialog window always on top at my application level? I want to make a dialog window always on the front but remember always on the front at my application level, even if I click on an empty place, I want to it stay on the front of my application only. I have tried to use setWindowFlags(Qt::WindowStaysOnTopHint) , but this makes the dialog window always on the top at the desktop level, but I want it to be on top at the my application level only. How can I do that? You can achieve this by giving the dialogs a parent. A child dialog always stays on top of its parent window. If

Qt - Disabling QDialog's “?” button

半世苍凉 提交于 2019-12-03 16:17:14
问题 I create an instance of QDialog and on the left of 'x' (close) button i have also '?' button. How I can disable that '?' ? 回答1: Change the window flags, for example in the constructor: this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); 回答2: From the Qt 4.6 QDialog documentation: QDialog::QDialog ( QWidget * parent = 0, Qt::WindowFlags f = 0 ) Constructs a dialog with parent parent . A dialog is always a top-level widget, but if it has a parent, its default location

How do I catch a pyqt closeEvent and minimize the dialog instead of exiting?

蓝咒 提交于 2019-12-03 13:30:55
I have a QDialog object. When the user clicks on the X button or presses Ctrl+Q , I want the dialog to go to a minimized view or system tray icon, instead of closing. How do I do that? A simple subclass that minimizes instead of closing is the following: class MyDialog(QtGui.QDialog): # ... def __init__(self, parent=None): super(MyDialog, self).__init__(parent) # when you want to destroy the dialog set this to True self._want_to_close = False def closeEvent(self, evnt): if self._want_to_close: super(MyDialog, self).closeEvent(evnt) else: evnt.ignore() self.setWindowState(QtCore.Qt

Qt - Disabling QDialog's “?” button

大憨熊 提交于 2019-12-03 04:49:02
I create an instance of QDialog and on the left of 'x' (close) button i have also '?' button. How I can disable that '?' ? Change the window flags, for example in the constructor: this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); Matias Valdenegro From the Qt 4.6 QDialog documentation: QDialog::QDialog ( QWidget * parent = 0, Qt::WindowFlags f = 0 ) Constructs a dialog with parent parent . A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent. It will also share the parent's taskbar entry. The widget

How can I disable Alt + F4 window closing using Qt?

99封情书 提交于 2019-12-02 20:53:33
I've disabled X button in Qt from my dialog using this line: myDialog->setWindowFlags(Qt::Dialog | Qt::Desktop) but I couldn't detect Alt + F4 using this code: void myClass::keyPressEvent(QKeyEvent *e) { if ((e->key()==Qt::Key_F4) && (e->modifiers()==Qt::AltModifier)) doSomething(); } what should I do to detect Alt + F4 or disable it in Qt? Pressing Alt+F4 results in a close event being sent to your top level window. In your window class, you can override closeEvent() to ignore it and prevent your application from closing. void MainWindow::closeEvent(QCloseEvent * event) { event->ignore(); }