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. QTreeWidget Signal and slot
Qt 6.11 is out! See what's new in the release blog

QTreeWidget Signal and slot

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.4k 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.
  • darkstaringD Offline
    darkstaringD Offline
    darkstaring
    wrote on last edited by
    #1

    Hi... after populated my QTreeWidget
    at the end, i write this:

    connect(ui->treeWidgetWiFis,SIGNAL(itemClicked(QTreeWidgetItem *,int)),this,SLOT(apri_connessione(QTreeWidgetItem*)));
    

    and

    void MainWindow::apri_connessione(QTreeWidgetItem *item)
    {
        qDebug()<<item;
    }
    

    but i have error,
    then i added in MainWindow.h, in private slot:

    void apri_connessione();
    

    but not resolve.... this is the error...
    error: out-of-line definition of 'apri_connessione' does not match any declaration in 'MainWindow'...

    Any help ?

    Thank you...
    Francesco

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TobbY
      wrote on last edited by TobbY
      #2

      Yes, it doesn't match with function signature. apri_connessione(QTreeWidgetItem*) and you have added void apri_connessione();

      1 Reply Last reply
      2
      • darkstaringD Offline
        darkstaringD Offline
        darkstaring
        wrote on last edited by darkstaring
        #3

        How to fix ?

        EDIT:

        if in design make right click in QTreeWidget -> go to slot -> itemClicked()
        not work!
        with
        error: ‘QTreeWidgetItem’ has not been declared
        void on_treeWidgetWiFis_itemClicked(QTreeWidgetItem *item, int column);
        ^~~~~~~~~~~~~~~

        1 Reply Last reply
        0
        • T Offline
          T Offline
          TobbY
          wrote on last edited by
          #4

          @darkstaring said in QTreeWidget Signal and slot:

          QTreeWidgetItem

          include header #include <QTreeWidgetItem>

          1 Reply Last reply
          1
          • darkstaringD Offline
            darkstaringD Offline
            darkstaring
            wrote on last edited by darkstaring
            #5

            @TobbY said in QTreeWidget Signal and slot:

            #include <QTreeWidgetItem>

            already included

            EDIT:
            but not in mainwindow.h....
            thank you... now works

            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