Loading...
Searching...
No Matches
FileFormatDialog Class Reference

`#include <fileformatdialog.h>`

Inheritance diagram for FileFormatDialog:

## Public Types

typedef QPair< const Io::FileFormat *, QString > | FormatFilePair

## Static Public Member Functions

static FormatFilePair | fileToRead (QWidget *parent, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString())
| Show a QFileDialog to prompt the user for a file to open and resolve any file format conflicts. This method returns the selected file and FileFormat reader.
static FormatFilePair | fileToWrite (QWidget *parent, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString())
| Show a QFileDialog to prompt the user for a file to save and resolve any file format conflicts. This method returns the selected file and FileFormat writer.
static const Io::FileFormat * | findFileFormat (QWidget *parentWidget, const QString &caption, const QString &fileName, const Io::FileFormat::Operations formatFlags, const QString &formatPrefix=QString())
enum | FilterStringOption { NoFilterStringOption = 0x0 , AllFormats = 0x1 , AllFiles = 0x2 , WriteFormats = 0x4 }

## Detailed Description

<avogadro/qtgui/fileformatdialog.h>

Allow users to select save/open filenames that can be handled by registered FileFormats.

## Member Typedef Documentation

## FormatFilePair

typedef QPair<const Io::FileFormat*, QString> FormatFilePair

Container for a filename and a compatible file format, used as return values in static functions.

Note
  The FileFormat will be set to nullptr to indicate an error.
  The FileFormat points to the reference instance held by the FileFormatManager. Use FileFormat::newInstance() to create a usable copy.

## Member Enumeration Documentation

## FilterStringOption

enum FilterStringOption

Used internally by readFileFilter() and writeFileFilter().

## Member Function Documentation

## fileToRead()

FormatFilePair fileToRead | ( | QWidget * | parent,
|  | const QString & | caption = QString(),
|  | const QString & | dir = QString(),
|  | const QString & | filter = QString() )

static

Parameters

  parent | The parent of the dialog windows.
  caption | The dialog window titles.
  dir | The initial directory shown to the user.
  filter | A list of filters for limiting the files shown to the user. See the QFileDialog documentation for format. If the string is empty, a default list of all suitable registered formats will be used.

Returns
  A FormatFilePair object containing the absolute file path and a compatible file reader. If an error occurs, the format pointer will be nullptr.

## fileToWrite()

FormatFilePair fileToWrite | ( | QWidget * | parent,
|  | const QString & | caption = QString(),
|  | const QString & | dir = QString(),
|  | const QString & | filter = QString() )

static

Parameters

  parent | The parent of the dialog windows.
  caption | The dialog window titles.
  dir | The initial directory shown to the user.
  filter | A list of filters for limiting the files shown to the user. See the QFileDialog documentation for format. If the string is empty, a default list of all suitable registered formats will be used.

Returns
  A FormatFilePair object containing the absolute file path and a compatible file writer. If an error occurs, the format pointer will be nullptr.

## findFileFormat()

const Io::FileFormat * findFileFormat | ( | QWidget * | parentWidget,
|  | const QString & | caption,
|  | const QString & | fileName,
|  | const Io::FileFormat::Operations | formatFlags,
|  | const QString & | formatPrefix = QString() )

static

Given a filename and a set of Io::FileFormat::Operation flags, find a suitable file format from the FileFormatManager. If multiple readers are found, ask the user to select one. If no suitable format is found, return nullptr.

Parameters

  parentWidget | Parent for any dialog windows that will appear.
  caption | Window title for any dialog windows.
  fileName | Filename to use when searching for a format. Formats are chosen based on the file extension.
  formatFlags | Operations that the format must support. Most likely (Io::FileFormat::)Read | File or Write | File.
  formatPrefix | Filter on the supplied prefix (default to none).

Returns
  The selected matching reader, or nullptr if no reader is found.

The documentation for this class was generated from the following file:

- fileformatdialog.h