Parent window is frozen after workspace filled with a child form.
Dear my friends... I am using QT Designer from SuSE 9.1 to create a database application. I made it to load a child (QDialog, custbaruForm) form into a parent form (MDI Window, depanForm). But after the child form displayed, the parent window is frozen. I can not do anything on the application. I close the application with xkill. Could anybody so nice to tell the solution? ===== patrixlinux@patrix:~/arsip/proyek/qt/kv> cat main.cpp #include <qapplication.h> #include "depanform.h" int main( int argc, char ** argv ) { QApplication a( argc, argv ); depanForm w; a.setMainWidget(&w); w.showMaximized(); a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); return a.exec(); } patrixlinux@patrix:~/arsip/proyek/qt/kv> cat depanform.h /**************************************************************************** ** Form interface generated from reading ui file 'depanform.ui' ** ** Created: Tue Jun 29 18:49:48 2004 ** by: The User Interface Compiler ($Id: qt/main.cpp 3.3.1 edited Nov 24 13:47 $) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #ifndef DEPANFORM_H #define DEPANFORM_H #include <qvariant.h> #include <qmainwindow.h> #include "qworkspace.h" #include "custbaruform.h" class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QSpacerItem; class QAction; class QActionGroup; class QToolBar; class QPopupMenu; class depanForm : public QMainWindow { Q_OBJECT public: depanForm( QWidget* parent = 0, const char* name = 0, WFlags fl = WType_TopLevel ); ~depanForm(); QMenuBar *MenuBar; QPopupMenu *Kunden; QPopupMenu *helpMenu; QToolBar *toolBar; QAction* helpContentsAction; QAction* helpIndexAction; QAction* helpAboutAction; QAction* kundenNeue_KundenAction; QWorkspace * workspace; QCloseEvent * event; public slots: virtual void helpIndex(); virtual void helpContents(); virtual void helpAbout(); void init(); void closeEvent(); protected: protected slots: virtual void languageChange(); private: custbaruForm * mycustbaruForm; private slots: void custbaruformSlot(); }; #endif // DEPANFORM_H patrixlinux@patrix:~/arsip/proyek/qt/kv> cat depanform.ui.h /**************************************************************************** ** ui.h extension file, included from the uic-generated form implementation. ** ** If you wish to add, delete or rename functions or slots use ** Qt Designer which will update this file, preserving your code. Create an ** init() function in place of a constructor, and a destroy() function in ** place of a destructor. *****************************************************************************/ #include "custbaruform.h" void depanForm::helpIndex() { } void depanForm::helpContents() { } void depanForm::helpAbout() { } void depanForm::init() { workspace = new QWorkspace(this); workspace->setScrollBarsEnabled(true); setCentralWidget(workspace); } void depanForm::custbaruformSlot() { custbaruForm * mycustbaruForm = new custbaruForm(workspace, 0, WDestructiveClose); mycustbaruForm->setModal(true); mycustbaruForm->show(); } void depanForm::closeEvent() { workspace->closeAllWindows(); } patrixlinux@patrix:~/arsip/proyek/qt/kv> cat depanform.cpp /**************************************************************************** ** Form implementation generated from reading ui file 'depanform.ui' ** ** Created: Tue Jun 29 18:49:54 2004 ** by: The User Interface Compiler ($Id: qt/main.cpp 3.3.1 edited Nov 24 13:47 $) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "depanform.h" #include <qvariant.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qaction.h> #include <qmenubar.h> #include <qpopupmenu.h> #include <qtoolbar.h> #include <qimage.h> #include <qpixmap.h> #include "depanform.ui.h" /* * Constructs a depanForm as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * */ depanForm::depanForm( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { (void)statusBar(); if ( !name ) setName( "depanForm" ); // actions helpContentsAction = new QAction( this, "helpContentsAction" ); helpIndexAction = new QAction( this, "helpIndexAction" ); helpAboutAction = new QAction( this, "helpAboutAction" ); kundenNeue_KundenAction = new QAction( this, "kundenNeue_KundenAction" ); // toolbars toolBar = new QToolBar( QString(""), this, DockTop ); helpContentsAction->addTo( toolBar ); helpIndexAction->addTo( toolBar ); helpAboutAction->addTo( toolBar ); // menubar MenuBar = new QMenuBar( this, "MenuBar" ); Kunden = new QPopupMenu( this ); kundenNeue_KundenAction->addTo( Kunden ); MenuBar->insertItem( QString(""), Kunden, 1 ); helpMenu = new QPopupMenu( this ); helpContentsAction->addTo( helpMenu ); helpIndexAction->addTo( helpMenu ); helpMenu->insertSeparator(); helpAboutAction->addTo( helpMenu ); MenuBar->insertItem( QString(""), helpMenu, 2 ); languageChange(); resize( QSize(600, 480).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); // signals and slots connections connect( helpIndexAction, SIGNAL( activated() ), this, SLOT( helpIndex() ) ); connect( helpContentsAction, SIGNAL( activated() ), this, SLOT( helpContents() ) ); connect( helpAboutAction, SIGNAL( activated() ), this, SLOT( helpAbout() ) ); connect( kundenNeue_KundenAction, SIGNAL( activated() ), this, SLOT( custbaruformSlot() ) ); init(); } /* * Destroys the object and frees any allocated resources */ depanForm::~depanForm() { // no need to delete child widgets, Qt does it all for us } /* * Sets the strings of the subwidgets using the current * language. */ void depanForm::languageChange() { setCaption( tr( "Kundenverwaltung bei LAM AG" ) ); helpContentsAction->setText( tr( "Contents" ) ); helpContentsAction->setMenuText( tr( "&Contents..." ) ); helpContentsAction->setAccel( QString::null ); helpIndexAction->setText( tr( "Index" ) ); helpIndexAction->setMenuText( tr( "&Index..." ) ); helpIndexAction->setAccel( QString::null ); helpAboutAction->setText( tr( "About" ) ); helpAboutAction->setMenuText( tr( "&About" ) ); helpAboutAction->setAccel( QString::null ); kundenNeue_KundenAction->setText( tr( "&Neue Kunden" ) ); kundenNeue_KundenAction->setMenuText( tr( "&Neue Kunden" ) ); toolBar->setLabel( tr( "Tools" ) ); if (MenuBar->findItem(1)) MenuBar->findItem(1)->setText( tr( "&Kunden" ) ); if (MenuBar->findItem(2)) MenuBar->findItem(2)->setText( tr( "&Help" ) ); } patrixlinux@patrix:~/arsip/proyek/qt/kv> __________________________________ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail
participants (1)
-
Prabu Subroto