<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Change StackedWidget Pages With TreeWidget]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I Have a StackedWidget and TreeWidget in my Window<br />
I Want to Connect this Two Object,<br />
And I Wrote This Codes But None Of This Codes Worked!<br />
My Codes:</p>
<pre><code>#include "management_menu.h"
#include "ui_management_menu.h"

management_menu::management_menu(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::management_menu)
{
    ui-&gt;setupUi(this);
    connect(ui-&gt;lineEdit,SIGNAL(textChanged(QString)),this,SLOT(onTextChanged()));
   connect(ui-&gt;treeWidget,SIGNAL(itemActivated(QTreeWidgetItem*,int)),ui-&gt;stackedWidget,SLOT(setCurrentIndex(int)));
    connect(ui-&gt;treeWidget,SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),ui-&gt;stackedWidget,SLOT(setCurrentIndex(int)));
    connect(ui-&gt;treeWidget,SIGNAL(itemChanged(QTreeWidgetItem*,int)),ui-&gt;stackedWidget,SLOT(setCurrentIndex(int)));
    connect(ui-&gt;treeWidget,SIGNAL(itemClicked(QTreeWidgetItem*,int)),ui-&gt;stackedWidget,SLOT(setCurrentIndex(int)));




}

management_menu::~management_menu()
{
    delete ui;
}


</code></pre>
<p dir="auto">What i must do?</p>
]]></description><link>https://forum.qt.io/topic/67720/change-stackedwidget-pages-with-treewidget</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 16:09:37 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/67720.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 31 May 2016 17:35:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Change StackedWidget Pages With TreeWidget on Tue, 31 May 2016 18:47:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/m4rzb4ni">@<bdi>M4RZB4Ni</bdi></a></p>
<p dir="auto">You may  want to see this example</p>
<p dir="auto"><a href="http://doc.qt.io/qt-5/qtwidgets-dialogs-configdialog-example.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qtwidgets-dialogs-configdialog-example.html</a></p>
]]></description><link>https://forum.qt.io/post/330704</link><guid isPermaLink="true">https://forum.qt.io/post/330704</guid><dc:creator><![CDATA[c.savur]]></dc:creator><pubDate>Tue, 31 May 2016 18:47:51 GMT</pubDate></item><item><title><![CDATA[Reply to Change StackedWidget Pages With TreeWidget on Tue, 31 May 2016 18:44:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/m4rzb4ni">@<bdi>M4RZB4Ni</bdi></a></p>
<p dir="auto">Yes, you are right it will work only one timer because, itemActivated(QTreeWidgetItem*,int), the second parameter is column id. So this will be same for the entire column.</p>
<p dir="auto">One way to do is that set some information to QTreeWidgetItem and in myslot use this information to call stackedWidget methods.</p>
<pre><code>    QTreeWidgetItem *s = new QTreeWidgetItem();
// set data
    s-&gt;setData(0, Qt::UserRole, QVariant("1"));
 
// obtain data   
    QVariant data = s-&gt;data(0, Qt::UserRole);

</code></pre>
]]></description><link>https://forum.qt.io/post/330702</link><guid isPermaLink="true">https://forum.qt.io/post/330702</guid><dc:creator><![CDATA[c.savur]]></dc:creator><pubDate>Tue, 31 May 2016 18:44:44 GMT</pubDate></item><item><title><![CDATA[Reply to Change StackedWidget Pages With TreeWidget on Tue, 31 May 2016 18:28:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/c.savur">@<bdi>c.savur</bdi></a><br />
this works but<br />
<strong>No more than once</strong><br />
in Second click this those not work!</p>
]]></description><link>https://forum.qt.io/post/330701</link><guid isPermaLink="true">https://forum.qt.io/post/330701</guid><dc:creator><![CDATA[M4RZB4Ni]]></dc:creator><pubDate>Tue, 31 May 2016 18:28:04 GMT</pubDate></item><item><title><![CDATA[Reply to Change StackedWidget Pages With TreeWidget on Tue, 31 May 2016 18:12:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/m4rzb4ni">@<bdi>M4RZB4Ni</bdi></a></p>
<p dir="auto">the signal and slot parameter does not match. Try to write your own slot then call stackwidget methods.</p>
<p dir="auto">example :</p>
<pre><code>connect(ui-&gt;treeWidget,SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(myslot(QTreeWidgetItem*,int)));

in my slot:
void management_menu::mySlot(QTreeWidgetItem*,int index) 
{
     ui-&gt;stackedWidget-&gt;setCurrentIndex(index);
}

</code></pre>
<p dir="auto">This should work.</p>
]]></description><link>https://forum.qt.io/post/330699</link><guid isPermaLink="true">https://forum.qt.io/post/330699</guid><dc:creator><![CDATA[c.savur]]></dc:creator><pubDate>Tue, 31 May 2016 18:12:57 GMT</pubDate></item></channel></rss>