OpenMS
gui/include/OpenMS/VISUAL/InputFile.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Chris Bielow $
6 // $Authors: Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // OpenMS_GUI config
12 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13 
14 #include <QWidget>
15 
16 namespace Ui
17 {
18  class InputFileTemplate;
19 }
20 
21 namespace OpenMS
22 {
29  class OPENMS_GUI_DLLAPI InputFile :
30  public QWidget
31  {
32  Q_OBJECT
33  public:
35  InputFile(QWidget* parent);
38 
40  void dragEnterEvent(QDragEnterEvent* e) override;
42  void dropEvent(QDropEvent* e) override;
43  void dragMoveEvent(QDragMoveEvent* pEvent) override;
44 
46  void setFilename(const QString& filename);
47 
49  QString getFilename() const;
50 
52  void setFileFormatFilter(const QString& fff);
53 
55  const QString& getCWD() const;
57  void setCWD(const QString& cwd, bool force = false);
58 
59  signals:
61  void updatedCWD(QString new_cwd);
63  void updatedFile(QString new_path);
64 
65  public slots:
66 
69 
70 
71  protected:
75  QString cwd_;
76 
77  private:
78  Ui::InputFileTemplate* ui_;
79  };
80 
81 }
A simple widget with a line-edit and a browse button to choose filenames.
Definition: gui/include/OpenMS/VISUAL/InputFile.h:31
InputFile(QWidget *parent)
Constructor.
void dropEvent(QDropEvent *e) override
support drag'n'drop of files from OS window manager
Ui::InputFileTemplate * ui_
Definition: gui/include/OpenMS/VISUAL/InputFile.h:78
void dragEnterEvent(QDragEnterEvent *e) override
support drag'n'drop of files from OS window manager
void setFileFormatFilter(const QString &fff)
Users can only choose certain filetypes, e.g. "Transition sqLite file (*.pqp)".
QString file_format_filter_
optional filter during file browsing
Definition: gui/include/OpenMS/VISUAL/InputFile.h:73
void updatedCWD(QString new_cwd)
emitted when a new file is added (by drag'n'drop or 'Browse' button)
void showFileDialog()
Lets the user select the file via a file dialog.
QString cwd_
the current working directory according to the last file added
Definition: gui/include/OpenMS/VISUAL/InputFile.h:75
const QString & getCWD() const
get the CWD (according to most recently added file)
~InputFile()
Destructor.
void setFilename(const QString &filename)
Sets the text in the line-edit.
void updatedFile(QString new_path)
emitted when a new file is added (by drag'n'drop or 'Browse' button)
void setCWD(const QString &cwd, bool force=false)
set the current working directory (for opening files). If the input is not empty, the cwd will not be...
void dragMoveEvent(QDragMoveEvent *pEvent) override
QString getFilename() const
Returns the filename currently set in the line-edit.
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Definition: FLASHDeconvWizardBase.h:37