00001
00002
00003
00004
00005
00006
00007
00008 #ifndef TABLETREE_H
00009 #define TABLETREE_H
00010
00011 #include <QTreeWidget>
00012
00013
00018 class TableTree : public QTreeWidget
00019 {
00020 Q_OBJECT
00021 public:
00022 static const int TablesItemType = QTreeWidgetItem::UserType;
00023 static const int ViewsItemType = QTreeWidgetItem::UserType + 1;
00024 static const int TableType = QTreeWidgetItem::UserType + 2;
00025 static const int ViewType = QTreeWidgetItem::UserType + 3;
00026 static const int IndexesItemType = QTreeWidgetItem::UserType + 4;
00027 static const int IndexType = QTreeWidgetItem::UserType + 5;
00028 static const int TriggersItemType = QTreeWidgetItem::UserType + 6;
00029 static const int TriggerType = QTreeWidgetItem::UserType + 7;
00030 static const int SystemItemType = QTreeWidgetItem::UserType + 8;
00031 static const int SystemType = QTreeWidgetItem::UserType + 9;
00032 static const int DatabaseItemType = QTreeWidgetItem::UserType + 10;
00033 static const int SysIndexesItemType = QTreeWidgetItem::UserType + 11;
00034 static const int SysIndexType = QTreeWidgetItem::UserType + 12;
00035 static const int ColumnType = QTreeWidgetItem::UserType + 13;
00036 static const int ColumnItemType = QTreeWidgetItem::UserType + 14;
00037
00038 TableTree(QWidget * parent = 0);
00039 ~TableTree(){};
00040
00041 void buildDatabase(QTreeWidgetItem * dbItem, const QString & schema);
00042 void buildDatabase(const QString & schema);
00043 void buildTables(QTreeWidgetItem * tablesItem, const QString & schema);
00044 void buildIndexes(QTreeWidgetItem *indexesItem, const QString & schema, const QString & table);
00045 void buildColumns(QTreeWidgetItem * columnsItem, const QString & schema, const QString & table);
00046 void buildSysIndexes(QTreeWidgetItem *indexesItem, const QString & schema, const QString & table);
00047 void buildTriggers(QTreeWidgetItem *triggersItem, const QString & schema, const QString & table);
00048 void buildViews(QTreeWidgetItem * viewsItem, const QString & schema);
00049 void buildCatalogue(QTreeWidgetItem * systemItem, const QString & schema);
00050
00051 QString trDatabase;
00052 QString trTables;
00053 QString trIndexes;
00054 QString trSysIndexes;
00055 QString trViews;
00056 QString trTriggers;
00057 QString trSys;
00058 QString trCols;
00059
00060 QList<QTreeWidgetItem*> searchMask(const QString & trStr);
00061
00062 public slots:
00063 void buildTree();
00064 void buildViewTree(QString schema, QString name);
00065
00066 private:
00067 void deleteChildren(QTreeWidgetItem * item);
00068 QString trLabel(const QString & trStr);
00069
00070 QPoint m_dragStartPosition;
00071
00072 void mousePressEvent(QMouseEvent *event);
00073 void mouseMoveEvent(QMouseEvent *event);
00074 };
00075
00076 #endif