qdialog

Resize QDialog at a runtime

瘦欲@ 提交于 2019-11-30 09:45:25
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 programmaticaly dialog to be smaller then it's current size (it only can become larger). At the same time, it is

Disable QDialogs default close button (upper left “cross button”)?

 ̄綄美尐妖づ 提交于 2019-11-30 05:58:19
问题 Is it possible to disable/delete the QDialogs default close button at the upper left of the dialog? 回答1: At least in (embedded) Linux, you can do this: setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); With that, I get a window which has the title but no buttons. 回答2: Clearing WindowCloseButtonHint in WindowFlags may do what you want. Check out the example here. 回答3: Use this function for your dialog dlgLobLobLob->setWindowFlags(Qt::Dialog | Qt::Desktop) 回答4: Try

What is the signal for when a widget loses focus?

不想你离开。 提交于 2019-11-30 05:48:23
In a dialog, when the tab key is pressed, the focus changes to another widget. In Qt, is there any signal for when a widget loses its focus? Can I use it to check if the input is valid or not? If not, can I set the focus back and ask the user to re-input? There's no signal but if you want to know when your widget has lost focus, override and reimplement void QWidget::focusOutEvent(QFocusEvent* event) in your widget. It will be called whenever your widget has lost focus. To give focus to a widget, use QWidget::setFocus(Qt::FocusReason) . To validate input in a QLineEdit or QComboBox you can

What is the signal for when a widget loses focus?

别来无恙 提交于 2019-11-29 05:00:18
问题 In a dialog, when the tab key is pressed, the focus changes to another widget. In Qt, is there any signal for when a widget loses its focus? Can I use it to check if the input is valid or not? If not, can I set the focus back and ask the user to re-input? 回答1: There's no signal but if you want to know when your widget has lost focus, override and reimplement void QWidget::focusOutEvent(QFocusEvent* event) in your widget. It will be called whenever your widget has lost focus. To give focus to

Non-resizeable QDialog with fixed size in Qt?

蓝咒 提交于 2019-11-28 17:08:46
I have a Qt dialog application. Now I dont want that dialog to be resizeable. I am not sure how to achieve this. I tried a bunch of things but still when the dialog launches this dialog can be resized. What is the property that i should set to disable the dialog/Widget resize. I also tried setSizePolicy(QSizePolicy::Fixed); But i get an error saying.. source\nimcac_settingsMain.cpp(36) : error C2248: **'QSizePolicy::QSizePolicy' : cannot access private member declared in class 'QSizePolicy'** p:\ThirdPartyExports\Qt\export\4.3\4.3.1f14\include\QtGui\../../src\gui\ kernel\qsizepolicy.h(177) :

How to fix error in my pyqt programm (first argument of unbound method must have type 'QDialog') ?

随声附和 提交于 2019-11-28 14:49:36
After typing 1, both as login and password, a new window should appear, but it gives an error. It used to work fine before I made some changes to code, and I don't know what exactly causes it. # -*- coding: utf-8 -*- from PyQt4 import QtGui, QtCore import sys app = QtGui.QApplication(sys.argv) login = QtGui.QDialog() login.setWindowTitle('login') login.resize(100, 100) login_form = QtGui.QFormLayout() row1 = QtGui.QHBoxLayout() user_input = QtGui.QLineEdit() row1.addWidget(user_input) login_form.addRow('user', row1) row2 = QtGui.QHBoxLayout() pwd_input = QtGui.QLineEdit() row2.addWidget(pwd

How do I auto-adjust the size of a QDialog depending on the text length of one of its children?

我怕爱的太早我们不能终老 提交于 2019-11-28 03:46:55
问题 I have a QDialog I'm working with. It is made somewhat like a QMessageBox . I noticed that the size of the QMessageBox (and the size of its label) depends on the size of the message displayed. How would I make the size of my QDialog adjust automatically like a QMessageBox ? Presently my QDialog contains a button box and a label, and the QDialog is layout Vertical. (I know I could just use the message box directly but eventually I will have more complex dialogs.) 回答1: Automatic solution: Use

PyQt: getting widgets to resize automatically in a QDialog

痴心易碎 提交于 2019-11-27 23:56:01
I'm having difficulty getting widgets in a QDialog resized automatically when the dialog itself is resized. In the following program, the textarea resizes automatically if you resize the main window. However, the textarea within the dialog stays the same size when the dialog is resized. Is there any way of making the textarea in the dialog resize automatically? I've tried using setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) on the dialog itself and the two widgets within, but that seems to have no effect. I'm using Qt version 3.3.7 and PyQt version 3.5.5-29 on openSuSE 10.2, if that's

Can you add a toolbar to QDialog?

亡梦爱人 提交于 2019-11-27 23:41:38
问题 I'm working on a project that needs to call a modal window with a toolbar to do some work on some data before it's loaded. The reason I need the toolbar is the user has a few different possible options that can be combined. The obvious choice here is a Modal dialog (which I have working right now). The issue is I want a toolbar. This is a two part question: Is it possible to add a toolbar to a QDialog ? (also is it possible to do this in Qt Designer?) If 1. is not possible, how can I make a

How can I hide/delete the “?” help button on the “title bar” of a Qt Dialog?

喜夏-厌秋 提交于 2019-11-27 13:23:43
I am using Qt Dialogs in one of my application. I need to hide/delete the help button. But i am not able to locate where exactly I get the handle to his help button. Not sure if its a particular flag on the Qt window. amos By default the Qt::WindowContextHelpButtonHint flag is added to dialogs. You can control this with the WindowFlags parameter to the dialog constructor. For instance you can specify only the TitleHint and SystemMenu flags by doing: QDialog *d = new QDialog(0, Qt::WindowSystemMenuHint | Qt::WindowTitleHint); d->exec(); If you add the Qt::WindowContextHelpButtonHint flag you