How to Get Absolute Path of Currently Selected Item in QTreeWidget on mouse Clicked
<p>I have a simple <code>QTreeWidget</code> pointing to the root directory:  </p>

<pre><code>#include &lt;QTreeWidget&gt;
#include &lt;QStringList&gt;
#include &lt;QApplication&gt;

int main(int argc, char **argv)
{
QApplication application(argc, argv);
QStringList fileNames{"TEST/branch", "trunk"};
QTreeWidget treeWidget;
treeWidget.setColumnCount(1);

for (const auto&amp; filename : fileNames) 
{
    QTreeWidgetItem *parentTreeItem = new QTreeWidgetItem(&amp;treeWidget);
    parentTreeItem-&gt;setText(0, filename.split('/').first());
    QStringList filenameParts = filename.split('/').mid(1);

    for(const auto&amp; filenamePart : filenameParts) 
    {
         QTreeWidgetItem *treeItem = new QTreeWidgetItem();
         treeItem-&gt;setText(0, filenamePart);
         parentTreeItem-&gt;addChild(treeItem);
         parentTreeItem = treeItem;
    }
}

treeWidget.show();
return application.exec();
}
</code></pre>

<p>Output:</p>

<p><a href="https://i.stack.imgur.com/yJX8S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yJX8S.png" alt="enter image description here"></a></p>

<p>The item I have selected above is /TEST/branches. How can I get the absolute path of the currently selected item?</p>