Hi,
I have a problem. I don't know how to get the access to item and it index after drag and drop event. I created a connection between signal and slot but item data are invalid. To be specific in this function: rowsInserted(QModelIndex,int,int) first variable is invalid. How to get access to valid data?
connect(ui
->lwSunday
->model
(),
SIGNAL(rowsInserted
(QModelIndex,
int,
int)),
this,
SLOT(ItemInserted
(QModelIndex,
int,
int)));
connect(ui->lwSunday->model(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(ItemInserted(QModelIndex,int,int)));
To copy to clipboard, switch view to plain text mode
void MainWindow
::ItemInserted(const QModelIndex &parent,
int first,
int /*last*/) {
QString text
= parent
->data
(Qt
::DisplayRole).
toString();
// text is "" why? }
void MainWindow::ItemInserted(const QModelIndex &parent, int first, int /*last*/)
{
QString text = parent->data(Qt::DisplayRole).toString(); // text is "" why?
}
To copy to clipboard, switch view to plain text mode
Can you help me?
P.S. Sorry for my poor language skills.
Bookmarks