QT QTableView Double click to get all the information of a row

(1) Set the code of the double-click event

    ListViewUp->setSelectionBehavior(QAbstractItemView::SelectRows);
    bool   value = connect(ListViewUp, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotRowDoubleClicked(const QModelIndex &)));

(2) Get detailed information
    void homePage::slotRowDoubleClicked(const QModelIndex &index)
    {         int row = ListViewUp->currentIndex().row();

        for(i = 0; i < 4; i++)
        {
            QModelIndex index = modelViewOneUp->index(row,i);
            QString name = modelViewOneUp->data(index).toString();
            qDebug()<<name;

        }

    }

 

Guess you like

Origin blog.csdn.net/qq_14874791/article/details/109015014