我对QT很新,并且无法理解如何处理QTableView选择改变信号.我已经设置了一个带有openGL小部件和QTableView的窗口.我有一个正确填充tableview的数据模型类,所以我在该类中添加了一个公共插槽:
class APartsTableModel : public QAbstractTableModel
{
public:
AVehicleModel *vehicle;
explicit APartsTableModel(QObject *parent = 0);
//MVC functions
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &paret) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
public slots:
void selectionChangedSlot(const QItemSelection &newSelection,
const QItemSelection &oldSelection);
};
当我准备用表视图显示窗口时,我像这样分配/初始化它:
//create the display view
AStarModelView *displayWindow = new AStarModelView(this,
starModel->vehicle);
//