1
/***************************************************************************
2
File : ExtensibleFileDialog.h
4
--------------------------------------------------------------------
5
Copyright : (C) 2007 by Knut Franke
6
Email (use @ for *) : knut.franke*gmx.de
7
Description : QFileDialog plus generic extension support
9
***************************************************************************/
11
/***************************************************************************
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. *
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. *
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 *
28
***************************************************************************/
29
#ifndef EXTENSIBLE_FILE_DIALOG_H
30
#define EXTENSIBLE_FILE_DIALOG_H
32
#include <QFileDialog>
33
#include <QPushButton>
35
//! QFileDialog plus generic extension support.
37
* This is a simple hack on top of QFileDialog that allows a custom extension widget to be added to
38
* the bottom of the dialog. A button is provided for toggling display of this widget on/off.
40
* For the placement of button and extension widget, it is assumed that QFileDialog uses a
41
* QGridLayout as its top-level layout. Other layouts will probably lead to a strange outlook,
42
* although the functionality should stay intact.
44
class ExtensibleFileDialog : public QFileDialog
51
* \param parent parent widget (only affects placement of the dialog)
52
* \param extended flag: show/hide the advanced options on start-up
53
* \param flags window flags
55
ExtensibleFileDialog(QWidget *parent=0, bool extended = true, Qt::WFlags flags=0);
56
//! Set the extension widget to be displayed when the user presses the toggle button.
57
void setExtensionWidget(QWidget *extension);
59
//! Tells weather the dialog has a valid extension widget
60
bool isExtendable(){return d_extension != NULL;};
61
bool isExtended(){return d_extension_toggle->isChecked();};
62
void setExtended(bool extended){ d_extension_toggle->setChecked(extended);};
65
//! Button for toggling display of extension on/off.
66
QPushButton *d_extension_toggle;
69
//! Resize to make/take space for the extension widget.
70
void resize(bool extension_on);
73
//! The extension widget
75
//! The layout row (of the assumed QGridLayout) used for extensions
79
#endif // ifndef EXTENSIBLE_FILE_DIALOG_H