QtiPlot  0.9.8.2
ExtensibleFileDialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ExtensibleFileDialog.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2007 by Knut Franke, Ion Vasilief
6  Email (use @ for *) : knut.franke*gmx.de, ion_vasilief*yahoo.fr
7  Description : QFileDialog plus generic extension support
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef EXTENSIBLE_FILE_DIALOG_H
30 #define EXTENSIBLE_FILE_DIALOG_H
31 
32 #include <QFileDialog>
33 #include <QPushButton>
34 
36 
44 class ExtensibleFileDialog : public QFileDialog
45 {
46  Q_OBJECT
47 
48  public:
50 
55  ExtensibleFileDialog(QWidget *parent=0, bool extended = true, Qt::WFlags flags=0);
57  void setExtensionWidget(QWidget *extension);
58 
60  bool isExtendable(){return d_extension != NULL;};
61  bool isExtended(){return d_extension_toggle->isChecked();};
63  void setExtended(bool extended);
65  void setExtentionToggleButtonText(const QString& text){d_extension_toggle->setText(text);};
67  void setEditableFilter(bool on = true);
68 
69  private slots:
70  void updateToggleButtonText(bool);
71 
72  protected:
74  QPushButton *d_extension_toggle;
75 
76  private:
78  QWidget *d_extension;
81 };
82 
83 #endif // ifndef EXTENSIBLE_FILE_DIALOG_H
QWidget * d_extension
The extension widget.
Definition: ExtensibleFileDialog.h:78
void setEditableFilter(bool on=true)
Enables/Disables editing of the file type filter.
Definition: ExtensibleFileDialog.cpp:89
bool isExtendable()
Tells weather the dialog has a valid extension widget.
Definition: ExtensibleFileDialog.h:60
void setExtensionWidget(QWidget *extension)
Set the extension widget to be displayed when the user presses the toggle button. ...
Definition: ExtensibleFileDialog.cpp:63
void setExtended(bool extended)
Toggle extension widget on/off.
Definition: ExtensibleFileDialog.cpp:119
void setExtentionToggleButtonText(const QString &text)
Sets the text to be displayed in the toggle button.
Definition: ExtensibleFileDialog.h:65
void updateToggleButtonText(bool)
Definition: ExtensibleFileDialog.cpp:109
bool isExtended()
Definition: ExtensibleFileDialog.h:61
QPushButton * d_extension_toggle
Button for toggling display of extension on/off.
Definition: ExtensibleFileDialog.h:74
QFileDialog plus generic extension support.
Definition: ExtensibleFileDialog.h:44
int d_extension_row
The layout row (of the assumed QGridLayout) used for extensions.
Definition: ExtensibleFileDialog.h:80
ExtensibleFileDialog(QWidget *parent=0, bool extended=true, Qt::WFlags flags=0)
Constructor.
Definition: ExtensibleFileDialog.cpp:37