What is "parent" in the above code?
What is "parent" in the above code?
void MyMainWindow :: saveInputDataToFile( const QString& inputName, const Q_ULLONG& inputSize , QWidget* parent )
{
-------
// Parent = MyWizard ;
QFileDialog * obj = new QFileDialog ( parent , "", true ) ;
QString destFilePath = obj->getSaveFileName( QString::null, QString::Null, parent );
-------
}
[HTML]
This is the parent -child flow....
+--------------------------+
| MyMainWindow |
+----------^--------------+
|
+---------------------------+
| MyWizard |
+-----------^--------------+
|
+--------------------------+
| QFileDialog |
+--------------------------+
[/HTML]
getSaveFileName is a static method, please use it as one.
Qt Code:
To copy to clipboard, switch view to plain text mode
i have tried this also
Qt Code:
void MyMainWindow :: saveInputDataToFile( const QString& inputName, const Q_ULLONG& inputSize , QWidget* parent ) { ------- ------- }To copy to clipboard, switch view to plain text mode
But at this time also the keyboard is working in MyWizard ...and i can even close it by using TAB-KEY , without closing the FileDialog
please help me...
Last edited by wysota; 6th December 2006 at 11:11. Reason: Changed [html] into [code]
Are you sure "parent" is set to the wizard? Can you confirm that? (for example by usingQt Code:
parent->metaObject()->className()To copy to clipboard, switch view to plain text mode
Edit: The attached code works correctly for me (compile using qmake -project && qmake && make)
Last edited by wysota; 6th December 2006 at 11:09.
joseph (6th December 2006)
You once again missed that it is related to Qt3
We can't solve problems by using the same kind of thinking we used when we created them
The question was asked in "Qt programming" section, not in the "Newbie" section so I can assume that the person asking the question has some skills to modify the code so that it fits Qt3. The only changes required were modifying the includes and the file dialog line. Anyway, just to make things clear, I didn't use Qt4 code on purpose, I just didn't notice one was using Qt3.
I confirmed that , " QFileDialog's " parent is " QMyWizard " in run time.
I have debugged the code it shows ....
Qt Code:
void MyMainWindow :: saveInputDataToFile( const QString& inputName, const Q_ULLONG& inputSize , { ------- const char * Name = parent->className(); // in run time the Name is MyWizard. ------- }To copy to clipboard, switch view to plain text mode
I think i have to do some thing else ...
Thank you so much for sparing your time for me
Last edited by jacek; 6th December 2006 at 19:48. Reason: changed [html] to [code]
Bookmarks