alizadeh91
17th February 2012, 08:51
Hi..
I have a subclass of QDeclarativeItem and i've use a QTableView. Then i've registered it into a qml file. I want to implement some event into this item. But it's won't works. I don't know why but apparently events in qml not working well.
How can it i do that? What's the problem?
here is sample code:
suppose i have a TableView class inherited from a QDeclarativeItem:
class TableView : public QDeclarativeItem
{
Q_OBJECT
public:
explicit TableView(QDeclarativeItem *parent = 0);
signals:
public slots:
private:
QStandardItemModel *model;
QTableView *table;
QGraphicsProxyWidget *proxy;
void virtual mousePressEvent(QGraphicsSceneMouseEvent *event);
};
And here is implementation:
void TableView::mousePressEvent(QGraphicsSceneMouseEven t *event)
{
QMessageBox::warning(0,"hi","hi");
}
And nothing happended when mouse pressed!!!
Thanks friends :)
I have a subclass of QDeclarativeItem and i've use a QTableView. Then i've registered it into a qml file. I want to implement some event into this item. But it's won't works. I don't know why but apparently events in qml not working well.
How can it i do that? What's the problem?
here is sample code:
suppose i have a TableView class inherited from a QDeclarativeItem:
class TableView : public QDeclarativeItem
{
Q_OBJECT
public:
explicit TableView(QDeclarativeItem *parent = 0);
signals:
public slots:
private:
QStandardItemModel *model;
QTableView *table;
QGraphicsProxyWidget *proxy;
void virtual mousePressEvent(QGraphicsSceneMouseEvent *event);
};
And here is implementation:
void TableView::mousePressEvent(QGraphicsSceneMouseEven t *event)
{
QMessageBox::warning(0,"hi","hi");
}
And nothing happended when mouse pressed!!!
Thanks friends :)