Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: QT
Hi All,
I am using QFileDialog::getSaveFileName method to get a save dailog. It asks for new file name. When i give "abc:c" as a file name it pops up a message stating "The file name is invalid. But in case if i give file name as "abc?c" or "anc*c". It doesn't give any error. Though the dialog doesn't accept that input file name but it doesn't give any error.
Please let me know what can i do to get a error message in case of "abc?c" or "anc*c" as a file name.
Thanks in advance
Posted 27-Sep-12 22:06pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I would guess that is because the ? and * are used as wild-card indicators in filenames. You would need to test for them yourself.
sourabhmehta at 28-Sep-12 4:43am
Thanks for the reply.
I agree with your explanation, But how can i check for existence of ? or *. Since this QT widget itself takes care of other invalid characters. Moreover in case of ? or * characters the dialog doesn't return anything. Otherwise i would have checked for these characters in the returned string.
Do you have any idea how can i achieve this.
Richard MacCutchan at 28-Sep-12 5:06am
This is an issue with Windows, as I said above. I have just tried something similar using a simple Win32 program and the ? in the name just restricts the dialog to showing any names which match. The user must then select a specific name to get the dialog to proceed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 455
1 Sergey Alexandrovich Kryukov 312
2 DamithSL 179
3 King Fisher 179
4 Peter Leow 154
0 OriginalGriff 240
1 Maciej Los 95
2 Sascha Lefévre 85
3 King Fisher 70
4 F-ES Sitecore 55

Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100