Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Portuguese
  4. [Resolvido]Foco em item da table widget.
Forum Updated to NodeBB v4.3 + New Features

[Resolvido]Foco em item da table widget.

Scheduled Pinned Locked Moved Portuguese
6 Posts 5 Posters 3.2k 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.
  • F Offline
    F Offline
    felipe.c.sousa
    wrote on last edited by
    #1

    Alguem saberia como colocar um foco em um item da table widget?
    A opção set focus não existe.. e eu tentei outras formas mas não consegui nada.

    From all, to all.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      francomartins
      wrote on last edited by
      #2

      Esse é um exemplo equivalente ao de um duplo clique no item na linha 0 e na coluna 0 ;
      facim .
      @

      QTableWidget *twcenter = new QTableWidget(this);
      QTableWidgetItem *item = new QTableWidgetItem("text");

      twcenter->setRowCount(1);
      twcenter->setColumnCount(1);
      twcenter->setItem(0,0,item);
      twcenter->openPersistentEditor(twcenter->item(0,0));
      twcenter->cellWidget(0,0)->setFocus();
      @

      1 Reply Last reply
      0
      • F Offline
        F Offline
        flaviomarcio
        wrote on last edited by
        #3

        Oi melhorar um pouco o descritivo do que você quer fazer.

        Você quer dar foco em:

        1-TableWidget
        2-Célula
        3-Widget dentro de uma célula

        Você pode fazer assim:

        Para opção 1
        ui->tableWidget->setFocus();
        Para opção 2 e 3:
        ui->tableWidget->setCurrentCell(row,col);
        Para opção 3:
        QWidget *w= ui->tableWidget->cellWidget(row,col);
        QComboBox c=static_cast<QComboBox>( w );
        c->setFocus();

        Flavio Portela

        1 Reply Last reply
        0
        • F Offline
          F Offline
          felipe.c.sousa
          wrote on last edited by
          #4

          Na verdade Flavio eu queria o foco no item msm, como se fosse um duplo clique, deixando pronto para o usuario digitar. O codigo do Franco funcionou.
          vlw gnt!

          From all, to all.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Renatosantos
            wrote on last edited by
            #5

            :D

            Qt Developer.

            "Imagination is more important than knowledge."
            http://twitter.com/Renatos20

            1 Reply Last reply
            0
            • G Offline
              G Offline
              gdouglas7
              wrote on last edited by
              #6

              bem útil!

              Qt Developer
              Student of Information System

              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