Click here to Skip to main content
13,089,246 members (65,491 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2017
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