QFileDialog > look In as editable entry
-
Hi
You can use
dialog->selectFile("myFileName");To give it a default name for saving.
-
Hi
For me QFileDialog looks like this
![alt text]( image url)and I can just paste a new path on top if i want.
But when you say copy and paste.. do you then mean from code and not like a user ?
-
@mrjj Hey Oh may, yeah my bad!! I should have tested it more before posting... I'm using
saveWidget->setOption(QFileDialog::DontUseNativeDialog, true);
The Qt one just has it as non editable combo box :- (((
Copy paste, I mean in ur
C:\wa\qthttpserver\
to be able to type in there/copy/paste/go to other link etc etc. -
@Dariusz
Hi sorry. It sailed away.
We can always get hold of the live widget via findChildren
and try to set its property to editable. however, it might not work
as you expect as nothing will expect "edit" signals to come from it so not sure it will respond to you pasting stuff there but its worth a shot :) -
@mrjj
I can confirm that it doesn't work. Just tried that. :)
But we can also handle the signals since we are already cheating.QComboBox *combo = saveWidget->findChild<QComboBox*>("lookInCombo", Qt::FindDirectChildrenOnly); combo->setEditable(true); QLineEdit *edit = combo->lineEdit(); connect(edit, &QLineEdit::returnPressed, saveWidget, [=](){ QString newPath = edit->text(); //TODO: verify the text is a valid path or not saveWidget->setDirectory(newPath); });