Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / QtDialog / QCMakeWidgets.h
blobc5527c15887dfc1dd632ef9c077c33f227f7c979
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: QCMakeWidgets.h,v $
5 Language: C++
6 Date: $Date: 2009-03-12 15:19:27 $
7 Version: $Revision: 1.2 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
18 #ifndef QCMakeWidgets_h
19 #define QCMakeWidgets_h
21 #include <QLineEdit>
22 #include <QComboBox>
23 #include <QCompleter>
24 class QToolButton;
26 // common widgets for Qt based CMake
28 /// Editor widget for editing paths or file paths
29 class QCMakeFileEditor : public QLineEdit
31 Q_OBJECT
32 public:
33 QCMakeFileEditor(QWidget* p, const QString& var);
34 protected slots:
35 virtual void chooseFile() = 0;
36 signals:
37 void fileDialogExists(bool);
38 protected:
39 void resizeEvent(QResizeEvent* e);
40 QToolButton* ToolButton;
41 QString Variable;
44 /// editor widget for editing files
45 class QCMakePathEditor : public QCMakeFileEditor
47 Q_OBJECT
48 public:
49 QCMakePathEditor(QWidget* p = NULL, const QString& var = QString());
50 void chooseFile();
53 /// editor widget for editing paths
54 class QCMakeFilePathEditor : public QCMakeFileEditor
56 Q_OBJECT
57 public:
58 QCMakeFilePathEditor(QWidget* p = NULL, const QString& var = QString());
59 void chooseFile();
62 /// completer class that returns native cmake paths
63 class QCMakeFileCompleter : public QCompleter
65 Q_OBJECT
66 public:
67 QCMakeFileCompleter(QObject* o, bool dirs);
68 virtual QString pathFromIndex(const QModelIndex& idx) const;
71 // editor for strings
72 class QCMakeComboBox : public QComboBox
74 Q_OBJECT
75 Q_PROPERTY(QString value READ currentText WRITE setValue USER true);
76 public:
77 QCMakeComboBox(QWidget* p, QStringList strings) : QComboBox(p)
79 this->addItems(strings);
81 void setValue(const QString& v)
83 int i = this->findText(v);
84 if(i != -1)
86 this->setCurrentIndex(i);
91 #endif