Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Italian
  4. Problema accesso celle table view
Forum Updated to NodeBB v4.3 + New Features

Problema accesso celle table view

Scheduled Pinned Locked Moved Italian
3 Posts 3 Posters 2.7k Views 1 Watching
  • 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.
  • W Offline
    W Offline
    wakitowaki
    wrote on last edited by
    #1

    se ho:
    @
    void MainWindow::on_tableView_clicked(const QModelIndex &index)
    {
    int b;
    int c;

    b = index.row();
    c = index.column();
    
    qDebug() << "activate" << index.row();
    qDebug() << "activate" << index.column();
    

    }
    @
    ottengo l'indice di riga e colonna che mi serve.Le celle della mia tabella contengono stringhe di testo.A me servirebbe poter accedere al contenuto della cella mediante gli indici di riga e colonna e leggerne il contenuto.Come posso fare?

    grazie anticipatamente per le risposte

    [edit: code highlighted / Denis Kormalev]

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Se vuoi accedere proprio ai dati di quell'indice, usa direttamente QModelIndex::data. SennĂ², QModelIndex::model + QAbstractModelItem::data

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • L Offline
        L Offline
        luca
        wrote on last edited by
        #3

        Hai provato con:
        @
        int row=index.row();
        int col=index.col();
        QString text;
        text=tableModel->index(row,col).data().toString();
        @
        ?

        Se lo chiedevi in inglese mi sa che era meglio... :-D

        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