<?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[Adding QBluetoothDeviceInfo to QList error]]></title><description><![CDATA[<p dir="auto">Here is a code snippet which oasses "intelisese" ("append: is a  valid function ) , but gives me an error.</p>
<pre><code>void MainWindow_BT_Terminal::addDevice(const QBluetoothDeviceInfo &amp;info)
{
    text = "add remote device to list... ";
    text += " ";
    qDebug()&lt;&lt; text;

    // QList&lt;QBluetoothDeviceInfo*&gt; RemoteDevicesList;
    RemoteDevicesList.append(info);
    
</code></pre>
<p dir="auto">I do not understand  why I am getting this error.</p>
<pre><code>/mnt/07b7c3f8-0efb-45ab-8df8-2a468771de1f/PROJECTS/RECOVERY/BLUETOOTH/SOURCE/CCC_SOURCE/terminal_SERIAL_BLUETOOTH_VER_1/terminal_SERIAL_BLUETOOTH/terminal_BLUETOOTH/mainwindow_BT_Terminal.cpp:799: error: no matching member function for call to 'append'
mainwindow_BT_Terminal.cpp:799:23: error: no matching member function for call to 'append'
    RemoteDevicesList.append(info);
    ~~~~~~~~~~~~~~~~~~^~~~~~
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qlist.h:210:10: note: candidate function not viable: no known conversion from 'const QBluetoothDeviceInfo' to 'QBluetoothDeviceInfo *const' for 1st argument
    void append(const T &amp;t);
         ^
/home/nov25-1/Qt/Nov26/5.15.2/gcc_64/include/QtCore/qlist.h:211:10: note: candidate function not viable: no known conversion from 'const QBluetoothDeviceInfo' to 'const QList&lt;QBluetoothDeviceInfo *&gt;' for 1st argument
    void append(const QList&lt;T&gt; &amp;t);
         ^
</code></pre>
<p dir="auto">could somebody PLEASE explain to me why I am getting the error and OFFER A SOLUTION ?</p>
<p dir="auto">PS I do not need a confirmation that I am getting an error, I need a solution.</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.qt.io/topic/142844/adding-qbluetoothdeviceinfo-to-qlist-error</link><generator>RSS for Node</generator><lastBuildDate>Fri, 12 Jun 2026 23:06:46 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/142844.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 10 Feb 2023 13:05:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Adding QBluetoothDeviceInfo to QList error on Sun, 14 May 2023 20:42:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chris-kawa">@<bdi>Chris-Kawa</bdi></a> I did not realize I made  a duplicate post , so I am adding my goof  here . Sorry for wasting space.<br />
I think I got the concept of containers, but I am obviously  missing something  else.</p>
<p dir="auto">What am I missing in my code ?</p>
<p dir="auto">Decaration</p>
<p dir="auto">QList&lt;const QBluetoothDeviceInfo* &gt; RemoteDeviceInfo;</p>
<p dir="auto">This works</p>
<p dir="auto">RemoteDeviceInfo.append(&amp;info);</p>
<pre><code>        // verify
        text = "!!!!!!!!!   DEBUG verify RemoteDeviceInfo \n";
        text += " name \n";
        text += RemoteDeviceInfo.at(0)-&gt;name();
        qDebug() &lt;&lt; text;
        m_ui-&gt;plainTextEdit_8-&gt;appendPlainText(text);
        // m_ui-&gt;plainTextEdit_3-&gt;appendPlainText(text

      for(auto &amp;device:RemoteDeviceInfo)
        {
            text = " BUILD  range loop test ";
            m_ui-&gt;plainTextEdit_8-&gt;appendPlainText(text);

            text = " device name ";
            text += device-&gt;name();
            m_ui-&gt;plainTextEdit_8-&gt;appendPlainText(text);
        }
</code></pre>
<p dir="auto">when I attempt to verify       RemoteDeviceInfo)        using another method</p>
<p dir="auto">it fails</p>
<p dir="auto">if(!RemoteDeviceInfo.isEmpty())       passes OK<br />
{<br />
for (auto &amp;device:RemoteDeviceInfo)<br />
{<br />
text = " For loop test ";<br />
qDebug() &lt;&lt; text;<br />
text = " device address \n";<br />
text += device-&gt;address().toString();  fails here<br />
qDebug() &lt;&lt; text;<br />
m_ui-&gt;plainTextEdit_8-&gt;appendPlainText(text);<br />
text = " device name  \n";<br />
text += device-&gt;name(); // &gt;address().toString()<br />
qDebug() &lt;&lt; text;<br />
m_ui-&gt;plainTextEdit_8-&gt;appendPlainText(text);</p>
<pre><code>                        }
                    }
                }
</code></pre>
<p dir="auto">My debug shows no contents in RemoteDeviceInfo when used in another method.</p>
]]></description><link>https://forum.qt.io/post/758182</link><guid isPermaLink="true">https://forum.qt.io/post/758182</guid><dc:creator><![CDATA[Anonymous_Banned275]]></dc:creator><pubDate>Sun, 14 May 2023 20:42:10 GMT</pubDate></item><item><title><![CDATA[Reply to Adding QBluetoothDeviceInfo to QList error on Sat, 11 Feb 2023 18:10:27 GMT]]></title><description><![CDATA[<p dir="auto">@AnneRanch QList is a container. You put stuff in and you take stuff out of containers. I'm not sure I understand. What do you mean by "select a value"?</p>
<p dir="auto">Example:</p>
<pre><code class="language-cpp">QList&lt;QBluetoothDeviceInfo&gt; RemoteDevicesList; //list of values

RemoteDevicesList.append(info); //append a value (copy it into the back of the list)
RemoteDevicesList.insert(17, info); //insert a copy of info at position 17
RemoteDevicesList.removeFirst(); //remove first element
RemoteDevicesList.removeLast(); //remove last element
RemoteDevicesList.removeOne(info); //remove first element which value equals info
QBluetoothDeviceInfo i1 = RemoteDevicesList.first(); //copy first element out to i1 variable
QBluetoothDeviceInfo i2 = RemoteDevicesList.last(); //copy first element out to i2 variable
QBluetoothDeviceInfo i3 = RemoteDevicesList.at(42); //copy 42nd element out to i3 variable
</code></pre>
<p dir="auto">The above is when you have a list of values. If you have a list of pointers it's pretty much the same, but you deal with addresses, so &amp; when you want to take an address of an object and * when you want to get an object a pointer points to:</p>
<pre><code>QList&lt;QBluetoothDeviceInfo*&gt; RemoteDevicesList; //list of pointers

RemoteDevicesList.append(&amp;info); //append an address of info object (pointer) to the back of the list
RemoteDevicesList.insert(17, &amp;info); //insert a pointer to the info object at position 17
QBluetoothDeviceInfo i1 = *RemoteDevicesList.first(); //take the first pointer from the list, dereference it with * and copy it to i1 variable
QBluetoothDeviceInfo* i2 = RemoteDevicesList.first(); //take the first pointer from the list and copy it to i2 variable
</code></pre>
<p dir="auto">Keep in mind that when you're dealing with pointers you have to make sure the objects they point to are still alive, otherwise the pointers will point to garbage and cause a crash when you try to access the objects through them.</p>
]]></description><link>https://forum.qt.io/post/747233</link><guid isPermaLink="true">https://forum.qt.io/post/747233</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Sat, 11 Feb 2023 18:10:27 GMT</pubDate></item><item><title><![CDATA[Reply to Adding QBluetoothDeviceInfo to QList error on Sat, 11 Feb 2023 17:25:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chris-kawa">@<bdi>Chris-Kawa</bdi></a> Let me ask really stupid question  - can I then select the "value" or pointer  myself? I am having few issues implementing  QList.</p>
]]></description><link>https://forum.qt.io/post/747228</link><guid isPermaLink="true">https://forum.qt.io/post/747228</guid><dc:creator><![CDATA[Anonymous_Banned275]]></dc:creator><pubDate>Sat, 11 Feb 2023 17:25:03 GMT</pubDate></item><item><title><![CDATA[Reply to Adding QBluetoothDeviceInfo to QList error on Fri, 10 Feb 2023 13:47:31 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">why I am getting the error</p>
</blockquote>
<p dir="auto">Your list holds pointers and you're trying to pass an object reference to <code>append()</code>.</p>
<blockquote>
<p dir="auto">OFFER A SOLUTION</p>
</blockquote>
<p dir="auto">Change the list type to match what you're passing or change what you're passing to match the list type.</p>
]]></description><link>https://forum.qt.io/post/747099</link><guid isPermaLink="true">https://forum.qt.io/post/747099</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Fri, 10 Feb 2023 13:47:31 GMT</pubDate></item></channel></rss>