git-svn-id: svn://db.shs.com.ru/libs@157 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
80
qad_blockview/blockeditor.h
Normal file
80
qad_blockview/blockeditor.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#ifndef BLOCKEDITOR_H
|
||||
#define BLOCKEDITOR_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QStyledItemDelegate>
|
||||
#include "blockitem.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class BlockEditor;
|
||||
}
|
||||
|
||||
|
||||
class BlockEditor : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BlockEditor(QWidget *parent = 0);
|
||||
~BlockEditor();
|
||||
|
||||
|
||||
public slots:
|
||||
void loadModel(const QByteArray & model);
|
||||
QByteArray saveModel();
|
||||
|
||||
private slots:
|
||||
void selectionChanged();
|
||||
void addItem(QGraphicsItem * item);
|
||||
void updateBlock();
|
||||
void treePinsClear();
|
||||
void arrangePins();
|
||||
void on_actionRemove_items_triggered();
|
||||
void on_buttonSave_clicked();
|
||||
void on_buttonLoad_clicked();
|
||||
void on_buttonClear_clicked();
|
||||
void on_buttonPinAdd_clicked();
|
||||
void on_buttonPinDup_clicked();
|
||||
void on_buttonPinDelete_clicked();
|
||||
void on_buttonPinClear_clicked();
|
||||
void on_treePins_itemChanged(QTreeWidgetItem *item, int column);
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject * o, QEvent * e);
|
||||
|
||||
Ui::BlockEditor *ui;
|
||||
QMap<int, QTreeWidgetItem*> pin_tli;
|
||||
BlockItem block;
|
||||
QString cur_file;
|
||||
bool init;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class PinAlignDelegate: public QStyledItemDelegate {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PinAlignDelegate(QObject * parent = 0): QStyledItemDelegate(parent) {}
|
||||
QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
||||
QString displayText(const QVariant & value, const QLocale & locale) const;
|
||||
void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const {return QSize(60, 26);}
|
||||
};
|
||||
|
||||
|
||||
class PinBusDelegate: public QStyledItemDelegate {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PinBusDelegate(QObject * parent = 0): QStyledItemDelegate(parent) {}
|
||||
QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
||||
QString displayText(const QVariant & value, const QLocale & locale) const;
|
||||
void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const {return QSize(60, 26);}
|
||||
private:
|
||||
typedef QPair<int, QString> ISPair;
|
||||
QVector<ISPair> buses;
|
||||
};
|
||||
|
||||
#endif // BLOCKEDITOR_H
|
||||
Reference in New Issue
Block a user