Important: Please read the Qt Code of Conduct -

QTreeWidget how to output selected item name.. ?

  • Hello. I have recently started getting into QT and Widgets. I have designed a UI table using QT Creator design option. I have also made a slots fr my TreeWidgets that I want to select. I did not implement any of the code myself, once I select which slot I want to, the code is being generated outside my project directory and wont let me access and see any of it.
    The slot that I have created is on_projectTreeWidget_itemPressed ( See the picture below)
    It also generated a function in my mainwindow:
    void MainWindow::on_projectTreeWidget_itemPressed(QTreeWidgetItem *item, int column)

    I am trying to debug print a name of selected widget for example(test_main_script) but it just return some random characters and I dont know what wrong I am doing?? Can someone give me some advice please

  • int row = 0;//test_main_script data row

  • @lukutis222 said in QTreeWidget how to output selected item name.. ?:


    This is of type QTreeWidgetItem **item probably not what you want. I'd guess you were looking for item->text() instead

Log in to reply