Cute Chess  0.1
pathlineedit.h
1 /*
2  This file is part of Cute Chess.
3 
4  Cute Chess is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  Cute Chess is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef PATHLINEEDIT_H
19 #define PATHLINEEDIT_H
20 
21 #include <QLineEdit>
22 #include <QDir>
23 class QToolButton;
24 
25 class PathLineEdit : public QLineEdit
26 {
27  Q_OBJECT
28 
29  public:
30  enum PathType
31  {
32  FilePath,
33  FolderPath
34  };
35 
36  explicit PathLineEdit(PathType pathType, QWidget* parent = nullptr);
37 
38  void setDefaultDirectory(const QString& dir);
39 
40  protected:
41  virtual void resizeEvent(QResizeEvent* event);
42 
43  private slots:
44  void browse();
45 
46  private:
47  PathType m_pathType;
48  QToolButton* m_browseBtn;
49  QDir m_defaultDir;
50 };
51 
52 #endif // PATHLINEEDIT_H
Definition: pathlineedit.h:25