Class FileNameHandler#
Inherits the following classes: QObject
Public Static Attributes#
Type | Name |
---|---|
const int | MAX_CHARACTERS = = 70 |
Public Functions#
Type | Name |
---|---|
FileNameHandler (QObject * parent=nullptr) |
|
QString | parseFilename (const QString & name) |
QString | parsedPattern () |
QString | properScreenshotPath (QString filename, const QString & format=QString()) Generate a valid destination path from the possibly incomplete path . The inputpath can be one of: |
Public Static Attributes Documentation#
variable MAX_CHARACTERS#
const int FileNameHandler::MAX_CHARACTERS;
Public Functions Documentation#
function FileNameHandler#
explicit FileNameHandler::FileNameHandler (
QObject * parent=nullptr
)
function parseFilename#
QString FileNameHandler::parseFilename (
const QString & name
)
function parsedPattern#
QString FileNameHandler::parsedPattern ()
function properScreenshotPath#
Generate a valid destination path from the possibly incomplete path
. The inputpath
can be one of:
QString FileNameHandler::properScreenshotPath (
QString filename,
const QString & format=QString()
)
- empty string
- an existing directory
- a file in an existing directory In each case, the output path will be an absolute path to a file with a suffix matching the specified
format
.
Note:
- If
path
points to a directory, the file name will be generated from the formatted file name from the user configuration - If
path
points to a file, its suffix will be changed to matchformat
- If
format
is not given, the suffix will remain untouched, unlesspath
has no suffix, in which case it will be given the "png" suffix - If the path generated by the previous steps points to an existing file, "_NUM" will be appended to its base name, where NUM is the first available number that produces a non-existent path (starting from 1).
Parameters:
path
Possibly incomplete file name to transformformat
Desired output file suffix (excluding an initial '.' character)