What is the difference betwen these function calls that return pointers? : <p>I'm working in Qt parsing a XML file, using the QTreeWidget for displaying the sections of the XML.  I want to maintain pointers to each section "heading".</p>

<p>I have these pointers defined:</p>

<pre><code>QTreeWidgetItem* groupExport,
                 groupDesign,
                 groupSheet,
                 groupTitleBlock,
                 groupComponents,
                 groupLibParts,
                 groupLibraries,
                 groupNets;
</code></pre>

<p>I have these functons:</p>

<pre><code>//////////////////////////////////////////////////////////////////////////////
/// treeAddRoot
///---------------------------------------------------------------------------
QTreeWidgetItem* window_Main::treeAddRoot(QString name) {
    QTreeWidgetItem *treeRoot = new QTreeWidgetItem(ui-&gt;treeSourceFile);
    ...
    return treeRoot;
}
QTreeWidgetItem* window_Main::treeAddRoot(QString name, QString description) {
    QTreeWidgetItem *treeRoot = new QTreeWidgetItem(ui-&gt;treeSourceFile);
    ...
    return treeRoot;
}

//////////////////////////////////////////////////////////////////////////////
/// treeAddGroup
///---------------------------------------------------------------------------
QTreeWidgetItem* window_Main::treeAddGroup(QTreeWidgetItem *treeParent, QString name) {
    QTreeWidgetItem *treeChildGroup = new QTreeWidgetItem(treeParent);
    ...
    return treeChildGroup;
}
QTreeWidgetItem* window_Main::treeAddGroup(QTreeWidgetItem *treeParent, QString name, QString description) {
    QTreeWidgetItem *treeChildGroup = new QTreeWidgetItem(treeParent);
    ...
    return treeChildGroup;
}

//////////////////////////////////////////////////////////////////////////////
/// treeAddChild
///---------------------------------------------------------------------------
void window_Main::treeAddChild(QTreeWidgetItem *treeParent, QString name) {
    QTreeWidgetItem *treeChild = new QTreeWidgetItem(treeParent);
    ...
    treeParent-&gt;addChild(treeChild);
}
void window_Main::treeAddChild(QTreeWidgetItem *treeParent, QString name, QString description) {
    QTreeWidgetItem *treeChild = new QTreeWidgetItem(treeParent);
    ...
}
</code></pre>

<p>These are defined for "temporary" use while parsing:</p>

<pre><code>QString tempTag, tempValue;
</code></pre>

<p>For the parsing code, the compiler seems to think this is OK:</p>

<pre><code>if (tempTag.contains("export")) {
   ...            
   groupExport = treeAddRoot(tempTag);
}
</code></pre>

<p>However, a few lines later, with this:</p>

<pre><code>if (tempTag.contains("design")) {
    ...
    groupDesign = treeAddGroup(groupExport, tempTag);
}
</code></pre>

<p>The compiler errors with:</p>

<pre><code>error: no match for ‘operator=’ (operand types are ‘QTreeWidgetItem’ and ‘QTreeWidgetItem*’)
groupDesign = treeAddGroup(groupExport, tempTag);
            ^
</code></pre>

<p>Could someone help me understand the difference and why compilation is OK with one and failing on the other ?</p>

<p>Thanks in advance.</p>
