Hi! I'm new here and new to Qt in general.
I'm trying to do the same thing. Since QSqlTableModel::removeRow() needs row index as argument, how can I get the index of selected row? I looked here: http://www.qtforum.org/article/14578...ablemodel.html but this doesn't seem to work. I get those errors while I try to compile:
soltys@ubuntu:~/qt/neurohelper_v0.2$ make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I. -o tableeditor.o tableeditor.cpp
tableeditor.cpp: In member function ‘void TableEditor::delRow()’:
tableeditor.
cpp:80: error
: ‘class
QSqlTableModel’ has no member named ‘selectionModel’
tableeditor.
cpp:81: error
: ‘class
QItemSelectionModel’ has no member named ‘selectionIndex’
tableeditor.
cpp:85: error
: no matching function
for call to ‘
QSqlTableModel::removeRow(const QModelIndex
&)’
/usr
/include
/qt4
/QtCore
/qabstractitemmodel.
h:314: note
: candidates are
: bool QAbstractItemModel::removeRow(int,
const QModelIndex
&) make: *** [tableeditor.o] Error 1
soltys@ubuntu:~/qt/neurohelper_v0.2$ make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I. -o tableeditor.o tableeditor.cpp
tableeditor.cpp: In member function ‘void TableEditor::delRow()’:
tableeditor.cpp:80: error: ‘class QSqlTableModel’ has no member named ‘selectionModel’
tableeditor.cpp:81: error: ‘class QItemSelectionModel’ has no member named ‘selectionIndex’
tableeditor.cpp:85: error: no matching function for call to ‘QSqlTableModel::removeRow(const QModelIndex&)’
/usr/include/qt4/QtCore/qabstractitemmodel.h:314: note: candidates are: bool QAbstractItemModel::removeRow(int, const QModelIndex&)
make: *** [tableeditor.o] Error 1
To copy to clipboard, switch view to plain text mode
Bookmarks