Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved]tableview set/get and other questions.
QtWS25 Last Chance

[solved]tableview set/get and other questions.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    toho71
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      syrianzoro
      wrote on last edited by
      #2

      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

      Qt is the future

      1 Reply Last reply
      0
      • T Offline
        T Offline
        toho71
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          syrianzoro
          wrote on last edited by
          #4

          you have to get the model Index not the view

          Qt is the future

          1 Reply Last reply
          0
          • S Offline
            S Offline
            syrianzoro
            wrote on last edited by
            #5

            @ QAbstractItemModel dataModel;
            QTableView myTableView;@

            reimplement the QAbstractItemModel make the list as data container

            Qt is the future

            1 Reply Last reply
            0
            • T Offline
              T Offline
              toho71
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved