VR-Forces 4.0.4 Class Documentation
include/vrvCoreQt/DtCustomTreeWidgetEditor.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2008 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtCustomTreeWidgetEditor.h,v $ $Revision: 1.15 $ $State: Exp $
00007 ******************************************************************************/
00008 
00012 
00013 #ifndef DtCustomTreeWidgetEditor_H_
00014 #define DtCustomTreeWidgetEditor_H_
00015 
00016 #include <vrvCoreQt/vrvCoreQt.h>
00017 #include <QtCore/QObject>
00018 #include <QtCore/QStringList>
00019 #include <QtGui/QTreeWidgetItem>
00020 
00021 class QTreeWidgetItem;
00022 
00023 namespace makVrv
00024 {  
00025 
00026    class DtDe;
00027 
00030    class DT_DLL_VRVCOREQT DtCustomTreeWidgetEditor : public QObject
00031    {
00032    Q_OBJECT;
00033    public:
00034 
00035       enum EditorType
00036       {
00037          DefaultEditor = 0,
00038          LineEdit,
00039          ComboBox,
00040          FileName,
00041          Integer,
00042          FloatingPoint,
00043          TextBox
00044       };
00045 
00046       DtCustomTreeWidgetEditor(DtDe& de, QTreeWidgetItem* item,int index, QString value,
00047          EditorType type = LineEdit);
00048 
00049       virtual ~DtCustomTreeWidgetEditor();
00050 
00051       virtual void setComboBoxParameters(QStringList* possibleValues,bool noEditing = true);
00052 
00053       virtual void setValue( QString value );
00054 
00055       bool editing();
00056 
00057    public slots:      
00058 
00059       void edit();
00060       void commit();
00061       void updateValue( QString value );
00062 
00063       virtual void editAsTextBox();
00064       virtual void editAsLineEdit();
00065       virtual void editAsComboBox();
00066       virtual void editAsFileBrowser();
00067 
00068       /*
00069       virtual void editAsFileName();
00070       virtual void editAsInteger();
00071       virtual void editAsFloatingPoint();
00072       */
00073 
00074       virtual QString commitFromTextBox();
00075       virtual QString commitFromLineEdit();
00076       virtual QString commitFromComboBox();
00077       virtual QString commitFromFileBrowser();
00078      
00079    protected:
00080 
00081       virtual bool eventFilter(QObject *obj, QEvent *event);
00082 
00083    protected:
00084 
00085       DtDe& myDe;
00086       EditorType myType;
00087       QTreeWidgetItem* myItem;
00088       QString myInitialValue;
00089       int myIndex;
00090       QStringList* myComboBoxParameters;
00091       bool myComboBoxEditable;
00092 
00093    };
00094 
00097    class DT_DLL_VRVCOREQT DtCustomTreeWidgetItem : public QTreeWidgetItem
00098    {
00099 
00100    public:
00101 
00102       typedef std::map<int, DtCustomTreeWidgetEditor::EditorType> EditorTypeMap;
00103 
00104       DtCustomTreeWidgetItem(DtDe& de, QTreeWidget* parent, int type = QTreeWidgetItem::Type);
00105 
00106       virtual ~DtCustomTreeWidgetItem();
00107 
00108       virtual void setData(int column, int role, const QVariant &value);
00109       virtual void setColumnEditorType(int column, DtCustomTreeWidgetEditor::EditorType editorType);
00110 
00111       //May only be called after setText on the column.
00112       virtual void setComboBoxParameters(int column, QStringList* comboBoxParameters);
00113 
00114       void edit(int column);
00115 
00118       virtual bool operator<(const QTreeWidgetItem &other) const;
00119 
00120    protected:
00121 
00122       EditorTypeMap myEditorTypeMap;
00123       DtDe& myDe;
00124 
00125    };
00126 }
00127 
00128 #endif
00129 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)