Problem in the QFileDialog
Hai guys,
Version : Qt 3.3.4
Problem : Problem in the MODEL property of a QFileDialog
I have the following windows or objects in screen:-
1. MyMainWindow
2. MyWizard ( textBox, BrowseButton , CancelButton.. )
3. QFileDialog
The parent-child realation is setted in the same order as above.
While Applicaitons loads the following will be the senario.....
1. MyMainWindow comes
2. while clicking one menu , MyWizad comes with a BROWSE-BUTTON
3. While clicking on BROWSE-BUTTON , the below method <code> saveInputDataToFile ( const QString& inputName, const Q_ULLONG& inputSize, QWidget* parent ) </code> will be invoked to popup a QFileDilog
Code:
void MyMainWindow
:: saveInputDataToFile( const QString
& inputName,
const Q_ULLONG
& inputSize ,
QWidget* parent
) {
-------
// parent = MyWizard object
-------
}
My problem is that .....
1 .While showing the " QFileDialog ", if am clicking on the MyMainWindow ,
2. then the MyWizard's ( shows in between MyMainWindow and QFileDialog ) window highlighted , cursor will be in the wizard ( in a textBox near to BrowseButton )
3. and we can access BUTTONS using tab Key. Even we can CLOSE that Wizard using KEYBOARD, At the same time we can see the QFileDialog in the screen with out MyWizard
I want to restrict this KEYBORD access in MyWizard...please help me
Thank You.
Re: Problem in the QFileDialog
What is "parent" in the above code?
Re: Problem in the QFileDialog
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]
Re: Problem in the QFileDialog
getSaveFileName is a static method, please use it as one.
Re: Problem in the QFileDialog
i have tried this also
Code:
void MyMainWindow
:: saveInputDataToFile( const QString
& inputName,
const Q_ULLONG
& inputSize ,
QWidget* parent
) {
-------
-------
}
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...
1 Attachment(s)
Re: Problem in the QFileDialog
Are you sure "parent" is set to the wizard? Can you confirm that? (for example by using
Code:
parent->metaObject()->className()
Edit: The attached code works correctly for me (compile using qmake -project && qmake && make)
Re: Problem in the QFileDialog
You once again missed that it is related to Qt3
Re: Problem in the QFileDialog
I confirmed that , " QFileDialog's " parent is " QMyWizard " in run time.
I have debugged the code it shows ....
Code:
void MyMainWindow :: saveInputDataToFile( const QString& inputName,
const Q_ULLONG& inputSize ,
{
-------
const char * Name = parent->className();
// in run time the Name is MyWizard.
-------
}
I think i have to do some thing else ...
Thank you so much for sparing your time for me
1 Attachment(s)
Re: Problem in the QFileDialog
Quote:
Originally Posted by
sunil.thaha
You once again missed that it is related to Qt3
So? Does it matter? The code is practically the same and works the same, here - try it.
Re: Problem in the QFileDialog
Quote:
Originally Posted by
joseph
I think i have to do some thing else ...
Is the wizard a QDialog subclass (note that QWizard is QDialog subclass as well)?
Try the code I attached in the previous post, it should work for you. If it doesn't you'll know you have a buggy Qt installation. If it does, maybe it'll help you correct your code.
Re: Problem in the QFileDialog
Quote:
Originally Posted by
wysota
So? Does it matter? The code is practically the same and works the same, here - try it.
It does not matter to you or to me. But the question is does it matter to him ?
Re: Problem in the QFileDialog
Quote:
Originally Posted by
sunil.thaha
It does not matter to you or to me. But the question is does it matter to him ?
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.