initial commit

This commit is contained in:
2019-02-18 17:39:50 +01:00
parent cbaacbe0e9
commit fa05750b5f
14 changed files with 452 additions and 176 deletions
+46
View File
@@ -6,6 +6,7 @@
#include "common.h"
#include <QBuffer>
#include <QDir>
QImage blob2Image(const QByteArray& ba)
@@ -31,3 +32,48 @@ QByteArray image2Blob(const QImage &image)
return(ba);
}
void insertPath(QString szPath, QStandardItem* lpRootItem)
{
if(!lpRootItem)
return;
QString szPath1 = szPath.replace("\\", "/");
QStringList szPathList = szPath1.split("/");
QStandardItem* lpCurRoot = lpRootItem;
int path;
bool bFound;
szPath1 = "";
for(path = 0;path < szPathList.count();path++)
{
bFound = false;
for(int x = 0;x < lpCurRoot->rowCount();x++)
{
QStandardItem* lpCurItem = lpCurRoot->child(x, 0);
if(!lpCurItem->text().compare(szPathList[path], Qt::CaseInsensitive))
{
lpCurRoot = lpCurItem;
bFound = true;
break;
}
}
if(!bFound)
break;
szPath1.append(szPathList[path]+QDir::separator());
}
for(;path < szPathList.count();path++)
{
szPath1.append(szPathList[path]);
QStandardItem* lpNewItem = new QStandardItem(szPathList[path]);
lpCurRoot->appendRow(lpNewItem);
lpNewItem->setData(QVariant::fromValue(szPath1), Qt::UserRole+2);
szPath1.append(QDir::separator());
lpCurRoot = lpNewItem;
}
}