读书人

QT Creator 怎么建槽

发布时间: 2012-09-19 13:43:54 作者: rapoo

QT Creator 如何建槽

本想继承一个槽,但是发现编译不过,只好新建一个槽,有些东西要设置,不过很简单

定义一个槽

Q_OBJECT//一定要加上public:    SelfDifineTree();    virtual ~SelfDifineTree();//Q_SIGNALS://    void expanded(const QModelIndex &index);public Q_SLOTS:    void itemclicked(const QModelIndex &index);
?

链接槽

?

SelfDifineTree::SelfDifineTree()    : QTreeView(){    qDebug()<<"create this file";;    QObject::connect(this,SIGNAL(clicked(QModelIndex)),this,SLOT(itemclicked(QModelIndex)));}void SelfDifineTree::itemclicked(const QModelIndex &index){    qDebug()<<"expanded~~";;    //this->QTreeView::expanded(&index);}

?设置编译器


QT Creator 怎么建槽

?

读书人网 >移动开发

热点推荐