qt - QDialog doesn't accept text input if modal -
A strange bug with a Q dialog (Qt4.6 / windows)
if starting with a dialog The main window (from a toolbar / or menu action) and this model is any boxes of text will not accept any edits. Other controls (drop down, buttons, etc.) All work
If I make the dialog (non-modal) with exec () instead of showing (), then it works perfectly!
Anyone comes in anything like this?
> Example Code:
# Include "ui_testDlg.h" class TestDlg: public QDialog, public Ui :: TestDlg {Q_OBJECT; Public: TestDL (QWidget * parent = 0) {setupUi (this); } ~ TestDlg (zero) {} Private: Ui :: TestDlg UI; };
TestDlg.ui is the simplest dialog box + LineAdit control created in QDesigner
Zero Main Window :: Only () {TestDlg * test = New TestDlg (this); Test & gt; Show (); // works // or test- & gt; Exec (); // dlg opens but can not type in! } Edit: If I just use a QInputWidget - this is the same problem - and this is only a problem in the main window, so do I have some hints for blocking / consuming should be there?
You can change the relationship between TestDlg and Ui:: Private client to testdl from sub-closing Include # "ui_testdlg.h" class TestDlg: Public QDialog {Q_OBJECT Public: TestDlg (QWidget * parent = 0): QDialog (UI), UI (new UI :: TESTDLG) ( UI- & gt; Setup UI (this);} ~ TestDlg () {Delete UI;} Personal: Ui :: TestDlg * ui;};
QtCreator this way and this setup Together with the new widget classes default I had no problem with QLineEdit
(Qt 4.6 on WinXP)
Comments
Post a Comment