I wouldn't say there is any right way to do it. Especially that in 90% of the cases native dialogs are used and not the dialog created by Qt.
I wouldn't say there is any right way to do it. Especially that in 90% of the cases native dialogs are used and not the dialog created by Qt.
ScabrusMantra (20th October 2009)
Is it possible to customize QFileDialog in the way that there is no way to leave a particular (specified) subdirectory? The reason is, I wouldn't like the user to choose the files from ANY directory but from the given ones.
Thanks in advance
I guess you could read this thread : http://www.qtcentre.org/threads/2817...ific-directory
Oh, thanks, I guess, this should work!!
Well, this works only partially. Namely, e.g. I wanna stay in the directory /tmp. And click to Up-icon in the QFileDialog window. This generates the signal directoryEntered(const QString), which I can catch up and move back to /tmp. However, the path "/" remains in the history. And then backButton from the QFileDialogPrivate can be used and does not generate the signal. In this way, I can traverse the entire /-tree.
Would appreciate any comments
P.S. clearing histroy also didn't help.
P.P.S changeEvent also doesn't react to back- and forward-buttons. However, it does work on go-up-button
Last edited by UrfinJuice; 22nd July 2011 at 09:59.
Ok, just to tell how I solved the problem:
In the file qfiledialog.cpp in functions
void QFileDialogPrivate::_q_navigateForward()
and
void QFileDialogPrivate::_q_navigateBackward()
after
q->setDirectory(nextHistory);
and
q->setDirectory(previousHistory);
I added
emit q->directoryEntered(nextHistory);
and
emit q->directoryEntered(previousHistory);
respectively.
Recompile -> runs
However, I'm not sure, if it's a bug or a feature
Bookmarks