void MainWindow::addChild()
{
qDebug()<<"Slot activ";
QModelIndex index
= ui
->treeView
->selectionModel
()->currentIndex
();
if (model->columnCount(index) == 0) {
if (!model->insertColumn(0, index))
{
return;
}
}
if (!model->insertRow(0, index))
{
return;
}
int column = ui->treeView->selectionModel()->currentIndex().column();
int row=ui->treeView->selectionModel()->currentIndex().row();
model->insertColumn(column , index);
model
->setData
(model
->index
(row, column, index
),
QVariant(linkWWW
->text
()), Qt
::EditRole);
qDebug()<<column;
model->insertColumn(column +1, index);
model
->setData
(model
->index
(row, column
+ 1 , index
),
QVariant(nameWWW
->text
()), Qt
::EditRole);
qDebug()<<column;
model->insertColumn(column +2, index);
model
->setData
(model
->index
(row, column
+ 2 , index
),
QVariant(tegWWW
->text
()), Qt
::EditRole);
qDebug()<<column;
model->insertColumn(column +3, index);
model
->setData
(model
->index
(row, column
+ 3 , index
),
QVariant(tegWWW
->text
()), Qt
::EditRole);
qDebug()<<column;
}
void MainWindow::addChild()
{
qDebug()<<"Slot activ";
QModelIndex index = ui->treeView->selectionModel()->currentIndex();
QAbstractItemModel *model = ui->treeView->model();
if (model->columnCount(index) == 0) {
if (!model->insertColumn(0, index))
{
return;
}
}
if (!model->insertRow(0, index))
{
return;
}
int column = ui->treeView->selectionModel()->currentIndex().column();
int row=ui->treeView->selectionModel()->currentIndex().row();
model->insertColumn(column , index);
model->setData(model->index(row, column, index), QVariant(linkWWW->text()), Qt::EditRole);
qDebug()<<column;
model->insertColumn(column +1, index);
model->setData(model->index(row, column + 1 , index), QVariant(nameWWW->text()), Qt::EditRole);
qDebug()<<column;
model->insertColumn(column +2, index);
model->setData(model->index(row, column + 2 , index), QVariant(tegWWW->text()), Qt::EditRole);
qDebug()<<column;
model->insertColumn(column +3, index);
model->setData(model->index(row, column + 3 , index), QVariant(tegWWW->text()), Qt::EditRole);
qDebug()<<column;
}
To copy to clipboard, switch view to plain text mode
Bookmarks