19 #include <QApplication>
20 #include <QFileDialog>
21 #include <QHBoxLayout>
23 #include <QPushButton>
24 #include <QVBoxLayout>
29 m_FileMustExist(true),
30 m_SelectFile(new QPushButton(
"Select File")),
42 QBoxLayout *layout =
nullptr;
44 layout =
new QHBoxLayout;
46 layout =
new QVBoxLayout;
48 layout->setContentsMargins(0, 0, 0, 0);
52 this->setLayout(layout);
67 m_File->setReadOnly(ReadOnly);
72 QFileInfo
info(QString::fromStdString(file));
75 m_File->setText(QString::fromStdString(file));
93 return m_File->text().toStdString();
100 filename = QFileDialog::getExistingDirectory(QApplication::activeWindow(),
"Open directory",
m_File->text());
104 filename = QFileDialog::getOpenFileName(QApplication::activeWindow(),
"Open file",
m_File->text(),
m_FilePattern);
106 filename = QFileDialog::getSaveFileName(QApplication::activeWindow(),
"Open file",
m_File->text(),
m_FilePattern);
109 if (!filename.isEmpty())
110 m_File->setText(filename);
QPushButton * m_SelectFile
virtual void OnSelectFileClicked(bool)
virtual std::string GetFile() const
void NewFileSelected(const std::string &)
virtual void OnFileEditingFinished()
static void info(const char *fmt,...)
void SetFilePattern(const std::string &filepattern)
void SetReadOnly(bool ReadOnly)
static const std::string filename
QmitkFileChooser(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
void SetSelectDir(bool selectDir)
void SetFile(const std::string &file)
void SetFileMustExist(bool fileMustExist)
void SetHorizotalLayout(bool horizontalLayout)