[solved]tableview set/get and other questions.



  • Because I'm a newbee i have some difficulties with many things.
    Here is a list about Qtableview.

    I select and click on a singel row.
    Could I get all of the values from the diffrent columns and put in a array or something.

    How could i do so if i uses the arrows to run thru the table the selection changes to the new row.
    in other words currnt row change.

    1. i want to highlight or "Blink " som of the rows in the table.
      Is it possible.

    I'd like exampels

    Foregive my bad English but i*m trying



    I select and click on a singel row.
    Could I get all of the values from the diffrent columns and put in a array or something.

    Yes, you could , you can catch the suitable signal and get the index of the row then get all the desired results
    @

    connect(_myTableView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(doubleClicked(const QModelIndex &)));
    @

    How could i do so if i uses the arrows to run thru the table the selection changes to the new row.
    in other words currnt row change.

    I don't understand this

    1. i want to highlight or “Blink “ som of the rows in the table.
      Is it possible.

    @setAlternatingRowColors(true);@

    Yes by calling one method

    I’d like exampels

    Foregive my bad English but i*m trying



    Yes i do so but in a clickevent on a button and i do like this

    @QModelIndexList selectedList = ui->testTable->selectionModel()->selectedRows(1);
    QModelIndex index = ui->testTable->currentIndex();

    for( int i=0; i<selectedList.count(); i++)
    {
    ui->label1->setText(selectedList.at(i).data().toString());
    }@
    I can only get the columnvalue from ->selectedRows(1);
    is there an easier way to do this


    it was ment to catch the currentrow when i change row with my arrow buttons or swipe.
    Is it possible.

    I want to put the values from the current row in labels.



  • you have to get the model Index not the view



  • @ QAbstractItemModel dataModel;
    QTableView myTableView;@

    reimplement the QAbstractItemModel make the list as data container



  • Thanks but iI'm not sure how to do it.

    I try to do this also on row change

    @ connect(ui->testTable, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
    this, SLOT(selectionChanged(QModelIndex, QModelIndex)));
    @

    But nothing happens


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.