1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 * ModuleBase_WidgetFileSelector.h
6 * Created on: Aug 28, 2014
10 #ifndef MODULEBASE_WIDGETFILESELECTOR_H_
11 #define MODULEBASE_WIDGETFILESELECTOR_H_
13 #include <ModuleBase.h>
14 #include <ModuleBase_ModelWidget.h>
18 #include <QStringList>
25 * Implementation of model widget for open file widget.
26 * It can be defined as following:
29 * id="import_file_selector"
32 * <validator id="ExchangePlugin_ImportFormat" parameters="BREP:BREPImport,STEP:STEPImport" />
36 class MODULEBASE_EXPORT ModuleBase_WidgetFileSelector : public ModuleBase_ModelWidget
41 /// \param theParent the parent object
42 /// \param theData the widget configuation. The attribute of the model widget is obtained from
43 /// \param theParentId is Id of a parent of the current attribute
44 ModuleBase_WidgetFileSelector(QWidget* theParent,
45 const Config_WidgetAPI* theData,
46 const std::string& theParentId);
47 virtual ~ModuleBase_WidgetFileSelector();
49 virtual bool storeValue() const;
51 virtual bool restoreValue();
53 QWidget* getControl() const;
55 virtual QList<QWidget*> getControls() const;
57 /// Returns true if a file on the current path in the line edit
58 /// exists and has supported format
59 bool isCurrentPathValid();
62 /// Processing of path selection button press
63 void onPathSelectionBtn();
65 /// Processing of path changing
69 /// Returns string containing formats
70 QString formatsString() const;
72 /// Return list of validator formats
73 QStringList getValidatorFormats() const;
76 /// A control for path input
77 QLineEdit* myPathField;
80 QWidget* myMainWidget;
82 /// A title of open file dialog box
86 QString myDefaultPath;
89 #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */