Big Duck
9th June 2006, 17:59
Hi,
I have a treeview connected to a standardItemModel
I want to connect a click on an item do do something with current index.
treeView = new MyTreeView;
model = new QStandardItemModel(0,12);
treeView->setSelectionBehavior(QAbstractItemView::SelectRows );
treeView->setSelectionMode(QAbstractItemView::SingleSelectio n);
treeView->setEditTriggers(QAbstractItemView::NoEditTriggers) ;
treeView->setModel(model);
treeView->header()->setClickable(true);
connect(treeView, SIGNAL(clicked()), this, SLOT(doGameInfo()));
Ive got some rows in the model and I click on a row, nothing happens.
My connect should work should'nt it ?
I dont see why the index could be invalid so thats not the problem ?
public:
QTreeView *treeView;
private slots:
void doGameInfo();
I even tried sub classing QTreeView to re-code :
void clicked ( const QModelIndex & index );
but no luck, any pointers anyone ?
Thanks, Neil
I have a treeview connected to a standardItemModel
I want to connect a click on an item do do something with current index.
treeView = new MyTreeView;
model = new QStandardItemModel(0,12);
treeView->setSelectionBehavior(QAbstractItemView::SelectRows );
treeView->setSelectionMode(QAbstractItemView::SingleSelectio n);
treeView->setEditTriggers(QAbstractItemView::NoEditTriggers) ;
treeView->setModel(model);
treeView->header()->setClickable(true);
connect(treeView, SIGNAL(clicked()), this, SLOT(doGameInfo()));
Ive got some rows in the model and I click on a row, nothing happens.
My connect should work should'nt it ?
I dont see why the index could be invalid so thats not the problem ?
public:
QTreeView *treeView;
private slots:
void doGameInfo();
I even tried sub classing QTreeView to re-code :
void clicked ( const QModelIndex & index );
but no luck, any pointers anyone ?
Thanks, Neil