itom 2.0.0
D:/git-itom/sources/itom/Qitom/ui/widgetPropFigurePlugins.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2013, Institut für Technische Optik (ITO),
00005     Universität Stuttgart, Germany
00006 
00007     This file is part of itom.
00008   
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013 
00014     itom is distributed in the hope that it will be useful, but
00015     WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00017     General Public Licence for more details.
00018 
00019     You should have received a copy of the GNU Library General Public License
00020     along with itom. If not, see <http://www.gnu.org/licenses/>.
00021 *********************************************************************** */
00022 
00023 #ifndef WIDGETPROPFIGUREPLUGINS_H
00024 #define WIDGETPROPFIGUREPLUGINS_H
00025 
00026 #include "abstractPropertyPageWidget.h"
00027 
00028 #include <QtGui>
00029 #include <qstandarditemmodel.h>
00030 #include <qitemdelegate.h>
00031 
00032 #include "../organizer/designerWidgetOrganizer.h"
00033 
00034 #include "ui_widgetPropFigurePlugins.h"
00035 
00036 namespace ito
00037 {
00038 
00039 class FigurePluginDelegate; //forward declaration
00040 
00041 class WidgetPropFigurePlugins: public AbstractPropertyPageWidget
00042 {
00043     Q_OBJECT
00044 
00045 public:
00046     WidgetPropFigurePlugins(QWidget *parent = NULL);
00047     ~WidgetPropFigurePlugins();
00048 
00049     void readSettings();
00050     void writeSettings();
00051 
00052 protected:
00053     void init();
00054 
00055 private:
00056     Ui::WidgetPropFigurePlugins ui;
00057     
00058     QStandardItemModel *m_loadedFiguresModel;
00059     QStandardItemModel *m_figureCategoryModel;
00060     FigurePluginDelegate *m_delegate;
00061 
00062 signals:
00063 
00064 public slots:
00065     void on_btnResetDefaultFigures_clicked();
00066 
00067 private slots:
00068 
00069 };
00070 
00071 
00072 class FigurePluginDelegate : public QItemDelegate
00073 {
00074     Q_OBJECT
00075 public:
00076     FigurePluginDelegate(QObject *parent = 0);
00077 
00078     void append(int rowIndex, const FigureCategory &figureCategory);
00079     
00080     QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
00081 
00082      void setEditorData(QWidget *editor, const QModelIndex &index) const;
00083      void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
00084 
00085      void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
00086 
00087 private:
00088     QMap<int, FigureCategory> m_figureCategories;
00089     QMap<int, QStringList> m_possibleClassNames;
00090 
00091 
00092 };
00093 
00094 
00095 } //end namespace ito
00096 
00097 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends