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;
treeView->setModel(model);
treeView->header()->setClickable(true);
connect(treeView, SIGNAL(clicked()), this, SLOT(doGameInfo()));
treeView = new MyTreeView;
model = new QStandardItemModel(0,12);
treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
treeView->setSelectionMode(QAbstractItemView::SingleSelection);
treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
treeView->setModel(model);
treeView->header()->setClickable(true);
connect(treeView, SIGNAL(clicked()), this, SLOT(doGameInfo()));
To copy to clipboard, switch view to plain text mode
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:
private slots:
void doGameInfo();
public:
QTreeView *treeView;
private slots:
void doGameInfo();
To copy to clipboard, switch view to plain text mode
I even tried sub classing QTreeView to re-code :
void clicked ( const QModelIndex & index );
but no luck, any pointers anyone ?
Thanks, Neil
Bookmarks