PDA

View Full Version : how to use SearchScanDiskDlgObj



jyoti
16th November 2006, 09:39
hi all
i had create mainwindow ..in tht i ve tree widget...withselection of any item one another form opened ...how it should come??
next is:when another form opened on tht particular form i ve lineedit n ok button..wid click of ok button again mainwindow form should be opened....n form's line edit text should be shown in mainwindow's second tree widget's item...how these two problems can be solved...????

plz do help me as soon as possible...

jacek
17th November 2006, 12:13
Read this: http://www.qtcentre.org/forum/f-newbie-4/t-show-or-hide-a-form-4471.html

If you use a modal dialog, you can retrieve the data using normal methods that just return contents of some widget from that dialog:

void SomeWindow::showDialog()
{
SomeDialog dlg( this );
if( dlg.exec() == QDialog::Accepted ) {
something = dlg.something();
someOtherThing = dlg.someOtherThing();
}
else {
// user has rejected the dialog
}
}

But if you want modeless dialogs, you have to use signals and slots mechanism (at least to notify the other window that it can read the data). Something like this (http://doc.trolltech.com/4.1/qdialog.html#return) connected with:
void EditorWindow::findNext()
{
QString keyword = findDialog->keyword();
// do something with keyword
}
Of course you can also use signals to pass the data. This way you could have something like this:
void EditorWindow::findNext( const QString& keyword )
{
// do something with keyword
}