QCMakeWidgets.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef QCMakeWidgets_h
  14. #define QCMakeWidgets_h
  15. #include <QLineEdit>
  16. #include <QCompleter>
  17. class QToolButton;
  18. // common widgets for Qt based CMake
  19. /// Editor widget for editing paths or file paths
  20. class QCMakeFileEditor : public QLineEdit
  21. {
  22. Q_OBJECT
  23. public:
  24. QCMakeFileEditor(QWidget* p, const QString& var);
  25. protected slots:
  26. virtual void chooseFile() = 0;
  27. signals:
  28. void fileDialogExists(bool);
  29. protected:
  30. void resizeEvent(QResizeEvent* e);
  31. QToolButton* ToolButton;
  32. QString Variable;
  33. };
  34. /// editor widget for editing files
  35. class QCMakePathEditor : public QCMakeFileEditor
  36. {
  37. Q_OBJECT
  38. public:
  39. QCMakePathEditor(QWidget* p = NULL, const QString& var = QString());
  40. void chooseFile();
  41. };
  42. /// editor widget for editing paths
  43. class QCMakeFilePathEditor : public QCMakeFileEditor
  44. {
  45. Q_OBJECT
  46. public:
  47. QCMakeFilePathEditor(QWidget* p = NULL, const QString& var = QString());
  48. void chooseFile();
  49. };
  50. /// completer class that returns native cmake paths
  51. class QCMakeFileCompleter : public QCompleter
  52. {
  53. Q_OBJECT
  54. public:
  55. QCMakeFileCompleter(QObject* o, bool dirs);
  56. virtual QString pathFromIndex(const QModelIndex& idx) const;
  57. };
  58. #endif