FarAway
7th July 2015, 11:40
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)));
void MainWindow::ItemInserted(const QModelIndex &parent, int first, int /*last*/)
{
QString text = parent->data(Qt::DisplayRole).toString(); // text is "" why?
}
Can you help me?
P.S. Sorry for my poor language skills.
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)));
void MainWindow::ItemInserted(const QModelIndex &parent, int first, int /*last*/)
{
QString text = parent->data(Qt::DisplayRole).toString(); // text is "" why?
}
Can you help me?
P.S. Sorry for my poor language skills.