cys 5 months ago
commit 393be7466c

Binary file not shown.

@ -0,0 +1,44 @@
QT += core gui
QT += core gui quickwidgets positioning location
QT += multimedia
QT += multimediawidgets
QT += webenginewidgets webchannel
QT += sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
DogDatabase.cpp \
InjuryAnalysisUI.cpp \
InjuryDatabase.cpp \
UAVDatabase.cpp \
injurydisiplayui.cpp \
main.cpp \
guidingui.cpp
HEADERS += \
DogDatabase.h \
InjuryAnalysisUI.h \
InjuryDatabase.h \
UAVDatabase.h \
guidingui.h \
injurydisiplayui.h
FORMS += \
InjuryAnalysisUI.ui \
guidingui.ui \
injurydisiplayui.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
res.qrc

@ -0,0 +1,268 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 13.0.0, 2024-05-17T08:33:35. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{c17bc554-7aa8-48e6-9607-c4ecd694950b}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="qlonglong">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="int" key="EditorConfiguration.PreferAfterWhitespaceComments">0</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">2</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">6</value>
<value type="bool" key="ClangTools.PreferConfigFile">true</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.7.0 MSVC2019 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.7.0 MSVC2019 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.670.win64_msvc2019_64_kit</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\PROJECT\QT\CasualtySightPlus\build\Desktop_Qt_6_7_0_MSVC2019_64bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/PROJECT/QT/CasualtySightPlus/build/Desktop_Qt_6_7_0_MSVC2019_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\PROJECT\QT\CasualtySightPlus\build\Desktop_Qt_6_7_0_MSVC2019_64bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/PROJECT/QT/CasualtySightPlus/build/Desktop_Qt_6_7_0_MSVC2019_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\PROJECT\QT\CasualtySightPlus\build\Desktop_Qt_6_7_0_MSVC2019_64bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/PROJECT/QT/CasualtySightPlus/build/Desktop_Qt_6_7_0_MSVC2019_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/PROJECT/QT/CasualtySightPlus/CasualtySightPlus.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/PROJECT/QT/CasualtySightPlus/CasualtySightPlus.pro</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/PROJECT/QT/CasualtySightPlus/build/Desktop_Qt_6_7_0_MSVC2019_64bit-Release</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="qlonglong">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

@ -0,0 +1,196 @@
#include "DogDatabase.h"
DogDatabase *DogDatabase::getInstance()
{
static DogDatabase db;
return &db;
}
DogDatabase::~DogDatabase()
{
close();
}
DogDatabase::DogDatabase()
{
m_sqlDb = QSqlDatabase::addDatabase("QMYSQL");
}
//添加记录
bool DogDatabase::add(const Dog &data)
{
if(open("fly_land_database","root","MYSQLqwer35257"))
{
beginAddFiled("dogdatabase");
addFiled("id");
addFiled("state");
addFiled("ip");
addFiled("port");
addFiled("lon");
addFiled("lat");
endAddFiled();
beginAddRow();
addValue(data.id);
addValue(data.state);
addValue(data.ip);
addValue(data.port);
addValue(data.lon);
addValue(data.lat);
endAddRow();
m_valueSql = m_valueSql.left(m_valueSql.length()-1);
QString sql;
sql = m_headerSql + m_valueSql;
return exec(sql);
}
close();
}
//查询位置信息的记录
Point DogDatabase::ReturnUAVPosition(QString id)
{
if(open("fly_land_database","root","MYSQLqwer35257"))
{
QSqlQuery query(m_sqlDb);
QString strQuery;
strQuery = "SELECT lon, lat FROM ";
strQuery += "dogdatabase";
strQuery += " WHERE id = ";
strQuery += id;
qDebug()<<strQuery;
query.prepare(strQuery);
Point position;
bool isSuccess = query.exec();
if(isSuccess)
{
while(query.next())
{
double lon = query.value(0).toDouble();
double lat = query.value(1).toDouble();
position.lon = lon;
position.lat = lat;
}
}
return position;
}
close();
}
//返回状态信息
int DogDatabase::giveInfo(QString id)
{
if(open("fly_land_database","root","MYSQLqwer35257"))
{
QSqlQuery query(m_sqlDb);
QString strQuery;
strQuery = "SELECT state FROM ";
strQuery += "dogdatabase";
strQuery += " WHERE id = ";
strQuery += id;
qDebug()<<strQuery;
query.prepare(strQuery);
int state = -1;
bool isSuccess = query.exec();
if(isSuccess)
{
while(query.next())
{
state = query.value(0).toInt();
}
}
return state;
}
close();
}
//——————————————————私有方法————————————————————
//建立连接
bool DogDatabase::open(const QString &dbName,const QString &userName,const QString &passwd)
{
m_sqlDb.setHostName("localhost"); // 本地数据库 远程DB是ipaddress
m_sqlDb.setPort(3306); // 设置端口号
m_sqlDb.setDatabaseName(dbName);
m_sqlDb.setUserName(userName);
m_sqlDb.setPassword(passwd);
if(!m_sqlDb.open())
{
qDebug()<<"连接失败!";
return false;
}
else
{
qDebug()<<"连接成功!";
return true;
}
}
void DogDatabase::close()
{
m_sqlDb.close();
}
void DogDatabase::beginAddFiled(const QString &tableName)
{
m_tableName = tableName;
m_fieldName.clear();
m_headerSql.clear();
m_valueSql.clear();
m_fieldAdd = 0;
}
void DogDatabase::addFiled(const QString &filedName)
{
m_fieldName.append(filedName);
}
void DogDatabase::endAddFiled()
{
m_headerSql = QString("INSERT INTO %0 (%1) values").arg(m_tableName).arg(m_fieldName.join(","));
}
void DogDatabase::beginAddRow()
{
m_valueSql += "(";
}
void DogDatabase::addValue(const QVariant &value)
{
m_valueSql += QString("\'%0\',").arg(value.toString());
m_fieldAdd++;
}
void DogDatabase::endAddRow()
{
m_valueSql = m_valueSql.left(m_valueSql.length() - 1);
m_valueSql += "),";
}
bool DogDatabase::exec(const QString &sql)
{
bool isSuccess = false;
QSqlQuery query(m_sqlDb);
query.prepare(sql);
qDebug()<<sql;
isSuccess = query.exec();
if(!isSuccess)
//qDebug() << "Error inserting data:" << query.lastError().text();
return isSuccess;
}

@ -0,0 +1,98 @@
#ifndef DOGDATABASE_H
#define DOGDATABASE_H
#include <QtSql>
#include <QSqlDatabase>
#include <QWidget>
#include <QSqlQuery>
#include <QString>
#include <QSqlRecord>
#include <QDebug>
#include "UAVDatabase.h"
using namespace std;
struct Dog
{
QString id;
int state;
QString ip;
int port;
double lon;
double lat;
};
class DogDatabase
{
// Q_OBJECT宏用于提供Qt信号槽和元对象系统服务
// 它必须限定为私有访问权限
//Q_OBJECT
public:
static DogDatabase *getInstance();
DogDatabase();
~DogDatabase();
Dog data;
//返回状态信息
int giveInfo(QString id);
//添加数据记录
bool add(const Dog &data);
//查询位置信息数据
Point ReturnUAVPosition( QString id);
private:
//打开
bool open(const QString &dbName,const QString &userName = QString(),const QString &passwd = QString());
//关闭
void close();
//开始添加字段
void beginAddFiled(const QString &tableName);
//添加字段
void addFiled(const QString &filedName);
//结束添加字段
void endAddFiled();
//开始添加行
void beginAddRow();
//添加字段值
void addValue(const QVariant &value);
//结束添加行
void endAddRow();
//执行
bool exec(const QString &sql);
private:
//数据库
QSqlDatabase m_sqlDb;
//表名
QString m_tableName;
//字段名
QStringList m_fieldName;
//头sql
QString m_headerSql;
//值sql
QString m_valueSql;
//已添加row数
int m_fieldAdd = 0;
};
#endif // DOGDATABASE_H

@ -0,0 +1,116 @@
#include "InjuryAnalysisUI.h"
#include "InjuryDatabase.h"
#include "ui_InjuryAnalysisUI.h"
#include <QMessageBox>
#include <QWidget>
InjuryAnalysisUI::InjuryAnalysisUI(QWidget* parent):
QWidget(parent),
ui(new Ui::InjuryAnalysisUI)
{
ui->setupUi(this);
setWindowTitle("伤情态势分析界面");
//resize(600,400);
InjuryDatabase injurydatabase;
QList<Injury> resultNow;
injurydatabase.select_all(resultNow);//获取所有伤员数据
result = resultNow;
//添加一个scrollArea来将信息显示出来
ui->scrollArea->setWidgetResizable(false);//可以拖动滚动条
//竖滚动条和横滚动条都可以一直显示
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//设置主界面的实际界面
ui->scrollArea->setWidget(ui->scrollAreaWidgetContents);
ui->scrollAreaWidgetContents->setGeometry(0, 0, 381, result.length()*20);//实际界面参数
QLabel *label0=new QLabel(ui->scrollAreaWidgetContents);
label0->setText("伤员编号");
label0->move(0,0);
QLabel *label1=new QLabel(ui->scrollAreaWidgetContents);
label1->setText("伤情等级");
label1->move(100,0);
QLabel *label2=new QLabel(ui->scrollAreaWidgetContents);
label2->setText("位置精度");
label2->move(200,0);
QLabel *label3=new QLabel(ui->scrollAreaWidgetContents);
label3->setText("位置维度");
label3->move(300,0);
for(int i = 0; i<result.length(); i++)
{
QLabel *labelID=new QLabel(ui->scrollAreaWidgetContents);
labelID->setText(result[i].id);
labelID->move(0,15*(i+2));
QLabel *labelRank=new QLabel(ui->scrollAreaWidgetContents);
labelRank->setText(QString::number(result[i].rank));
labelRank->move(100,15*(i+2));
QLabel *labelLon=new QLabel(ui->scrollAreaWidgetContents);
labelLon->setText(QString::number(result[i].lon));
labelLon->move(200,15*(i+2));
QLabel *labelLat=new QLabel(ui->scrollAreaWidgetContents);
labelLat->setText(QString::number(result[i].lat));
labelLat->move(300,15*(i+2));
}
//对信息进行分类统计分析
int sum = result.length();
ui->sumLabel->setText(QString::number(sum));
int rank0Sum = 0;
int rank1Sum = 0;
int rank2Sum = 0;
for(int i = 0; i<sum; i++)
{
if(result[i].rank==0)
rank0Sum++;
else if(result[i].rank==1)
rank1Sum++;
else if(result[i].rank==2)
rank2Sum++;
}
ui->rank0Label->setText(QString::number(rank0Sum));
ui->rank1Label->setText(QString::number(rank1Sum));
ui->rank2Label->setText(QString::number(rank2Sum));
}
InjuryAnalysisUI::~InjuryAnalysisUI()
{
delete ui;
}
void InjuryAnalysisUI::on_searchButton_clicked()
{
QString userInput = ui->searchInput->text();
int searchIndex = -1;
if(!userInput.isEmpty())
{
for(int i = 0; i<result.length(); i++)
{
if(QString::compare(userInput,result[i].id)==0)
{
searchIndex = i;
break;
}
}
}
QString rank = QString::number(result[searchIndex].rank);
QString lon = QString::number(result[searchIndex].lon);
QString lat = QString::number(result[searchIndex].lat);
if(searchIndex==-1)
{
QMessageBox::warning(this, tr("查找"), tr("找不到id为 %1 的伤员!").arg(userInput));
}
else
{
QMessageBox::warning(this, tr("查找"), tr("伤员id%1 伤情等级:%2 位置经纬度:%3 %4 ").arg(userInput,rank,lon,lat));
}
}

@ -0,0 +1,36 @@
#ifndef INJURYANALYSISUI_H
#define INJURYANALYSISUI_H
#include "InjuryDatabase.h"
#include <QWidget>
QT_BEGIN_NAMESPACE
namespace Ui {
class InjuryAnalysisUI; //声明ui命名空间下的类
}
QT_END_NAMESPACE
class InjuryAnalysisUI : public QWidget
{
// Q_OBJECT宏用于提供Qt信号槽和元对象系统服务
// 它必须限定为私有访问权限
Q_OBJECT
public:
InjuryAnalysisUI(QWidget *parent = nullptr);
~InjuryAnalysisUI();
QList<Injury> result;
private slots:
void on_searchButton_clicked();
private:
// 创建Ui::InjuryAnalysisUI类型的指针用于操作ui界面及其控件
Ui::InjuryAnalysisUI *ui;
};
#endif // INJURYANALYSISUI_H

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InjuryAnalysisUI</class>
<widget class="QWidget" name="InjuryAnalysisUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>679</width>
<height>410</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(245, 245, 245);
font: 11pt &quot;Microsoft YaHei UI&quot;;</string>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>215</width>
<height>82</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>100</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/image/res/image/logo_backgroundless.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>伤情结果统计:</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="AnalysisDialog" native="true">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>631</width>
<height>291</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: rgba(15, 28, 34, 0);
color: rgb(0, 0, 0);
border: none;
padding: 10px 20px; /* 设置内边距 */
border-radius: 5px; /* 设置按钮圆角 */
font-size: 14px; /* 设置文字大小 */
text-align: right; /* 设置字体向右对齐 */
}
QPushButton:hover {
background-color: #0364FF; /* 设置鼠标悬停时按钮背景色 */
}
QPushButton:pressed {
background-color: #398439; /* 设置按钮被按下时背景色 */
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>365</width>
<height>229</height>
</rect>
</property>
</widget>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>伤员总数:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sumLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>伤情轻微的伤员数:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="rank0Label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>伤情一般的伤员数:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="rank1Label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>伤情严重的伤员数:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="rank2Label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>输入伤员编号查询伤员信息</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="searchInput">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="searchButton">
<property name="styleSheet">
<string notr="true">font: 14pt &quot;Consolas&quot;;</string>
</property>
<property name="text">
<string>查询</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,220 @@
#include "InjuryDatabase.h"
InjuryDatabase *InjuryDatabase::getInstance()
{
static InjuryDatabase db;
return &db;
}
InjuryDatabase::~InjuryDatabase()
{
close();
}
InjuryDatabase::InjuryDatabase()
{
m_sqlDb = QSqlDatabase::addDatabase("QMYSQL");
}
//添加记录
bool InjuryDatabase::add(const Injury &data)
{
if(open("fly_land_database","root","MYSQLqwer35257"))
{
beginAddFiled("injurydatabase");
addFiled("id");
addFiled("injuryrank");
addFiled("lon");
addFiled("lat");
addFiled("flag");
endAddFiled();
beginAddRow();
addValue(data.id);
addValue(data.rank);
addValue(data.lon);
addValue(data.lat);
addValue(data.flag);
endAddRow();
m_valueSql = m_valueSql.left(m_valueSql.length()-1);
QString sql;
sql = m_headerSql + m_valueSql;
return exec(sql);
}
close();
}
//查询所有记录
bool InjuryDatabase::select_all(QList<Injury> &result)
{
if(open("fly_land_database","root","MYSQLqwer35257"))
{
QSqlQuery query(m_sqlDb);
QString strQuery;
strQuery = "SELECT * FROM ";
strQuery += "injurydatabase";
query.prepare(strQuery);
bool isSuccess = query.exec();
if(isSuccess)
{
while(query.next())
{
QString id = query.value(0).toString();
int rank = query.value(1).toInt();
double lon = query.value(2).toDouble();
double lat = query.value(3).toDouble();
int flag = query.value(4).toInt();
Injury data;
data.id = id;
data.rank = rank;
data.lon = lon;
data.lat = lat;
data.flag = flag;
result.append(data);
}
}
return isSuccess;
}
close();
}
//返回有效伤员的信息
void InjuryDatabase::ReturnInfo(QList<Injury> result)
{
if(open("fly_land_database","root","MYSQLqwer35257"))
{
select_valid("injurydatabase", result);
for(int i = 0; i<result.length(); i++)
{
qDebug()<<result[i].id<<" "<<result[i].lon<< " "<<result[i].lat<<" "<<result[i].rank;
}
}
close();
}
//——————————————————私有方法————————————
//建立连接
bool InjuryDatabase::open(const QString &dbName,const QString &userName,const QString &passwd)
{
m_sqlDb.setHostName("localhost"); // 本地数据库 远程DB是ipaddress
m_sqlDb.setPort(3306); // 设置端口号
m_sqlDb.setDatabaseName(dbName);
m_sqlDb.setUserName(userName);
m_sqlDb.setPassword(passwd);
if(!m_sqlDb.open())
{
qDebug()<<"连接失败!";
return false;
}
else
{
qDebug()<<"连接成功!";
return true;
}
}
//查询有效记录
bool InjuryDatabase::select_valid(const QString &tableName, QList<Injury> &result)
{
QSqlQuery query(m_sqlDb);
QString strQuery;
strQuery = "SELECT id, injuryrank, lon, lat FROM ";
strQuery += tableName;
strQuery += " WHERE flag = 1";
//qDebug()<<strQuery;//打印SQL语句检查错误
query.prepare(strQuery);
bool isSuccess = query.exec();
if(isSuccess)
{
while(query.next())
{
QString id = query.value(0).toString();
int rank = query.value(1).toInt();
double lon = query.value(2).toDouble();
double lat = query.value(3).toDouble();
Injury data;
data.id = id;
data.rank = rank;
data.lon = lon;
data.lat = lat;
result.append(data);
}
}
return isSuccess;
}
void InjuryDatabase::close()
{
m_sqlDb.close();
}
void InjuryDatabase::beginAddFiled(const QString &tableName)
{
m_tableName = tableName;
m_fieldName.clear();
m_headerSql.clear();
m_valueSql.clear();
m_fieldAdd = 0;
}
void InjuryDatabase::addFiled(const QString &filedName)
{
m_fieldName.append(filedName);
}
void InjuryDatabase::endAddFiled()
{
m_headerSql = QString("INSERT INTO %0 (%1) values").arg(m_tableName).arg(m_fieldName.join(","));
}
void InjuryDatabase::beginAddRow()
{
m_valueSql += "(";
}
void InjuryDatabase::addValue(const QVariant &value)
{
m_valueSql += QString("\'%0\',").arg(value.toString());
m_fieldAdd++;
}
void InjuryDatabase::endAddRow()
{
m_valueSql = m_valueSql.left(m_valueSql.length() - 1);
m_valueSql += "),";
}
bool InjuryDatabase::exec(const QString &sql)
{
bool isSuccess = false;
QSqlQuery query(m_sqlDb);
query.prepare(sql);
qDebug()<<sql;
isSuccess = query.exec();
if(!isSuccess)
//qDebug() << "Error inserting data:" << query.lastError().text();
return isSuccess;
}

@ -0,0 +1,98 @@
#ifndef INJURYDATABASE_H
#define INJURYDATABASE_H
#include <QtSql>
#include <QSqlDatabase>
#include <QWidget>
#include <QSqlQuery>
#include <QString>
#include <QSqlRecord>
#include <QDebug>
using namespace std;
struct Injury
{
QString id;
int rank;
double lon;
double lat;
int flag;
};
class InjuryDatabase
{
// Q_OBJECT宏用于提供Qt信号槽和元对象系统服务
// 它必须限定为私有访问权限
//Q_OBJECT
public:
static InjuryDatabase *getInstance();
InjuryDatabase();
~InjuryDatabase();
//打开
bool open(const QString &dbName,const QString &userName = QString(),const QString &passwd = QString());
//添加数据记录
bool add(const Injury &data);
//查询所有数据
bool select_all(QList<Injury> &result);
Injury data;
//返回有效信息
void ReturnInfo(QList<Injury> data);
private:
//查询有效数据
bool select_valid(const QString &tableName,QList<Injury> &result);
//关闭
void close();
//开始添加字段
void beginAddFiled(const QString &tableName);
//添加字段
void addFiled(const QString &filedName);
//结束添加字段
void endAddFiled();
//开始添加行
void beginAddRow();
//添加字段值
void addValue(const QVariant &value);
//结束添加行
void endAddRow();
//执行
bool exec(const QString &sql);
private:
//数据库
QSqlDatabase m_sqlDb;
//表名
QString m_tableName;
//字段名
QStringList m_fieldName;
//头sql
QString m_headerSql;
//值sql
QString m_valueSql;
//已添加row数
int m_fieldAdd = 0;
};
#endif // INJURYDATABASE_H

@ -0,0 +1,196 @@
#include "UAVDatabase.h"
UAVDatabase *UAVDatabase::getInstance()
{
static UAVDatabase db;
return &db;
}
UAVDatabase::~UAVDatabase()
{
close();
}
UAVDatabase::UAVDatabase()
{
m_sqlDb = QSqlDatabase::addDatabase("QMYSQL");
}
//添加记录
bool UAVDatabase::add(const UAV &data)
{
if(open("fly_land_database","root","MYSQLqwer35257"))
{
beginAddFiled("uavdatabase");
addFiled("id");
addFiled("state");
addFiled("ip");
addFiled("port");
addFiled("lon");
addFiled("lat");
endAddFiled();
beginAddRow();
addValue(data.id);
addValue(data.state);
addValue(data.ip);
addValue(data.port);
addValue(data.lon);
addValue(data.lat);
endAddRow();
m_valueSql = m_valueSql.left(m_valueSql.length()-1);
QString sql;
sql = m_headerSql + m_valueSql;
return exec(sql);
}
close();
}
//查询位置信息的记录
Point UAVDatabase::ReturnUAVPosition(QString id)
{
if(open("fly_land_database","root","MYSQLqwer35257"))
{
QSqlQuery query(m_sqlDb);
QString strQuery;
strQuery = "SELECT lon, lat FROM ";
strQuery += "uavdatabase";
strQuery += " WHERE id = ";
strQuery += id;
qDebug()<<strQuery;
query.prepare(strQuery);
Point position;
bool isSuccess = query.exec();
if(isSuccess)
{
while(query.next())
{
double lon = query.value(0).toDouble();
double lat = query.value(1).toDouble();
position.lon = lon;
position.lat = lat;
}
}
return position;
}
close();
}
//返回状态信息
int UAVDatabase::giveInfo(QString id)
{
if(open("fly_land_database","root","MYSQLqwer35257"))
{
QSqlQuery query(m_sqlDb);
QString strQuery;
strQuery = "SELECT state FROM ";
strQuery += "uavdatabase";
strQuery += " WHERE id = ";
strQuery += id;
qDebug()<<strQuery;
query.prepare(strQuery);
int state = -1;
bool isSuccess = query.exec();
if(isSuccess)
{
while(query.next())
{
state = query.value(0).toInt();
}
}
return state;
}
close();
}
//——————————————————私有方法————————————————————
//建立连接
bool UAVDatabase::open(const QString &dbName,const QString &userName,const QString &passwd)
{
m_sqlDb.setHostName("localhost"); // 本地数据库 远程DB是ipaddress
m_sqlDb.setPort(3306); // 设置端口号
m_sqlDb.setDatabaseName(dbName);
m_sqlDb.setUserName(userName);
m_sqlDb.setPassword(passwd);
if(!m_sqlDb.open())
{
qDebug()<<"连接失败!";
return false;
}
else
{
qDebug()<<"连接成功!";
return true;
}
}
void UAVDatabase::close()
{
m_sqlDb.close();
}
void UAVDatabase::beginAddFiled(const QString &tableName)
{
m_tableName = tableName;
m_fieldName.clear();
m_headerSql.clear();
m_valueSql.clear();
m_fieldAdd = 0;
}
void UAVDatabase::addFiled(const QString &filedName)
{
m_fieldName.append(filedName);
}
void UAVDatabase::endAddFiled()
{
m_headerSql = QString("INSERT INTO %0 (%1) values").arg(m_tableName).arg(m_fieldName.join(","));
}
void UAVDatabase::beginAddRow()
{
m_valueSql += "(";
}
void UAVDatabase::addValue(const QVariant &value)
{
m_valueSql += QString("\'%0\',").arg(value.toString());
m_fieldAdd++;
}
void UAVDatabase::endAddRow()
{
m_valueSql = m_valueSql.left(m_valueSql.length() - 1);
m_valueSql += "),";
}
bool UAVDatabase::exec(const QString &sql)
{
bool isSuccess = false;
QSqlQuery query(m_sqlDb);
query.prepare(sql);
qDebug()<<sql;
isSuccess = query.exec();
if(!isSuccess)
//qDebug() << "Error inserting data:" << query.lastError().text();
return isSuccess;
}

@ -0,0 +1,104 @@
#ifndef UAVDATABASE_H
#define UAVDATABASE_H
#include <QWidget>
#include <QSqlQuery>
#include <QtSql>
#include <QSqlDatabase>
#include <QString>
#include <QSqlRecord>
#include <QDebug>
using namespace std;
struct UAV
{
QString id;
int state;
QString ip;
int port;
double lon;
double lat;
};
//存储经纬度信息
struct Point
{
double lon;
double lat;
};
class UAVDatabase
{
// Q_OBJECT宏用于提供Qt信号槽和元对象系统服务
// 它必须限定为私有访问权限
//Q_OBJECT
public:
static UAVDatabase *getInstance();
UAVDatabase();
~UAVDatabase();
UAV data;
//返回状态信息
int giveInfo(QString id);
//添加数据记录
bool add(const UAV &data);
//查询位置信息数据
Point ReturnUAVPosition( QString id);
private:
//打开
bool open(const QString &dbName,const QString &userName = QString(),const QString &passwd = QString());
//关闭
void close();
//开始添加字段
void beginAddFiled(const QString &tableName);
//添加字段
void addFiled(const QString &filedName);
//结束添加字段
void endAddFiled();
//开始添加行
void beginAddRow();
//添加字段值
void addValue(const QVariant &value);
//结束添加行
void endAddRow();
//执行
bool exec(const QString &sql);
private:
//数据库
QSqlDatabase m_sqlDb;
//表名
QString m_tableName;
//字段名
QStringList m_fieldName;
//头sql
QString m_headerSql;
//值sql
QString m_valueSql;
//已添加row数
int m_fieldAdd = 0;
};
#endif // UAVDATABASE_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save