| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 | /*=========================================================================  Program:   CMake - Cross-Platform Makefile Generator  Module:    $RCSfile$  Language:  C++  Date:      $Date$  Version:   $Revision$  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.     This software is distributed WITHOUT ANY WARRANTY; without even      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      PURPOSE.  See the above copyright notices for more information.=========================================================================*/#ifndef QCMakeCacheView_h#define QCMakeCacheView_h#include <QTableView>#include <QAbstractTableModel>#include <QCheckBox>#include <QLineEdit>#include <QItemDelegate>#include "QCMake.h"class QCMakeCacheModel;/// Qt view class for cache propertiesclass QCMakeCacheView : public QTableView{  Q_OBJECTpublic:  QCMakeCacheView(QWidget* p);  QCMakeCacheModel* cacheModel() const;protected:  QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers);  void showEvent(QShowEvent* e);  bool Init;};/// Qt model class for cache propertiesclass QCMakeCacheModel : public QAbstractTableModel{  Q_OBJECTpublic:  QCMakeCacheModel(QObject* parent);  ~QCMakeCacheModel();  enum { HelpRole = Qt::UserRole, TypeRole, AdvancedRole };public slots:  void setProperties(const QCMakeCachePropertyList& props);public:  // satisfy [pure] virtuals  int columnCount ( const QModelIndex & parent ) const;  QVariant data ( const QModelIndex & index, int role ) const;  QModelIndex parent ( const QModelIndex & index ) const;  int rowCount ( const QModelIndex & parent ) const;  QVariant headerData ( int section, Qt::Orientation orient, int role ) const;  Qt::ItemFlags flags ( const QModelIndex& index ) const;  bool setData ( const QModelIndex& index, const QVariant& value, int role );  // flag if a cache property has been modified  bool isDirty() const;  // get the properties  QCMakeCachePropertyList properties() const;protected:  QCMakeCachePropertyList Properties;  bool IsDirty;};/// Qt delegate class for interaction (or other customization) with cache propertiesclass QCMakeCacheModelDelegate : public QItemDelegate{  Q_OBJECTpublic:  QCMakeCacheModelDelegate(QObject* p);  /// create our own editors for cache properties  QWidget* createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const;};/// Editor widget for editing paths or file pathsclass QCMakeCachePathEditor : public QWidget{  Q_OBJECT  Q_PROPERTY(QString value READ value USER true)public:  QCMakeCachePathEditor(const QString& file, bool isFilePath, QWidget* p);  QString value() const { return this->LineEdit.text(); }protected slots:  void chooseFile();protected:  QLineEdit LineEdit;  bool IsFilePath;};#endif
 |