Click here to Skip to main content
11,710,423 members (81,765 online)
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 21: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 Sergey Alexandrovich Kryukov 549
1 OriginalGriff 255
2 Peter Leow 174
3 Abhinav S 110
4 Suvendu Shekhar Giri 90
0 Abhinav S 60
1 Member 4653839 40
2 barneyman 35
3 Sergey Alexandrovich Kryukov 35
4 Member 11793820 35

Advertise | Privacy | Mobile
Web04 | 2.8.150819.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