1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: QCMakeWidgets.h,v $
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
26 // common widgets for Qt based CMake
28 /// Editor widget for editing paths or file paths
29 class QCMakeFileEditor
: public QLineEdit
33 QCMakeFileEditor(QWidget
* p
, const QString
& var
);
35 virtual void chooseFile() = 0;
37 void fileDialogExists(bool);
39 void resizeEvent(QResizeEvent
* e
);
40 QToolButton
* ToolButton
;
44 /// editor widget for editing files
45 class QCMakePathEditor
: public QCMakeFileEditor
49 QCMakePathEditor(QWidget
* p
= NULL
, const QString
& var
= QString());
53 /// editor widget for editing paths
54 class QCMakeFilePathEditor
: public QCMakeFileEditor
58 QCMakeFilePathEditor(QWidget
* p
= NULL
, const QString
& var
= QString());
62 /// completer class that returns native cmake paths
63 class QCMakeFileCompleter
: public QCompleter
67 QCMakeFileCompleter(QObject
* o
, bool dirs
);
68 virtual QString
pathFromIndex(const QModelIndex
& idx
) const;
72 class QCMakeComboBox
: public QComboBox
75 Q_PROPERTY(QString value READ currentText WRITE setValue USER
true);
77 QCMakeComboBox(QWidget
* p
, QStringList strings
) : QComboBox(p
)
79 this->addItems(strings
);
81 void setValue(const QString
& v
)
83 int i
= this->findText(v
);
86 this->setCurrentIndex(i
);