I am developing this using QT4.3.1 and on a Mac OS X with intel processor.
Let me preface by saying I have read the posts:
http://www.qtcentre.org/forum/faq.php?faq=qt_signalslot
as well as
http://www.qtcentre.org/forum/f-qt-p...odel-5276.html
and that i get no compiling errors. I have also changed the doubleclicked(QModelIndex) to doubleclicked(QModelIndex&) and doubleclicked(QModelIndex &) and still no luck.
My end objective is to have a user double click any row or cell within a QTableView and have some action as a result. But right now it appears that the double-click event is not working.
I have a QTableView which is working because I can set it's model and display data.
Right now all I expect to see is a message window, but I get nothing.
Here is my code:
void Gui::showAtriumForm()
{
AtriumForm = new Ui_AtriumForm;
AtriumForm->setupUi(atriumForm);
atriumForm->show();
connect(AtriumForm
->collectionsView,
SIGNAL(doubleclicked
(QModelIndex)),
this,
SLOT(rowDoubleClicked
(QModelIndex)));
}
{
QMessageBox::information(NULL,
"here",
"Row was double clicked");
}
void Gui::showAtriumForm()
{
atriumForm = new QMainWindow;
AtriumForm = new Ui_AtriumForm;
AtriumForm->setupUi(atriumForm);
atriumForm->show();
connect(AtriumForm->collectionsView, SIGNAL(doubleclicked(QModelIndex)), this, SLOT(rowDoubleClicked(QModelIndex)));
}
void Gui::rowDoubleClicked(QModelIndex indx)
{
QMessageBox::information(NULL, "here", "Row was double clicked");
}
To copy to clipboard, switch view to plain text mode
The model type sholdn't matter, correct? Here is where I set it.
model->setQuery("SELECT * FROM collection AS co LEFT JOIN collectors AS c ON co.Collector_ID=c.Collector_ID");
gui->AtriumForm->collectionsView->setModel(model);
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery("SELECT * FROM collection AS co LEFT JOIN collectors AS c ON co.Collector_ID=c.Collector_ID");
gui->AtriumForm->collectionsView->setModel(model);
To copy to clipboard, switch view to plain text mode
All help is appreciated!
Sean
Bookmarks