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. QTableWidget itemDoubleClicked signal link to textEdit

QTableWidget itemDoubleClicked signal link to textEdit

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 4.0k 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.
  • P Offline
    P Offline
    petergeng
    wrote on last edited by
    #1

    i have a populated tableWidget and i want to select the row header upon doubleClick and grab the text in the row header then populate a textEdit with it.

    i have:

    @connect(ui->tableWidget, SIGNAL(itemDoubleClicked(QTableWidget*)),ui->textEdit, SLOT(on_tableWidget_itemDoubleClicked(QTableWidgetItem*)));
    void on_tableWidget_itemDoubleClicked(QTableWidgetItem *item)
    {
    QString selectedName = item->text();
    ui->textEdit->setText(selectedName);
    } @
    and not only is the focus not changing when i run and doubleClick the code buh nothing is happening to the textEdit... Am i missing something here? is the row header not a TableWidgetItem??

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cincirin
      wrote on last edited by
      #2

      You should check "Signals & Slots":http://doc.qt.nokia.com/stable/signalsandslots.html
      So your slot function MUST be a member of a class derived from QObject and with Q_OBJECT preprocessor defined.

      edit for quote:

      bq. All classes that contain signals or slots must mention Q_OBJECT at the top of their declaration. They must also derive (directly or indirectly) from QObject.

      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