<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: QienWang</title>
    <description>The latest articles on DEV Community by QienWang (@qienwang8964).</description>
    <link>https://dev.to/qienwang8964</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1235767%2Fe81804bc-c71e-412b-ac44-0a7118cf8e9f.png</url>
      <title>DEV Community: QienWang</title>
      <link>https://dev.to/qienwang8964</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/qienwang8964"/>
    <language>en</language>
    <item>
      <title>Qt -- QDir 过滤出jpg文件并保存在QFileInfoList中</title>
      <dc:creator>QienWang</dc:creator>
      <pubDate>Mon, 12 May 2025 13:24:18 +0000</pubDate>
      <link>https://dev.to/qienwang8964/qt-qdir-guo-lu-chu-jpgwen-jian-bing-bao-cun-zai-qfileinfolistzhong-2f65</link>
      <guid>https://dev.to/qienwang8964/qt-qdir-guo-lu-chu-jpgwen-jian-bing-bao-cun-zai-qfileinfolistzhong-2f65</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    QDir dir("/path/to/your/directory");、
    QFileInfoList fileList = dir.entryInfoList(QStringList{"*.jpg", "*.JPG"}, QDir::Files);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>cpp</category>
      <category>programming</category>
    </item>
    <item>
      <title>Qt -- 通过 Qt xml 读取 VOC2012 数据集xml标注文件中的目标名称和包含框</title>
      <dc:creator>QienWang</dc:creator>
      <pubDate>Mon, 12 May 2025 10:25:55 +0000</pubDate>
      <link>https://dev.to/qienwang8964/qt-tong-guo-qt-xml-du-qu-voc2012-shu-ju-ji-xmlbiao-zhu-wen-jian-zhong-de-mu-biao-ming-cheng-he-bao-han-kuang-2f9c</link>
      <guid>https://dev.to/qienwang8964/qt-tong-guo-qt-xml-du-qu-voc2012-shu-ju-ji-xmlbiao-zhu-wen-jian-zhong-de-mu-biao-ming-cheng-he-bao-han-kuang-2f9c</guid>
      <description>&lt;h2&gt;
  
  
  在.pro文件中添加以下内容
&lt;/h2&gt;

&lt;p&gt;QT += xml&lt;/p&gt;

&lt;h2&gt;
  
  
  实现 -- 以单个文件作为示例
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include "mainwindow.h"
#include &amp;lt;QApplication&amp;gt;

void parseXml(const QString &amp;amp; filePath);

int main(int argc, char * argv[])
{
    QApplication a(argc, argv);
    // MainWindow w;
    // w.show();

    QString xmlPath = ".../VOC2012_train_val/Annotations/2012_002880.xml";
    parseXml(xmlPath);

    return a.exec();
}

#include &amp;lt;QFile&amp;gt;
#include &amp;lt;QDomDocument&amp;gt;
#include &amp;lt;QDomElement&amp;gt;
#include &amp;lt;QDomNode&amp;gt;
void parseXml(const QString &amp;amp; filePath)
{
    QFile file(filePath);
    if (!file.open(QIODevice::ReadOnly))
    {
        qDebug() &amp;lt;&amp;lt; "Failed to open file:" &amp;lt;&amp;lt; filePath;
        return;
    }

    QDomDocument document;
    if (!document.setContent(&amp;amp;file))
    {
        qDebug() &amp;lt;&amp;lt; "Failed to parse XML file.";
        return;
    }

    QDomElement root = document.documentElement();
    QDomNodeList objects = root.elementsByTagName("object");

    for (int i = 0; i &amp;lt; objects.size(); ++i)
    {
        QDomElement object = objects.at(i).toElement();

        // 获取物体名称
        QDomElement nameElement = object.elementsByTagName("name").at(0).toElement();
        QString name = nameElement.text();
        qDebug() &amp;lt;&amp;lt; "Object Name:" &amp;lt;&amp;lt; name;

        // 获取包含框信息
        QDomElement bndboxElement = object.elementsByTagName("bndbox").at(0).toElement();
        QDomElement xminElement = bndboxElement.elementsByTagName("xmin").at(0).toElement();
        QDomElement yminElement = bndboxElement.elementsByTagName("ymin").at(0).toElement();
        QDomElement xmaxElement = bndboxElement.elementsByTagName("xmax").at(0).toElement();
        QDomElement ymaxElement = bndboxElement.elementsByTagName("ymax").at(0).toElement();

        int xmin = xminElement.text().toInt();
        int ymin = yminElement.text().toInt();
        int xmax = xmaxElement.text().toInt();
        int ymax = ymaxElement.text().toInt();

        qDebug() &amp;lt;&amp;lt; "Bounding Box:" &amp;lt;&amp;lt; xmin &amp;lt;&amp;lt; ymin &amp;lt;&amp;lt; xmax &amp;lt;&amp;lt; ymax;
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Qt -- Quick3D加载外部模型文件 - 即载入.obj等模型文件到Qt项目中</title>
      <dc:creator>QienWang</dc:creator>
      <pubDate>Mon, 14 Apr 2025 10:23:28 +0000</pubDate>
      <link>https://dev.to/qienwang8964/qt-quick3djia-zai-wai-bu-mo-xing-wen-jian-ji-zai-ru-objdeng-mo-xing-wen-jian-dao-qtxiang-mu-zhong-4im6</link>
      <guid>https://dev.to/qienwang8964/qt-quick3djia-zai-wai-bu-mo-xing-wen-jian-ji-zai-ru-objdeng-mo-xing-wen-jian-dao-qtxiang-mu-zhong-4im6</guid>
      <description>&lt;ol&gt;
&lt;li&gt;转换
 qt命令行工具: balsam C:\Users\Administrator\Desktop\FreeCAD\test.obj -o c:\model
 将会生成Test.qml文件和meshs文件夹.&lt;/li&gt;
&lt;li&gt;导入
 将test.obj生成的所有文件放入项目目录meshes/test/文件夹下, 之后导入这个文件夹
 import "./meshes/test/"&lt;/li&gt;
&lt;li&gt;使用模型
  在项目的View3D { } 中直接使用Test.qml作为组件即可
  Test {
  }&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>qt</category>
      <category>programming</category>
      <category>howto</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Softmax Derivation: A Step-by-Step Approach</title>
      <dc:creator>QienWang</dc:creator>
      <pubDate>Fri, 10 May 2024 03:39:17 +0000</pubDate>
      <link>https://dev.to/qienwang8964/softmax-derivation-a-step-by-step-approach-2leh</link>
      <guid>https://dev.to/qienwang8964/softmax-derivation-a-step-by-step-approach-2leh</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;f(x1, x2, ..., xn) = (e^x1 / Σ(e^xj), e^x2 / Σ(e^xj), ..., e^xn / Σ(e^xj)) (j = 1 to n)
where f[xi] = e^xi / Σ(e^xj) 

Let's begin!

∂f/∂xi = (d(e^x1 / Σ(e^xj))/dxi, d(e^x2 / Σ(e^xj))/dxi, ..., d(e^xi/ Σ(e^xj))/dxi, ..., d(e^xn / Σ(e^xj))/dxi)
(j = 1 to n)
∂f/∂xi = (-e^x1 * e^xi / (Σ(e^xj))^2, -e^x2 * e^xi / (Σ(e^xj))^2, ..., e^xi(Σ(e^xj) - e^xi) / (Σ(e^xj))^2, ...,
-e^xn * e^xi / (Σ(e^xj))^2) (j = 1 to n) 

When k=i,
(∂f/∂xi)[k] = e^xi * (Σ(e^xj) - e^xi) / (Σ(e^xj))^2 (j = 1 to n)
(∂f/∂xi)[k] = (e^xi / Σ(e^xj) * ((Σ(e^xj) - e^xi) / Σ(e^xj)) (j = 1 to n)
(∂f/∂xi)[k] = f[xi] * (1 - f[xi]) (j = 1 to n) 

When k≠i,
(∂f/∂xi)[k] = -e^xk * e^xi / (Σ(e^xj))^2 (j = 1 to n)
(∂f/∂xi)[k] = (-e^xk / Σ(e^xj)) * (e^xi / Σ(e^xj)) (j = 1 to n)
(∂f/∂xi)[k] = -f[xk] * f[xi] (j = 1 to n) 

In summary,
(∂f/∂xi)[k] = f[xi] * (1 - f[xi]) (j = 1 to n, k=i)
(∂f/∂xi)[k] = -f[xk] * f[xi] (j = 1 to n, k≠i)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Qt -- QTreeWidget Tree Traversal</title>
      <dc:creator>QienWang</dc:creator>
      <pubDate>Mon, 18 Dec 2023 08:16:37 +0000</pubDate>
      <link>https://dev.to/qienwang8964/qt-qtreewidget-tree-traversal-461h</link>
      <guid>https://dev.to/qienwang8964/qt-qtreewidget-tree-traversal-461h</guid>
      <description>&lt;p&gt;Need to use &lt;strong&gt;QTreeWidgetItemIterator&lt;/strong&gt; class：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;//Each item in a tree, checking the text in the first column &lt;/span&gt;
&lt;span class="c1"&gt;//against a user-specified search string.&lt;/span&gt;
&lt;span class="n"&gt;QTreeWidgetItemIterator&lt;/span&gt; &lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;treeWidget&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;itemText&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;setSelected&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: The above code is excerpted from Qt documentation.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
