Check whether a string is a valid filename with Qt

后端 未结 6 1508
一个人的身影
一个人的身影 2021-02-18 22:08

Is there a way with Qt 4.6 to check if a given QString is a valid filename (or directory name) on the current operating system ? I want to check for th

6条回答
  •  悲&欢浪女
    2021-02-18 22:53

    I'd just create a simple function to validate the filename for the platform, which just searches through the string for any invalid characters. Don't think there's a built-in function in Qt. You could use #ifdefs inside the function to determine what platform you're on. Clean enough I'd say.

提交回复
热议问题