add a window
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
# C++ objects and libs
|
||||
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.a
|
||||
*.la
|
||||
*.lai
|
||||
*.so
|
||||
*.dll
|
||||
*.dylib
|
||||
|
||||
# Qt-es
|
||||
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
*.pro.user
|
||||
*.pro.user.*
|
||||
*.qbs.user
|
||||
*.qbs.user.*
|
||||
*.moc
|
||||
moc_*.cpp
|
||||
moc_*.h
|
||||
qrc_*.cpp
|
||||
ui_*.h
|
||||
Makefile*
|
||||
*build-*
|
||||
|
||||
# QtCreator
|
||||
|
||||
*.autosave
|
||||
|
||||
# QtCtreator Qml
|
||||
*.qmlproject.user
|
||||
*.qmlproject.user.*
|
||||
|
||||
# QtCtreator CMake
|
||||
CMakeLists.txt.user*
|
||||
@@ -28,12 +28,14 @@ SOURCES += \
|
||||
main.cpp \
|
||||
radar.cpp \
|
||||
serialcontroller.cpp \
|
||||
serialwidget.cpp
|
||||
serialwidget.cpp \
|
||||
waveform.cpp
|
||||
|
||||
HEADERS += \
|
||||
radar.h \
|
||||
serialcontroller.h \
|
||||
serialwidget.h
|
||||
serialwidget.h \
|
||||
waveform.h
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
|
||||
+3
-267
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.7.1, 2018-10-21T20:24:37. -->
|
||||
<!-- Written by QtCreator 4.7.1, 2018-10-23T23:12:42. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{2c3e6c03-a454-4a53-bc1b-c224563b9344}</value>
|
||||
<value type="QByteArray">{63343ee6-89a1-40cf-a082-b77d22c0828e}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
@@ -323,273 +323,9 @@
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.1</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.11.2 GCC 64bit_static</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.11.2 GCC 64bit_static</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e0a85e13-9414-41c1-b1e3-1b96941c2dc8}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">2</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/cmy/Projects/build-Radar-Desktop_Qt_5_11_2_GCC_64bit_static-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.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</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.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</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.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||
<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>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/cmy/Projects/build-Radar-Desktop_Qt_5_11_2_GCC_64bit_static-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.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</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.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</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.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||
<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="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/cmy/Projects/build-Radar-Desktop_Qt_5_11_2_GCC_64bit_static-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.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</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.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</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.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
|
||||
<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="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" 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>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy Configuration</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Radar</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/cmy/Projects/Radar/Radar.pro</value>
|
||||
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">Radar.pro</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">2</value>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
Radar r;
|
||||
// Radar r;
|
||||
|
||||
SerialWidget sw;
|
||||
|
||||
QObject::connect(&sw, &SerialWidget::deliverPos, &r, &Radar::getPos);
|
||||
r.show();
|
||||
// QObject::connect(&sw, &SerialWidget::deliverPos, &r, &Radar::getPos);
|
||||
// r.show();
|
||||
sw.show();
|
||||
|
||||
return a.exec();
|
||||
|
||||
@@ -3,29 +3,31 @@
|
||||
|
||||
Radar::Radar(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setWindowTitle(tr("Radar"));
|
||||
|
||||
setAutoFillBackground(true);
|
||||
setPalette(QPalette(Qt::black));
|
||||
lefttop = 20;
|
||||
interval = 150;
|
||||
scanAngle = 358;
|
||||
lefttop = 50;
|
||||
interval = 200;
|
||||
scanAngle = 40;
|
||||
|
||||
soundSpeed = 340;
|
||||
|
||||
lastAngle = 0;
|
||||
lastDistant = 0;
|
||||
|
||||
// test
|
||||
currentAngle = 180;
|
||||
isClock = true;
|
||||
Point p;
|
||||
p.angle = 45;
|
||||
p.dis = 20;
|
||||
currentAngle = 0;
|
||||
isClock = false;
|
||||
|
||||
baseDiameter = 800;
|
||||
|
||||
setWindowTitle(tr("Radar"));
|
||||
resize(baseDiameter+2*lefttop, baseDiameter/2+2*lefttop);
|
||||
|
||||
baseRadius = 500;
|
||||
|
||||
connect(&scanTimer,&QTimer::timeout, this, [this](){
|
||||
currentAngle++;
|
||||
this->update();
|
||||
// currentAngle++;
|
||||
// this->update();
|
||||
});
|
||||
scanTimer.start(1);
|
||||
}
|
||||
@@ -34,53 +36,89 @@ void Radar::paintEvent(QPaintEvent *)
|
||||
{
|
||||
// radar background
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setPen(QPen(Qt::green,1));
|
||||
|
||||
painter.drawLine(lefttop, lefttop + baseRadius/2,lefttop + baseRadius,lefttop + baseRadius/2);
|
||||
painter.drawLine(lefttop + baseRadius/2,lefttop, lefttop + baseRadius/2,lefttop + baseRadius);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setPen(QPen(Qt::darkGreen,1));
|
||||
|
||||
for(int i=0;i<5;++i){
|
||||
painter.drawArc(lefttop+i*interval/2,lefttop+i*interval/2,baseRadius-i*interval,baseRadius-i*interval,0,360*16);
|
||||
painter.drawArc(lefttop+i*interval/2,lefttop+i*interval/2,baseDiameter-i*interval,baseDiameter-i*interval,0,180*16);
|
||||
painter.drawText(lefttop + baseDiameter - i* interval/2, lefttop+ baseDiameter/2, QString::number(MAX_DIS - i*double(interval)/baseDiameter*MAX_DIS));
|
||||
}
|
||||
|
||||
// scan area
|
||||
QConicalGradient conicalGradient(lefttop+baseRadius/2, lefttop+baseRadius/2, currentAngle);
|
||||
QConicalGradient conicalGradient(lefttop+baseDiameter/2, lefttop+baseDiameter/2, currentAngle);
|
||||
// conicalGradient.setStops(currentAngle+scanAngle);
|
||||
conicalGradient.setAngle(currentAngle-scanAngle-1);
|
||||
|
||||
|
||||
if(isClock){
|
||||
conicalGradient.setAngle(currentAngle-scanAngle-1);
|
||||
conicalGradient.setColorAt(0, QColor(0,0,0,120));
|
||||
conicalGradient.setColorAt((scanAngle)/360.0, QColor(0,255,0,120));
|
||||
painter.setPen(QPen(QColor(0,0,0,0),1));
|
||||
painter.setBrush(QBrush(conicalGradient));
|
||||
painter.drawPie(lefttop,lefttop,baseRadius,baseRadius,(currentAngle-scanAngle)*16,scanAngle*16);
|
||||
} else{
|
||||
conicalGradient.setColorAt(0, QColor(0,255,0,120));
|
||||
conicalGradient.setAngle(currentAngle);
|
||||
conicalGradient.setColorAt(0, QColor(0,230,0,120));
|
||||
conicalGradient.setColorAt(scanAngle/360.0, QColor(0,0,0,120));
|
||||
painter.setPen(QPen(QColor(0,0,0,0),1));
|
||||
painter.setBrush(QBrush(conicalGradient));
|
||||
painter.drawPie(lefttop,lefttop,baseRadius,baseRadius,currentAngle*16,scanAngle*16);
|
||||
painter.drawPie(lefttop,lefttop,baseDiameter,baseDiameter,(currentAngle)*16,scanAngle*16);
|
||||
} else{
|
||||
conicalGradient.setColorAt(0, QColor(0,0,0,120));
|
||||
conicalGradient.setColorAt(scanAngle/360.0, QColor(0,230,0,120));
|
||||
painter.setPen(QPen(QColor(0,0,0,0),1));
|
||||
painter.setBrush(QBrush(conicalGradient));
|
||||
painter.drawPie(lefttop,lefttop,baseDiameter,baseDiameter,(currentAngle-scanAngle)*16,scanAngle*16);
|
||||
}
|
||||
// painter.drawRect(250,250,20,20);
|
||||
// painter.drawRect(250,250,20,20);
|
||||
|
||||
// draw target
|
||||
painter.setPen(QPen(Qt::red));
|
||||
painter.setBrush(QBrush(Qt::red));
|
||||
painter.setPen(QPen(Qt::green));
|
||||
painter.setBrush(QBrush(Qt::green));
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
double angle = i;
|
||||
double dis = distances[i];
|
||||
// qDebug()<<dis;
|
||||
double x = lefttop + baseRadius / 2 + dis*qCos(qDegreesToRadians(angle));
|
||||
double y = lefttop + baseRadius / 2 - dis*qSin(qDegreesToRadians(angle));
|
||||
// qDebug()<<dis;
|
||||
double x = lefttop + baseDiameter / 2 + dis*qCos(qDegreesToRadians(angle));
|
||||
double y = lefttop + baseDiameter / 2 - dis*qSin(qDegreesToRadians(angle));
|
||||
// qDebug() << "draw point: " << x << " " << y;
|
||||
painter.drawPoint(int(x), int(y));
|
||||
painter.drawEllipse(int(x), int(y), 5, 5);
|
||||
}
|
||||
|
||||
painter.setPen(QPen(Qt::black));
|
||||
painter.setBrush(QBrush(Qt::black));
|
||||
painter.drawPie(lefttop,lefttop,baseDiameter,baseDiameter,180*16,180*16);
|
||||
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setPen(QPen(Qt::darkGreen,1));
|
||||
|
||||
painter.drawLine(lefttop, lefttop + baseDiameter/2,lefttop + baseDiameter,lefttop + baseDiameter/2);
|
||||
painter.drawLine(lefttop + baseDiameter/2,lefttop, lefttop + baseDiameter/2,lefttop + baseDiameter/2);
|
||||
|
||||
}
|
||||
|
||||
double Radar::convertDis(int dis)
|
||||
{
|
||||
return dis*soundSpeed/20000.0;
|
||||
}
|
||||
|
||||
void Radar::getPos(int ang, int dis)
|
||||
{
|
||||
distances[ang] = dis;
|
||||
mst=dis;
|
||||
if(ang == 255){
|
||||
memset(distances, 0,255*sizeof (int));
|
||||
distances[90] = int(convertDis(dis)/MAX_DIS*baseDiameter/2);
|
||||
|
||||
}
|
||||
else{
|
||||
distances[ang] = int(convertDis(dis)/MAX_DIS*baseDiameter/2);
|
||||
}
|
||||
qDebug()<<convertDis(dis);
|
||||
lastAngle = currentAngle;
|
||||
currentAngle = ang;
|
||||
isClock = currentAngle < lastAngle;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void Radar::setSoundSpeed(double speed)
|
||||
{
|
||||
soundSpeed = speed*20000/mst;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#include <QPalette>
|
||||
#include <QPalette>parent
|
||||
#include <QtMath>
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
|
||||
class Radar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -16,12 +15,14 @@ public:
|
||||
explicit Radar(QWidget *parent = nullptr);
|
||||
void paintEvent(QPaintEvent *);
|
||||
private:
|
||||
struct Point{
|
||||
double angle;
|
||||
double dis;
|
||||
};
|
||||
|
||||
inline double convertDis(int dis);
|
||||
int mst;
|
||||
|
||||
int distances[256] = {0};
|
||||
int MAX_DIS = 100;
|
||||
|
||||
double soundSpeed;
|
||||
|
||||
QTimer scanTimer;
|
||||
int lefttop;
|
||||
@@ -31,7 +32,7 @@ private:
|
||||
int currentAngle, lastAngle;
|
||||
int currentDistant, lastDistant;
|
||||
bool isClock;
|
||||
int baseRadius;
|
||||
int baseDiameter;
|
||||
|
||||
|
||||
|
||||
@@ -40,6 +41,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
void getPos(int ang, int dis);
|
||||
void setSoundSpeed(double speed);
|
||||
};
|
||||
|
||||
#endif // RADAR_H
|
||||
|
||||
@@ -6,6 +6,7 @@ SerialController::SerialController(QObject *parent) : QObject(parent)
|
||||
serial = new QSerialPort(this);
|
||||
connect(serial, SIGNAL(readyRead()), this,SLOT(handleRecv()));
|
||||
|
||||
|
||||
// QList<QSerialPortInfo> SerialList = QSerialPortInfo::availablePorts();
|
||||
// if(SerialList.size()!=0){
|
||||
// openSerial(SerialList[0].portName());
|
||||
@@ -109,3 +110,13 @@ void SerialController::controlDTR(bool set)
|
||||
{
|
||||
serial->setDataTerminalReady(set);
|
||||
}
|
||||
|
||||
void SerialController::writeData(QString content)
|
||||
{
|
||||
if (serial->isWritable())
|
||||
{
|
||||
qint64 result = serial->write(content.toLocal8Bit().data());
|
||||
// if (result == -1);
|
||||
// else;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ private:
|
||||
int testWise;
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
void sendPos(int angle, int dis);
|
||||
void openSuccess();
|
||||
@@ -37,6 +38,7 @@ public slots:
|
||||
void getParity(QString parity);
|
||||
void contrloRTS(bool set);
|
||||
void controlDTR(bool set);
|
||||
void writeData(QString content);
|
||||
};
|
||||
|
||||
#endif // SERIALCONTROLLER_H
|
||||
|
||||
+60
-20
@@ -5,24 +5,32 @@ SerialWidget::SerialWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
setWindowTitle(tr("Control panel"));
|
||||
|
||||
radar = new Radar();
|
||||
radar->show();
|
||||
connect(this, &SerialWidget::deliverPos, radar, &Radar::getPos);
|
||||
|
||||
wave = new Waveform();
|
||||
wave->show();
|
||||
connect(this, &SerialWidget::deliverPos, wave, &Waveform::getPos);
|
||||
|
||||
serialController = new SerialController;
|
||||
serialController->moveToThread(&SerialThr);
|
||||
SerialThr.start();
|
||||
BaudrateList << "115200";
|
||||
// BaudrateList << "256000"
|
||||
// << "230400"
|
||||
// << "128000"
|
||||
// << "115200"
|
||||
// << "76800"
|
||||
// << "57600"
|
||||
// << "43000"
|
||||
// << "38400"
|
||||
// << "19200"
|
||||
// << "14400"
|
||||
// << "9600"
|
||||
// << "4800"
|
||||
// << "2400"
|
||||
// << "1200";
|
||||
// BaudrateList << "115200";
|
||||
BaudrateList << "256000"
|
||||
<< "230400"
|
||||
<< "128000"
|
||||
<< "115200"
|
||||
<< "76800"
|
||||
<< "57600"
|
||||
<< "43000"
|
||||
<< "38400"
|
||||
<< "19200"
|
||||
<< "14400"
|
||||
<< "9600"
|
||||
<< "4800"
|
||||
<< "2400"
|
||||
<< "1200";
|
||||
StopbitsList << "1"
|
||||
<< "1.5"
|
||||
<< "2";
|
||||
@@ -36,7 +44,7 @@ SerialWidget::SerialWidget(QWidget *parent) : QWidget(parent)
|
||||
COMBox = new QComboBox();
|
||||
BaudrateBox = new QComboBox();
|
||||
BaudrateBox->addItems(BaudrateList);
|
||||
// BaudrateBox->setCurrentIndex(settings.value("Baud rate", 0).toInt());
|
||||
BaudrateBox->setCurrentIndex(3);
|
||||
StopbitsBox = new QComboBox();
|
||||
StopbitsBox->addItems(StopbitsList);
|
||||
// StopbitsBox->setCurrentIndex(settings.value("Stop bits", 0).toInt());
|
||||
@@ -53,8 +61,19 @@ SerialWidget::SerialWidget(QWidget *parent) : QWidget(parent)
|
||||
DatabitsLabel = new QLabel(tr("数据位"));
|
||||
ParityLabel = new QLabel(tr("校验位"));
|
||||
|
||||
//LineEdit
|
||||
QDoubleValidator *validator = new QDoubleValidator(0, 100, 2, this);
|
||||
|
||||
sendArea = new QLineEdit(this);
|
||||
sendArea->setValidator(validator);
|
||||
sendArea->setText(tr("0"));
|
||||
|
||||
//按钮
|
||||
OpenButton = new QPushButton(tr("打开串口"));
|
||||
calibrationButton = new QPushButton(tr("Calibrate Mode"));
|
||||
calibrationButton->setDisabled(true);
|
||||
//校准
|
||||
connect(calibrationButton, &QPushButton::clicked, this, &SerialWidget::Calibrate);
|
||||
|
||||
//checkbox
|
||||
RTSBox = new QCheckBox(tr("RTS"));
|
||||
@@ -82,7 +101,7 @@ SerialWidget::SerialWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
connect(OpenButton, &QPushButton::clicked, this, &SerialWidget::OpenSerial);
|
||||
connect(this, &SerialWidget::requestClose, serialController, &SerialController::closeSerial);
|
||||
|
||||
connect(this, &SerialWidget::sendData, serialController,&SerialController::writeData);
|
||||
|
||||
|
||||
//初始化布局
|
||||
@@ -97,6 +116,8 @@ SerialWidget::SerialWidget(QWidget *parent) : QWidget(parent)
|
||||
leftLlayout->addRow(DatabitsLabel, DatabitsBox);
|
||||
leftLlayout->addRow(ParityLabel, ParityBox);
|
||||
leftLlayout->addRow(COMLabel, COMBox);
|
||||
leftLlayout->addRow(sendArea);
|
||||
leftLlayout->addRow(calibrationButton);
|
||||
leftLlayout->addRow(OpenButton);
|
||||
leftLlayout->setAlignment(OpenButton, Qt::AlignVCenter);
|
||||
leftLlayout->setMargin(30);
|
||||
@@ -149,6 +170,8 @@ SerialWidget::SerialWidget(QWidget *parent) : QWidget(parent)
|
||||
connect(this, &SerialWidget::changeRTS, serialController, &SerialController::contrloRTS);
|
||||
connect(this, &SerialWidget::changeDTR, serialController, &SerialController::controlDTR);
|
||||
|
||||
connect(this, &SerialWidget::sendSoundSpeed, radar, &Radar::setSoundSpeed);
|
||||
connect(this, &SerialWidget::sendSoundSpeed, wave, &Waveform::setSoundSpeed);
|
||||
|
||||
|
||||
}
|
||||
@@ -197,7 +220,8 @@ void SerialWidget::CheckSerials()
|
||||
|
||||
SerialWidget::~SerialWidget()
|
||||
{
|
||||
SerialThr.exit();
|
||||
SerialThr.terminate();
|
||||
radar->close();
|
||||
}
|
||||
|
||||
|
||||
@@ -217,10 +241,12 @@ void SerialWidget::serialNotOpened()
|
||||
|
||||
void SerialWidget::serialClosed()
|
||||
{
|
||||
|
||||
isOpened = false;
|
||||
//相应控件可用性做出改变(setDisabled)
|
||||
ACtionAttachToSerial(false);
|
||||
}
|
||||
|
||||
void SerialWidget::getRecv(double ang, double dis)
|
||||
void SerialWidget::getRecv(int ang, int dis)
|
||||
{
|
||||
emit deliverPos(ang, dis);
|
||||
}
|
||||
@@ -241,6 +267,18 @@ void SerialWidget::CloseSerial()
|
||||
|
||||
}
|
||||
|
||||
void SerialWidget::Calibrate()
|
||||
{
|
||||
if(calibrationButton->text()==tr("Calibrate Mode")){
|
||||
emit sendData(tr("S"));
|
||||
calibrationButton->setText(tr("Confirm"));
|
||||
} else{
|
||||
emit sendData(tr("R"));
|
||||
calibrationButton->setText(tr("Calibrate Mode"));
|
||||
emit sendSoundSpeed(sendArea->text().toDouble());
|
||||
}
|
||||
}
|
||||
|
||||
void SerialWidget::ACtionAttachToSerial(bool set)
|
||||
{
|
||||
//根据串口开关状态决定一些控件的可用性
|
||||
@@ -251,6 +289,7 @@ void SerialWidget::ACtionAttachToSerial(bool set)
|
||||
//SendButton->setDisabled(false);
|
||||
disconnect(OpenButton, &QPushButton::clicked, this, &SerialWidget::OpenSerial);
|
||||
connect(OpenButton, &QPushButton::clicked, this, &SerialWidget::CloseSerial);
|
||||
calibrationButton->setDisabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -259,5 +298,6 @@ void SerialWidget::ACtionAttachToSerial(bool set)
|
||||
//SendButton->setDisabled(true);
|
||||
disconnect(OpenButton, &QPushButton::clicked, this, &SerialWidget::CloseSerial);
|
||||
connect(OpenButton, &QPushButton::clicked, this, &SerialWidget::OpenSerial);
|
||||
calibrationButton->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-4
@@ -14,7 +14,10 @@
|
||||
#include <QTimer>
|
||||
#include <QMessageBox>
|
||||
#include <QThread>
|
||||
#include <QLineEdit>
|
||||
#include "serialcontroller.h"
|
||||
#include "radar.h"
|
||||
#include "waveform.h"
|
||||
|
||||
class SerialWidget : public QWidget
|
||||
{
|
||||
@@ -33,19 +36,21 @@ signals:
|
||||
void setStopBits(QString stopbits);
|
||||
void setDataBits(QString databits);
|
||||
void setParity(QString parity);
|
||||
// void sendData(QString content);
|
||||
void sendData(QString content);
|
||||
void changeRTS(bool set);
|
||||
void changeDTR(bool set);
|
||||
|
||||
void deliverPos(int ang,int dis);
|
||||
void sendSoundSpeed(double s);
|
||||
|
||||
public slots:
|
||||
void serialOpened(); //串口打开成功
|
||||
void serialNotOpened(); //串口打开失败
|
||||
void serialClosed(); //串口关闭
|
||||
void getRecv(double ang,double dis); //串口接受数据
|
||||
void getRecv(int ang, int dis); //串口接受数据
|
||||
void OpenSerial();
|
||||
void CloseSerial();
|
||||
void Calibrate();
|
||||
// void ClearRecv();
|
||||
// void ClearSend();
|
||||
// void detNewLine(int state); //处理发送新行
|
||||
@@ -62,12 +67,12 @@ private:
|
||||
QStringList COMList, PortNameList, DescList;
|
||||
QLabel *COMLabel, *BaudrateLabel, *StopbitsLabel, *DatabitsLabel, *ParityLabel;
|
||||
QCheckBox *RTSBox, *DTRBox;
|
||||
// QGridLayout *centralLayout;
|
||||
QVBoxLayout *cvlayout;
|
||||
QHBoxLayout *bottomLayout;
|
||||
QFormLayout *leftLlayout;
|
||||
QLineEdit *sendArea;
|
||||
// QTextEdit *RecvArea, *SendArea;
|
||||
QPushButton *OpenButton, *SendButton;
|
||||
QPushButton *OpenButton, *SendButton, *calibrationButton;
|
||||
QTimer *CheckTimer;
|
||||
SerialController *serialController;
|
||||
QThread SerialThr;
|
||||
@@ -77,6 +82,9 @@ private:
|
||||
bool isRecvHex = false;
|
||||
bool isOpened = false;
|
||||
|
||||
Radar *radar;
|
||||
Waveform *wave;
|
||||
|
||||
// QString HexStringToString(QString hexstr); //解码16进制字符串
|
||||
void ACtionAttachToSerial(bool set);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "waveform.h"
|
||||
|
||||
Waveform::Waveform(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
top = 100;
|
||||
left = 100;
|
||||
soundSpeed = 340;
|
||||
|
||||
resize(2*left + 180*3, 2*top+MAX_DIS);
|
||||
setAutoFillBackground(true);
|
||||
setPalette(QPalette(Qt::lightGray));
|
||||
}
|
||||
|
||||
void Waveform::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setPen(QPen(Qt::black,1));
|
||||
|
||||
//horizon
|
||||
painter.drawLine(left, top+MAX_DIS, left+180 * 3, top + MAX_DIS);
|
||||
//ver
|
||||
painter.drawLine(left, top, left, top+MAX_DIS);
|
||||
|
||||
// draw target
|
||||
painter.setPen(QPen(Qt::black));
|
||||
painter.setBrush(QBrush(Qt::black));
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
if(distances[i]!=0){
|
||||
double angle = i;
|
||||
double dis = distances[i];
|
||||
// qDebug()<<dis;
|
||||
double x = left + angle*3;
|
||||
double y = top + MAX_DIS - dis;
|
||||
// qDebug() << "draw point: " << x << " " << y;
|
||||
// painter.drawPoint(int(x), int(y));
|
||||
painter.drawEllipse(int(x), int(y), 2, 2);
|
||||
}
|
||||
}
|
||||
for(int i=0;i<5;++i){
|
||||
painter.drawText(left+i*45*3 - 5,10+top+MAX_DIS, QString::number(i*45));
|
||||
}
|
||||
for(int i=0;i<4;++i){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double Waveform::convertDis(int dis)
|
||||
{
|
||||
return dis*soundSpeed/20000.0;
|
||||
}
|
||||
|
||||
void Waveform::getPos(int ang, int dis)
|
||||
{
|
||||
mst = dis;
|
||||
distances[ang] = int(convertDis(dis));
|
||||
qDebug()<<convertDis(dis);
|
||||
lastAngle = currentAngle;
|
||||
currentAngle = ang;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void Waveform::setSoundSpeed(double speed)
|
||||
{
|
||||
soundSpeed = speed*20000/mst;
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#ifndef WAVEFORM_H
|
||||
#define WAVEFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
class Waveform : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
inline double convertDis(int dis);
|
||||
int distances[256] = {0};
|
||||
int top;
|
||||
int left;
|
||||
int mst;
|
||||
|
||||
int MAX_DIS = 400;
|
||||
public:
|
||||
explicit Waveform(QWidget *parent = nullptr);
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
int currentAngle, lastAngle;
|
||||
double soundSpeed;
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void getPos(int ang, int dis);
|
||||
void setSoundSpeed(double speed);
|
||||
};
|
||||
|
||||
#endif // WAVEFORM_H
|
||||
Reference in New Issue
Block a user