qdialog

How do I prevent the enter key from closing my QDialog (Qt 4.8.1)

安稳与你 提交于 2019-12-21 07:20:09
问题 I have a QDialog with a QDialogButtonBox . The OK and Cancel buttons are active. Occasionally I disable or hide the OK button based on the state of my dialog. It seems, no matter what I do, the Enter key always activates the OK button. I really DON'T want this to happen. I have tried: Setting default and autoDefault properties to false every time I show/hide/enable/disable/whatever the button installing an event filter on the OK button to intercept key events (pressed and released) for return

How do I prevent the enter key from closing my QDialog (Qt 4.8.1)

感情迁移 提交于 2019-12-21 07:20:07
问题 I have a QDialog with a QDialogButtonBox . The OK and Cancel buttons are active. Occasionally I disable or hide the OK button based on the state of my dialog. It seems, no matter what I do, the Enter key always activates the OK button. I really DON'T want this to happen. I have tried: Setting default and autoDefault properties to false every time I show/hide/enable/disable/whatever the button installing an event filter on the OK button to intercept key events (pressed and released) for return

Fullscreen for QDialog from within MainWindow only working sometimes

时光怂恿深爱的人放手 提交于 2019-12-21 06:48:09
问题 (Testing with C++ on Qt 4.8 and Ubuntu 12.10 unity) I've got a main window which displays a QDialog. When I put the Dialog window full-screen it does not seem to always work even though it seems to be a proper window. Meaning, the window can appear full-screen, though only sometimes. Anyone got an idea? I know Qt states it might not work for all X environments, but it can't be that bad, can it? MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi

Resize QDialog at a runtime

左心房为你撑大大i 提交于 2019-12-18 13:34:19
问题 I have a QDialog subclass containing some options of my application. Some of the options are core, the other are advanced, so I decided to put them into separeted checkable QGroupBox. I want my dialog to shrink verticaly when the user checked off advanced options box, but I can't find the way to do it properly - the dialog size stays exactle the same I set dialog's size policy to Expanding , tried to call adjustSize() and tried to call resize() method - nothing helps. I can't resize

How to prevent member QWidgets or QDialog objects taking over key events from QMainWindow once the dialog has been clicked by the mouse?

泄露秘密 提交于 2019-12-13 03:44:29
问题 So I have QMainWindow type class which described by the following code: class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: void closeEvent(QCloseEvent *);\ DimensionDialog *newResolution; Ui::MainWindow *ui; ImageInteraction *liveVideo; ImageInteraction *modifiedVideo; CameraControl *cameraControl; QPushButton *pushToTalk; QPushButton *audioSettingsSetup; AudioSettings *audioSettings; QPushButton *numberOfRunningThreads;

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

你离开我真会死。 提交于 2019-12-12 08:45:00
问题 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? 回答1: You

Passing a variable to other dialog Qt

本小妞迷上赌 提交于 2019-12-11 07:40:51
问题 I have a QTreeView with a list of text files. If a file is selected and void FileList_dialog::on_openButton_released() it should pass a variable path to dialog textFile_dialog . Until now I've this: void FileList::on_openButton_released() { QModelIndex index = ui->treeView->currentIndex(); QFileSystemModel *model = (QFileSystemModel*)ui->treeView->model(); QString path = model->filePath(index); QString name = model->fileName(index); QString dir = path; QFile file(path); qDebug() << path;

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

流过昼夜 提交于 2019-12-09 11:28:38
问题 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? 回答1: 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

QDialog not opening from Main window (pyQt)

流过昼夜 提交于 2019-12-07 08:45:57
问题 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

QDialog exec() can not exit process

 ̄綄美尐妖づ 提交于 2019-12-06 15:53:05
int main(int argc, char *argv[]) { QApplication a(argc, argv); QDialog dlg; dlg.exec(); return a.exec(); } That's all my code, but when I close the window, The process isn't exit, it seems that drop in the loop a.exec() . Generally speaking, calling any exec is a bad idea, other than QCoreApplication::exec() or QDrag::exec() . The presence of exec() and waitForXxx() methods is an enticing trap for the unwary. Those methods are "easy" to use, but that ease comes at a price of hard to track bugs. Don't use them. You should simply show the dialog: int main(int argc, char *argv[]) { QApplication a