various improvements to speed up surface meshing of BRL-CAD geometries
[engrid.git] / src / libengrid / dialoglineedit.h
blob46cd77a563091e7dcba49cf52165722cc29ad5cf
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008-2013 enGits GmbH +
7 // + +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
12 // + +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
17 // + +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 //
23 #ifndef DIALOGLINEEDIT_H
24 #define DIALOGLINEEDIT_H
26 #include <QTime>
27 #include <QWidget>
28 #include <QtDesigner/QDesignerExportWidget>
29 #include <QLineEdit>
30 #include <QPushButton>
32 /// A QWidget with a QLineEdit and a small QPushButton.
33 /** It allows easy file or directory selection. The clicked() signal can also be used to call up a custom dialog instead. */
34 class
35 #ifndef WIN32
36 QDESIGNER_WIDGET_EXPORT
37 #endif
38 DialogLineEdit : public QWidget
40 Q_OBJECT
41 Q_PROPERTY(bool m_openfile READ getMode WRITE setMode)
42 Q_PROPERTY(bool m_UseFileDialog READ getUseFileDialog WRITE useFileDialog)
44 private:
45 QPushButton *m_button;///< The QPushButton
46 QLineEdit *m_lineedit;///< The QLineEdit
47 QString m_caption;///< The caption to use in the dialog
48 QString m_dir;///< The default directory to use in the dialog
49 QString m_filter;///< The filter to use in the dialog
50 bool m_openfile;///< if true a getOpenFileName dialog is used, otherwise a getExistingDirectory dialog is used.
51 bool m_UseFileDialog;///< if true a standard dialog is used, otherwise nothing happens (but the clicked() signal can be used to open a custom dialog)
53 private:
54 void build();///< builds the widget
55 //QString getDir(QString str);///< returns the path of the selected file or the selected path
57 public:
58 DialogLineEdit(QWidget *parent = 0);///< Default constructor
59 /** Constructor.
60 * @param openfile true = use open file dialog, false = use open directory dialog
61 * @param parent parent widget
63 DialogLineEdit(bool openfile, QWidget *parent = 0);
64 QString text();///< Get the text of the QLineEdit
65 void setText(QString str);///< set the text of the QLineEdit
67 public:
68 void setCaption(QString str);///< set the caption to use in the file dialog
69 void setDir(QString str);///< set the default directory to use in the file dialog
70 void setFilter(QString str);///< set the filter to use in the file dialog
71 QString getCaption();///< get the caption used in the file dialog
72 QString getDir();///< get the default directory used in the file dialog
73 QString getFilter();///< get the filter used in the file dialog
74 bool getMode();///< get the mode: true = use open file dialog, false = use open directory dialog
75 void setMode(bool mode);///< set the mode: true = use open file dialog, false = use open directory dialog
76 void useFileDialog(bool arg);///< set whether or not to use standard dialogs when the button is clicked
77 bool getUseFileDialog() {return m_UseFileDialog;}///< get whether or not to use standard dialogs when the button is clicked
79 private slots:
80 void openDialog();///< emit the clicked signal + open standard dialog if m_UseFileDialog is true
82 signals:
83 void clicked();///< This signal is emitted when the QPushButton is clicked
86 #endif