首页美化框架已完成

master
LKeynes 4 years ago
parent 0df11545dc
commit 7b8c88a16b

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2021-07-07T08:43:09. --> <!-- Written by QtCreator 4.11.1, 2021-01-06T09:35:14. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
<value type="QByteArray">{4109ff11-a646-43d1-9619-aeb32783df6e}</value> <value type="QByteArray">{0c4c8ccc-c524-4850-ba23-7e124d5915df}</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -71,7 +71,7 @@
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/QtDemo/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -119,7 +119,7 @@
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/QtDemo/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -167,7 +167,7 @@
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/QtDemo/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -287,8 +287,8 @@
</valuelist> </valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/13648/Desktop/Trip-in-Chang-sha-042a8abb0ff29b210015c9bef1bad274bdb5d3d5/ChangShaTour/ChangShaTour.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:F:/QtDemo/ChangShaTour/ChangShaTour.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/13648/Desktop/Trip-in-Chang-sha-042a8abb0ff29b210015c9bef1bad274bdb5d3d5/ChangShaTour/ChangShaTour.pro</value> <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">F:/QtDemo/ChangShaTour/ChangShaTour.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value> <value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value> <value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value> <value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
@ -299,257 +299,14 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value> <value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release</value> <value type="QString" key="RunConfiguration.WorkingDirectory.default">F:/QtDemo/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release</value>
</valuemap>
<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.14.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win64_mingw73_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</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">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-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.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.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<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>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</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">Build</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>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<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>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</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">Clean</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.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">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-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.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.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<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>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</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">Build</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>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<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>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</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">Clean</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.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-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.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.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<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>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</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">Build</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>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<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>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</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">Clean</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.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</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">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</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.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="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
<value type="QString">-e</value>
<value type="QString">cpu-cycles</value>
<value type="QString">--call-graph</value>
<value type="QString">dwarf,4096</value>
<value type="QString">-F</value>
<value type="QString">250</value>
</valuelist>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<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="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</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.CustomExecutableRunConfiguration.Executable"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></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>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.TargetCount</variable> <variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">2</value> <value type="int">1</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable> <variable>ProjectExplorer.Project.Updater.FileVersion</variable>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,22 +1,22 @@
#include <QMetaType> #include <QMetaType>
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
#ifndef ROUTEITEM_H #ifndef ROUTEITEM_H
#define ROUTEITEM_H #define ROUTEITEM_H
struct routeItem{ struct routeItem{
QString placeName; QString placeName;
QString url; QString url;
QString cateId; QString cateId;
QDateTime startTime; QDateTime startTime;
QDateTime endTime; QDateTime endTime;
QString traffic; QString traffic;
double distance; double distance;
double timeCost; double timeCost;
QString description; QString description;
struct routeItem * next; struct routeItem * next;
}; };
typedef struct routeItem RouteItem; typedef struct routeItem RouteItem;
#endif // ROUTEITEM_H #endif // ROUTEITEM_H

@ -1,47 +1,47 @@
#include "addhistory.h" #include "addhistory.h"
//将店铺的链接加入history数据库 //将店铺的链接加入history数据库
AddHistory::AddHistory() AddHistory::AddHistory()
{ {
} }
void AddHistory::add(QString url) void AddHistory::add(QString url)
{ {
QSqlQuery query(userDb); QSqlQuery query(userDb);
query.prepare("select historyId from history where url=?"); query.prepare("select historyId from history where url=?");
query.addBindValue(url); query.addBindValue(url);
query.exec(); query.exec();
query.next(); query.next();
if(query.isValid()) if(query.isValid())
{ {
query.prepare("update history set createdtime = now() where url=?"); query.prepare("update history set createdtime = now() where url=?");
query.addBindValue(url); query.addBindValue(url);
query.exec(); query.exec();
return ; return ;
} }
query.prepare("select count(*) from history where id = ?"); query.prepare("select count(*) from history where id = ?");
query.addBindValue(Id); query.addBindValue(Id);
query.exec(); query.exec();
query.next(); query.next();
int count=query.value(0).toInt(); int count=query.value(0).toInt();
if(count>=limit) if(count>=limit)
{ {
query.prepare("select historyId from history where id = ? order by createdtime"); query.prepare("select historyId from history where id = ? order by createdtime");
query.addBindValue(Id); query.addBindValue(Id);
query.exec(); query.exec();
query.next(); query.next();
int historyId=query.value("historyId").toInt(); int historyId=query.value("historyId").toInt();
query.prepare("update history set url = ?, createdtime = now() where historyId=?"); query.prepare("update history set url = ?, createdtime = now() where historyId=?");
query.addBindValue(url); query.addBindValue(url);
query.addBindValue(historyId); query.addBindValue(historyId);
query.exec(); query.exec();
} }
else else
{ {
query.prepare("insert into history (id,url)values(?,?)"); query.prepare("insert into history (id,url)values(?,?)");
query.addBindValue(Id); query.addBindValue(Id);
query.addBindValue(url); query.addBindValue(url);
query.exec(); query.exec();
} }
} }

@ -1,16 +1,16 @@
#ifndef ADDHISTORY_H #ifndef ADDHISTORY_H
#define ADDHISTORY_H #define ADDHISTORY_H
#include <QString> #include <QString>
#include <QSqlQuery> #include <QSqlQuery>
#include "cglobal.h" #include "cglobal.h"
class AddHistory class AddHistory
{ {
public: public:
AddHistory(); AddHistory();
void add(QString id); void add(QString id);
private: private:
int limit; int limit;
}; };
#endif // ADDHISTORY_H #endif // ADDHISTORY_H

@ -1,101 +1,101 @@
#include "cglobal.h" #include "cglobal.h"
qint64 Id; qint64 Id;
QSqlDatabase meituanDb; QSqlDatabase meituanDb;
QSqlDatabase userDb; QSqlDatabase userDb;
QSqlDatabase listDb; QSqlDatabase listDb;
QMap<QString,QString> labelToDb; QMap<QString,QString> labelToDb;
QStringList recommendlabel; QStringList recommendlabel;
cglobal::cglobal() cglobal::cglobal()
{ {
} }
void cglobal::labelmap() void cglobal::labelmap()
{ {
//food //food
labelToDb[QStringLiteral("代金券")]="food"; labelToDb[QStringLiteral("代金券")]="food";
labelToDb[QStringLiteral("蛋糕甜点")]="food"; labelToDb[QStringLiteral("蛋糕甜点")]="food";
labelToDb[QStringLiteral("自助餐")]="food"; labelToDb[QStringLiteral("自助餐")]="food";
labelToDb[QStringLiteral("小吃快餐")]="food"; labelToDb[QStringLiteral("小吃快餐")]="food";
labelToDb[QStringLiteral("火锅")]="food"; labelToDb[QStringLiteral("火锅")]="food";
labelToDb[QStringLiteral("日韩料理")]="food"; labelToDb[QStringLiteral("日韩料理")]="food";
labelToDb[QStringLiteral("西餐")]="food"; labelToDb[QStringLiteral("西餐")]="food";
labelToDb[QStringLiteral("烧烤烤肉")]="food"; labelToDb[QStringLiteral("烧烤烤肉")]="food";
labelToDb[QStringLiteral("川湘菜")]="food"; labelToDb[QStringLiteral("川湘菜")]="food";
labelToDb[QStringLiteral("东北菜")]="food"; labelToDb[QStringLiteral("东北菜")]="food";
labelToDb[QStringLiteral("江浙菜")]="food"; labelToDb[QStringLiteral("江浙菜")]="food";
labelToDb[QStringLiteral("中式烧烤/烤串")]="food"; labelToDb[QStringLiteral("中式烧烤/烤串")]="food";
labelToDb[QStringLiteral("香锅烤鱼")]="food"; labelToDb[QStringLiteral("香锅烤鱼")]="food";
labelToDb[QStringLiteral("粤菜")]="food"; labelToDb[QStringLiteral("粤菜")]="food";
labelToDb[QStringLiteral("西北菜")]="food"; labelToDb[QStringLiteral("西北菜")]="food";
labelToDb[QStringLiteral("咖啡酒吧")]="food"; labelToDb[QStringLiteral("咖啡酒吧")]="food";
labelToDb[QStringLiteral("京菜鲁菜")]="food"; labelToDb[QStringLiteral("京菜鲁菜")]="food";
labelToDb[QStringLiteral("云贵菜")]="food"; labelToDb[QStringLiteral("云贵菜")]="food";
labelToDb[QStringLiteral("东南亚菜")]="food"; labelToDb[QStringLiteral("东南亚菜")]="food";
labelToDb[QStringLiteral("海鲜")]="food"; labelToDb[QStringLiteral("海鲜")]="food";
labelToDb[QStringLiteral("素食")]="food"; labelToDb[QStringLiteral("素食")]="food";
labelToDb[QStringLiteral("台湾/客家菜")]="food"; labelToDb[QStringLiteral("台湾/客家菜")]="food";
labelToDb[QStringLiteral("创意菜")]="food"; labelToDb[QStringLiteral("创意菜")]="food";
labelToDb[QStringLiteral("汤/洲/炖菜")]="food"; labelToDb[QStringLiteral("汤/洲/炖菜")]="food";
labelToDb[QStringLiteral("蒙餐")]="food"; labelToDb[QStringLiteral("蒙餐")]="food";
labelToDb[QStringLiteral("新疆菜")]="food"; labelToDb[QStringLiteral("新疆菜")]="food";
labelToDb[QStringLiteral("其他美食")]="food"; labelToDb[QStringLiteral("其他美食")]="food";
labelToDb[QStringLiteral("聚餐宴请")]="food"; labelToDb[QStringLiteral("聚餐宴请")]="food";
//attractions //attractions
labelToDb[QStringLiteral("景点")]="attractions"; labelToDb[QStringLiteral("景点")]="attractions";
//entertainment //entertainment
labelToDb[QStringLiteral("新奇体验")]="entertainment"; labelToDb[QStringLiteral("新奇体验")]="entertainment";
labelToDb[QStringLiteral("团建拓展")]="entertainment"; labelToDb[QStringLiteral("团建拓展")]="entertainment";
labelToDb[QStringLiteral("足疗/按摩")]="entertainment"; labelToDb[QStringLiteral("足疗/按摩")]="entertainment";
labelToDb[QStringLiteral("洗浴/汗蒸")]="entertainment"; labelToDb[QStringLiteral("洗浴/汗蒸")]="entertainment";
labelToDb[QStringLiteral("KTV")]="entertainment"; labelToDb[QStringLiteral("KTV")]="entertainment";
labelToDb[QStringLiteral("酒吧")]="entertainment"; labelToDb[QStringLiteral("酒吧")]="entertainment";
labelToDb[QStringLiteral("电玩/游戏厅")]="entertainment"; labelToDb[QStringLiteral("电玩/游戏厅")]="entertainment";
labelToDb[QStringLiteral("运动健身")]="entertainment"; labelToDb[QStringLiteral("运动健身")]="entertainment";
labelToDb[QStringLiteral("私人影院")]="entertainment"; labelToDb[QStringLiteral("私人影院")]="entertainment";
labelToDb[QStringLiteral("DIY手工坊")]="entertainment"; labelToDb[QStringLiteral("DIY手工坊")]="entertainment";
labelToDb[QStringLiteral("密室逃脱")]="entertainment"; labelToDb[QStringLiteral("密室逃脱")]="entertainment";
labelToDb[QStringLiteral("网吧网咖")]="entertainment"; labelToDb[QStringLiteral("网吧网咖")]="entertainment";
labelToDb[QStringLiteral("茶馆")]="entertainment"; labelToDb[QStringLiteral("茶馆")]="entertainment";
labelToDb[QStringLiteral("轰趴馆")]="entertainment"; labelToDb[QStringLiteral("轰趴馆")]="entertainment";
labelToDb[QStringLiteral("棋牌室")]="entertainment"; labelToDb[QStringLiteral("棋牌室")]="entertainment";
labelToDb[QStringLiteral("桌游")]="entertainment"; labelToDb[QStringLiteral("桌游")]="entertainment";
labelToDb[QStringLiteral("真人CS")]="entertainment"; labelToDb[QStringLiteral("真人CS")]="entertainment";
labelToDb[QStringLiteral("采摘/农家乐")]="entertainment"; labelToDb[QStringLiteral("采摘/农家乐")]="entertainment";
labelToDb[QStringLiteral("VR")]="entertainment"; labelToDb[QStringLiteral("VR")]="entertainment";
//hotel //hotel
labelToDb[QStringLiteral("经济型酒店")]="hotel"; labelToDb[QStringLiteral("经济型酒店")]="hotel";
labelToDb[QStringLiteral("主题酒店")]="hotel"; labelToDb[QStringLiteral("主题酒店")]="hotel";
labelToDb[QStringLiteral("商务酒店")]="hotel"; labelToDb[QStringLiteral("商务酒店")]="hotel";
labelToDb[QStringLiteral("公寓")]="hotel"; labelToDb[QStringLiteral("公寓")]="hotel";
labelToDb[QStringLiteral("豪华酒店")]="hotel"; labelToDb[QStringLiteral("豪华酒店")]="hotel";
labelToDb[QStringLiteral("客栈")]="hotel"; labelToDb[QStringLiteral("客栈")]="hotel";
labelToDb[QStringLiteral("青年旅社")]="hotel"; labelToDb[QStringLiteral("青年旅社")]="hotel";
labelToDb[QStringLiteral("度假酒店")]="hotel"; labelToDb[QStringLiteral("度假酒店")]="hotel";
labelToDb[QStringLiteral("别墅")]="hotel"; labelToDb[QStringLiteral("别墅")]="hotel";
labelToDb[QStringLiteral("民宿")]="hotel"; labelToDb[QStringLiteral("民宿")]="hotel";
//sport //sport
labelToDb[QStringLiteral("滑翔伞")]="sport"; labelToDb[QStringLiteral("滑翔伞")]="sport";
labelToDb[QStringLiteral("赛车")]="sport"; labelToDb[QStringLiteral("赛车")]="sport";
labelToDb[QStringLiteral("游泳")]="sport"; labelToDb[QStringLiteral("游泳")]="sport";
labelToDb[QStringLiteral("健身中心")]="sport"; labelToDb[QStringLiteral("健身中心")]="sport";
labelToDb[QStringLiteral("羽毛球")]="sport"; labelToDb[QStringLiteral("羽毛球")]="sport";
labelToDb[QStringLiteral("台球")]="sport"; labelToDb[QStringLiteral("台球")]="sport";
labelToDb[QStringLiteral("武术")]="sport"; labelToDb[QStringLiteral("武术")]="sport";
labelToDb[QStringLiteral("保龄球")]="sport"; labelToDb[QStringLiteral("保龄球")]="sport";
labelToDb[QStringLiteral("高尔夫")]="sport"; labelToDb[QStringLiteral("高尔夫")]="sport";
labelToDb[QStringLiteral("篮球")]="sport"; labelToDb[QStringLiteral("篮球")]="sport";
labelToDb[QStringLiteral("滑冰")]="sport"; labelToDb[QStringLiteral("滑冰")]="sport";
labelToDb[QStringLiteral("射击射箭")]="sport"; labelToDb[QStringLiteral("射击射箭")]="sport";
labelToDb[QStringLiteral("网球")]="sport"; labelToDb[QStringLiteral("网球")]="sport";
labelToDb[QStringLiteral("骑马")]="sport"; labelToDb[QStringLiteral("骑马")]="sport";
labelToDb[QStringLiteral("乒乓球")]="sport"; labelToDb[QStringLiteral("乒乓球")]="sport";
labelToDb[QStringLiteral("体育球馆")]="sport"; labelToDb[QStringLiteral("体育球馆")]="sport";
recommendlabel<<QStringLiteral("川湘菜")<<QStringLiteral("景点")<<QStringLiteral("运动健身")<<QStringLiteral("民宿")<<QStringLiteral("蛋糕甜点")<<QStringLiteral("自助餐")<<QStringLiteral("小吃快餐")<<QStringLiteral("火锅")<<QStringLiteral("日韩料理")<<QStringLiteral("西餐")<<QStringLiteral("烧烤烤肉")<<QStringLiteral("东北菜")<<QStringLiteral("江浙菜")<<QStringLiteral("中式烧烤/烤串")<<QStringLiteral("香锅烤鱼")<<QStringLiteral("粤菜")<<QStringLiteral("西北菜")<<QStringLiteral("咖啡酒吧")<<QStringLiteral("云贵菜")<<QStringLiteral("京菜鲁菜")<<QStringLiteral("东南亚菜")<<QStringLiteral("海鲜")<<QStringLiteral("素食")<<QStringLiteral("台湾/客家菜")<<QStringLiteral("创意菜")<<QStringLiteral("汤/洲/炖菜")<<QStringLiteral("蒙餐")<<QStringLiteral("新疆菜")<<QStringLiteral("其他美食")<<QStringLiteral("聚餐宴请"); recommendlabel<<QStringLiteral("川湘菜")<<QStringLiteral("景点")<<QStringLiteral("运动健身")<<QStringLiteral("民宿")<<QStringLiteral("蛋糕甜点")<<QStringLiteral("自助餐")<<QStringLiteral("小吃快餐")<<QStringLiteral("火锅")<<QStringLiteral("日韩料理")<<QStringLiteral("西餐")<<QStringLiteral("烧烤烤肉")<<QStringLiteral("东北菜")<<QStringLiteral("江浙菜")<<QStringLiteral("中式烧烤/烤串")<<QStringLiteral("香锅烤鱼")<<QStringLiteral("粤菜")<<QStringLiteral("西北菜")<<QStringLiteral("咖啡酒吧")<<QStringLiteral("云贵菜")<<QStringLiteral("京菜鲁菜")<<QStringLiteral("东南亚菜")<<QStringLiteral("海鲜")<<QStringLiteral("素食")<<QStringLiteral("台湾/客家菜")<<QStringLiteral("创意菜")<<QStringLiteral("汤/洲/炖菜")<<QStringLiteral("蒙餐")<<QStringLiteral("新疆菜")<<QStringLiteral("其他美食")<<QStringLiteral("聚餐宴请");
recommendlabel<<QStringLiteral("经济型酒店")<<QStringLiteral("主题酒店")<<QStringLiteral("商务酒店")<<QStringLiteral("公寓")<<QStringLiteral("豪华酒店")<<QStringLiteral("客栈")<<QStringLiteral("青年旅社")<<QStringLiteral("度假酒店")<<QStringLiteral("别墅"); recommendlabel<<QStringLiteral("经济型酒店")<<QStringLiteral("主题酒店")<<QStringLiteral("商务酒店")<<QStringLiteral("公寓")<<QStringLiteral("豪华酒店")<<QStringLiteral("客栈")<<QStringLiteral("青年旅社")<<QStringLiteral("度假酒店")<<QStringLiteral("别墅");
recommendlabel<<QStringLiteral("代金券")<<QStringLiteral("新奇体验")<<QStringLiteral("团建扩展")<<QStringLiteral("足疗/按摩")<<QStringLiteral("洗浴/汗蒸")<<QStringLiteral("KTV")<<QStringLiteral("酒吧")<<QStringLiteral("电玩/游戏厅")<<QStringLiteral("私人影院")<<QStringLiteral("DIY手工坊")<<QStringLiteral("密室逃脱")<<QStringLiteral("网吧网咖")<<QStringLiteral("茶馆")<<QStringLiteral("棋牌室")<<QStringLiteral("轰趴馆")<<QStringLiteral("桌游")<<QStringLiteral("真人CS")<<QStringLiteral("采摘/农家乐")<<QStringLiteral("VR"); recommendlabel<<QStringLiteral("代金券")<<QStringLiteral("新奇体验")<<QStringLiteral("团建扩展")<<QStringLiteral("足疗/按摩")<<QStringLiteral("洗浴/汗蒸")<<QStringLiteral("KTV")<<QStringLiteral("酒吧")<<QStringLiteral("电玩/游戏厅")<<QStringLiteral("私人影院")<<QStringLiteral("DIY手工坊")<<QStringLiteral("密室逃脱")<<QStringLiteral("网吧网咖")<<QStringLiteral("茶馆")<<QStringLiteral("棋牌室")<<QStringLiteral("轰趴馆")<<QStringLiteral("桌游")<<QStringLiteral("真人CS")<<QStringLiteral("采摘/农家乐")<<QStringLiteral("VR");
recommendlabel<<QStringLiteral("滑翔伞")<<QStringLiteral("赛车")<<QStringLiteral("游泳")<<QStringLiteral("健身中心")<<QStringLiteral("羽毛球")<<QStringLiteral("台球")<<QStringLiteral("武术")<<QStringLiteral("保龄球")<<QStringLiteral("高尔夫")<<QStringLiteral("篮球")<<QStringLiteral("滑冰")<<QStringLiteral("射击射箭")<<QStringLiteral("网球")<<QStringLiteral("骑马")<<QStringLiteral("乒乓球")<<QStringLiteral("体育场馆"); recommendlabel<<QStringLiteral("滑翔伞")<<QStringLiteral("赛车")<<QStringLiteral("游泳")<<QStringLiteral("健身中心")<<QStringLiteral("羽毛球")<<QStringLiteral("台球")<<QStringLiteral("武术")<<QStringLiteral("保龄球")<<QStringLiteral("高尔夫")<<QStringLiteral("篮球")<<QStringLiteral("滑冰")<<QStringLiteral("射击射箭")<<QStringLiteral("网球")<<QStringLiteral("骑马")<<QStringLiteral("乒乓球")<<QStringLiteral("体育场馆");
} }

@ -1,23 +1,23 @@
#ifndef CGLOBAL_H #ifndef CGLOBAL_H
#define CGLOBAL_H #define CGLOBAL_H
#include <QVariant> #include <QVariant>
#include <QMap> #include <QMap>
#include <QObject> #include <QObject>
#include <QSqlDatabase> #include <QSqlDatabase>
//全局变量定义文件include该文件即可获得用户Id //全局变量定义文件include该文件即可获得用户Id
extern qint64 Id; extern qint64 Id;
extern QSqlDatabase meituanDb; extern QSqlDatabase meituanDb;
extern QSqlDatabase userDb; extern QSqlDatabase userDb;
extern QSqlDatabase listDb; extern QSqlDatabase listDb;
extern QMap<QString,QString> labelToDb; extern QMap<QString,QString> labelToDb;
extern QStringList recommendlabel; extern QStringList recommendlabel;
class cglobal class cglobal
{ {
public: public:
cglobal(); cglobal();
void labelmap(); void labelmap();
}; };
#endif // CGLOBAL_H #endif // CGLOBAL_H

@ -8,7 +8,7 @@ CustomizeWidget::CustomizeWidget(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
num = 1; num = 1;
limit = 15; limit = 12;
startTimeList = (QDateTime *)malloc(sizeof(QDateTime) * limit); startTimeList = (QDateTime *)malloc(sizeof(QDateTime) * limit);
endTimeList = (QDateTime *)malloc(sizeof(QDateTime) * limit); endTimeList = (QDateTime *)malloc(sizeof(QDateTime) * limit);
for(int i = 0; i < limit; i++) for(int i = 0; i < limit; i++)
@ -54,8 +54,8 @@ CustomizeWidget::CustomizeWidget(QWidget *parent) :
labelList[i] = new QLabel(QString::number(i+1)); labelList[i] = new QLabel(QString::number(i+1));
labelList[i]->setAlignment(Qt::AlignCenter); labelList[i]->setAlignment(Qt::AlignCenter);
placeBtnList[i] = new QPushButton(""); placeBtnList[i] = new QPushButton("");
startEditList[i] = new QDateTimeEdit(); startEditList[i] = new QDateTimeEdit(QDateTime::currentDateTime());
endEditList[i] = new QDateTimeEdit(); endEditList[i] = new QDateTimeEdit(QDateTime::currentDateTime());
addBtnList[i] = new QPushButton("add"); addBtnList[i] = new QPushButton("add");
delBtnList[i] = new QPushButton("del"); delBtnList[i] = new QPushButton("del");
@ -120,10 +120,18 @@ void CustomizeWidget::addAt(int index)
for (int i = num - 1; i > index + 1; i--) for (int i = num - 1; i > index + 1; i--)
{ {
nameList[i] = nameList[i - 1]; nameList[i] = nameList[i - 1];
urlList[i] = urlList[i - 1];
cateIdList[i] = urlList[i - 1];
//后期还要加上修改两个时间List的语句
placeBtnList[i]->setText(nameList[i]); placeBtnList[i]->setText(nameList[i]);
//后期还要加上修改两个时间Edit的语句
} }
nameList[index + 1] = ""; nameList[index + 1] = "";
urlList[index + 1] = "";
cateIdList[index + 1] = "";
//后期还要加上修改两个时间List的语句
placeBtnList[index + 1]->setText(nameList[index + 1]); placeBtnList[index + 1]->setText(nameList[index + 1]);
//后期还要加上修改两个时间Edit的语句
} }
} }
@ -139,10 +147,18 @@ void CustomizeWidget::delAt(int index)
for (int i = index; i < num ; i++) for (int i = index; i < num ; i++)
{ {
nameList[i] = nameList[i + 1]; nameList[i] = nameList[i + 1];
urlList[i] = urlList[i + 1];
cateIdList[i] = cateIdList[i + 1];
//后期还要加上修改两个时间List的语句
placeBtnList[i]->setText(nameList[i]); placeBtnList[i]->setText(nameList[i]);
//后期还要加上修改两个时间Edit的语句
} }
nameList[num] = ""; nameList[num] = "";
urlList[num] = "";
cateIdList[num] = "";
//后期还要加上修改两个时间List的语句
placeBtnList[num]->setText(nameList[index + 1]); placeBtnList[num]->setText(nameList[index + 1]);
//后期还要加上修改两个时间Edit的语句
} }
} }
@ -150,7 +166,16 @@ void CustomizeWidget::setBtn(int index)
{ {
PopWidget * w = new PopWidget(); PopWidget * w = new PopWidget();
w->show(); w->show();
connect(w->getConfirmBtn(), &QPushButton::clicked, this, [=](){w->close();}); connect(w->getConfirmBtn(), &QPushButton::clicked, this, [=](){getResult(index, w->getChosen()); w->close();});
connect(w->getCancelBtn(), &QPushButton::clicked, this, [=](){w->close();}); connect(w->getCancelBtn(), &QPushButton::clicked, this, [=](){w->close();});
qDebug() << "Set Btn" << QString::number(index); qDebug() << "Set Btn" << QString::number(index);
} }
void CustomizeWidget::getResult(int index, QStringList chosen)
{
nameList[index] = chosen[0];
urlList[index] = chosen[1];
cateIdList[index] = chosen[2];
placeBtnList[index]->setText(nameList[index]);
}

@ -35,6 +35,7 @@ public:
void delAt(int index); void delAt(int index);
void setBtn(int index); void setBtn(int index);
QString getBtn(int index); QString getBtn(int index);
void getResult(int index, QStringList chosen);
private: private:
Ui::CustomizeWidget *ui; Ui::CustomizeWidget *ui;

@ -7,46 +7,7 @@ HomeWidget::HomeWidget(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
verLayout = new QVBoxLayout(); InitHomeWidget();
horLayout = new QHBoxLayout();
rcmdBtn = new QPushButton("猜你喜欢");
listBtn = new QPushButton("热门榜单");
sortBtn = new QPushButton("分类筛选");
planBtn = new QPushButton("方案定制");
//默认选择显示“猜你喜欢”界面
pageIndex = 0;
//rcmdBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}");
//listBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
//sortBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
//planBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
rcmdWidget = new RecommendWidget(this);
listWidget = new ListWidget(this);
sortWidget = new SortWidget(this);
planWidget = new PlanWidget(this);
rcmdWidget->setVisible(true);
listWidget->setVisible(false);
sortWidget->setVisible(false);
planWidget->setVisible(false);
setLayout(verLayout);
verLayout->addLayout(horLayout);
verLayout->addWidget(rcmdWidget);
verLayout->addWidget(listWidget);
verLayout->addWidget(sortWidget);
verLayout->addWidget(planWidget);
horLayout->addWidget(rcmdBtn);
horLayout->addWidget(listBtn);
horLayout->addWidget(sortBtn);
horLayout->addWidget(planBtn);
connect(rcmdBtn, &QPushButton::clicked, this, &HomeWidget::switchToRcmdWidget);
connect(listBtn, &QPushButton::clicked, this, &HomeWidget::switchToListWidget);
connect(sortBtn, &QPushButton::clicked, this, &HomeWidget::switchToSortWidget);
connect(planBtn, &QPushButton::clicked, this, &HomeWidget::switchToPlanWidget);
} }
void HomeWidget::switchToRcmdWidget() void HomeWidget::switchToRcmdWidget()
@ -117,3 +78,116 @@ HomeWidget::~HomeWidget()
{ {
delete ui; delete ui;
} }
void HomeWidget::SetBackground(QString url)
{
background->setPixmap(url);
background->setScaledContents(true);
}
void HomeWidget::InitHomeWidget()
{
background = new QLabel(this);
SetBackground("./softImages/homeWidget/homeWidgetBrownHalf.png");
QVBoxLayout * verLayout = new QVBoxLayout();
setLayout(verLayout);
verLayout->setMargin(0);
verLayout->setSpacing(0);
subWidget = new QWidget();
InitSubWidget();
subWidget->setFixedSize(1440, 140);
verLayout->addWidget(subWidget);
//默认选择显示“猜你喜欢”界面
pageIndex = 0;
rcmdWidget = new RecommendWidget(this);
verLayout->addWidget(rcmdWidget);
listWidget = new ListWidget(this);
verLayout->addWidget(listWidget);
sortWidget = new SortWidget(this);
verLayout->addWidget(sortWidget);
planWidget = new PlanWidget(this);
verLayout->addWidget(planWidget);
rcmdWidget->setVisible(true);
listWidget->setVisible(false);
sortWidget->setVisible(false);
planWidget->setVisible(false);
}
void HomeWidget::InitSubWidget()
{
QHBoxLayout * horiLayout = new QHBoxLayout();
subWidget->setLayout(horiLayout);
rcmdBtn = new QPushButton();
InitButton(rcmdBtn, "recommendBtn.jpg", "recommendBtnBlur.jpg");
horiLayout->addWidget(rcmdBtn);
listBtn = new QPushButton();
InitButton(listBtn, "listBtn.jpg", "listBtnBlur.jpg");
horiLayout->addWidget(listBtn);
sortBtn = new QPushButton();
InitButton(sortBtn, "sortBtn.jpg", "sortBtnBlur.jpg");
horiLayout->addWidget(sortBtn);
planBtn = new QPushButton();
InitButton(planBtn, "planBtn.jpg", "planBtnBlur.jpg");
horiLayout->addWidget(planBtn);
connect(rcmdBtn, &QPushButton::clicked, this, &HomeWidget::switchToRcmdWidget);
connect(listBtn, &QPushButton::clicked, this, &HomeWidget::switchToListWidget);
connect(sortBtn, &QPushButton::clicked, this, &HomeWidget::switchToSortWidget);
connect(planBtn, &QPushButton::clicked, this, &HomeWidget::switchToPlanWidget);
}
void HomeWidget::InitLabel(QLabel * label)
{
QFont lbl_font("Microsoft YaHei");
lbl_font.setPointSize(20);
lbl_font.setBold(true);
label->setFont(lbl_font);
label->setStyleSheet("color:#FFFFFF");
label->setAlignment(Qt::AlignRight);
}
void HomeWidget::InitButton(QPushButton * button, QString url, QString blurUrl)
{
button->setStyleSheet("QPushButton {"
"border-image: url(./softImages/homeWidget/" + blurUrl + ");"
"border-style:outset;"
"border-radius:10px;"
"min-width:100px;"
"min-height:20px;"
"padding:4px;"
"} "
"QPushButton:hover {"
"border-image: url(./softImages/homeWidget/" + url + ");"
"border-style:outset;"
"border-radius:10px;"
"min-width:100px;"
"min-height:20px;"
"padding:4px;"
"} "
"QPushButton:pressed {"
"border-image: url(./softImages/homeWidget/" + url + ");"
"border-style:outset;"
"border-radius:10px;"
"min-width:100px;"
"min-height:20px;"
"padding:4px;"
"}");
button->setFixedSize(260, 120);
}
void HomeWidget::resizeEvent(QResizeEvent *event)
{
background->resize(this->size());
}

@ -26,20 +26,30 @@ public:
explicit HomeWidget(QWidget *parent = nullptr); explicit HomeWidget(QWidget *parent = nullptr);
~HomeWidget(); ~HomeWidget();
void SetBackground(QString);
void InitHomeWidget();
void InitSubWidget();
void InitLabel(QLabel *);
void InitButton(QPushButton *, QString, QString);
void resizeEvent(QResizeEvent *event);
private: private:
Ui::HomeWidget *ui; Ui::HomeWidget *ui;
QLabel * background;
//表示现在homeWidget处在哪个界面 //表示现在homeWidget处在哪个界面
int pageIndex; int pageIndex;
QVBoxLayout *verLayout;
QHBoxLayout *horLayout;
QPushButton *rcmdBtn; QPushButton *rcmdBtn;
QPushButton *listBtn; QPushButton *listBtn;
QPushButton *sortBtn; QPushButton *sortBtn;
QPushButton *planBtn; QPushButton *planBtn;
QWidget * subWidget;
RecommendWidget *rcmdWidget; RecommendWidget *rcmdWidget;
ListWidget *listWidget; ListWidget *listWidget;
SortWidget *sortWidget; SortWidget *sortWidget;

@ -60,8 +60,8 @@ ListWidget::ListWidget(QWidget *parent) :
lineList_2[0] = line_2; lineList_2[0] = line_2;
lineList_3[0] = line_3; lineList_3[0] = line_3;
setHotList(); setHotList();
//setMinorityList(); setMinorityList();
//setFavorableList(); setFavorableList();
//设置总体布局 //设置总体布局
this->setLayout(mainLayout); this->setLayout(mainLayout);
@ -78,8 +78,8 @@ ListWidget::ListWidget(QWidget *parent) :
for (int i = 0; i < (listLen + 1); i++) for (int i = 0; i < (listLen + 1); i++)
{ {
layout_1->addLayout(lineList_1[i]); layout_1->addLayout(lineList_1[i]);
//layout_2->addLayout(lineList_2[i]); layout_2->addLayout(lineList_2[i]);
//layout_3->addLayout(lineList_3[i]); layout_3->addLayout(lineList_3[i]);
} }
connect(web->getReturnBtn(), &QPushButton::clicked, this, &ListWidget::returnWeb); connect(web->getReturnBtn(), &QPushButton::clicked, this, &ListWidget::returnWeb);
@ -188,7 +188,7 @@ void ListWidget::setHotList()
} }
void ListWidget::setMinorityList() void ListWidget::setMinorityList()
{ {
/*
QSqlQuery queryList(listDb); QSqlQuery queryList(listDb);
QSqlQuery queryMeituan(meituanDb); QSqlQuery queryMeituan(meituanDb);
int index = 1; int index = 1;
@ -225,11 +225,48 @@ void ListWidget::setMinorityList()
index++; index++;
} }
*/
QSqlQuery queryList(listDb);
QSqlQuery queryMeituan(meituanDb);
int index = 1;
queryList.prepare("select * from minoritylist order by score desc");
//queryList.bindValue(":limit", listLen);
queryList.exec();
while (queryList.next() == true && index < (listLen + 1))
{
QHBoxLayout *line = new QHBoxLayout();
QLabel *rank = new QLabel(QString::number(index));
rank->setAlignment(Qt::AlignCenter);
QToolButton *btn = new QToolButton();
int id = queryList.value("id").value<int>();
QString name = queryList.value("title").value<QString>();
QString img = queryList.value("frontimg").value<QString>();
QString url = queryList.value("detail").value<QString>();
QString cate = queryList.value("cateId").value<QString>();
/*queryMeituan.prepare("select * from " + labelToDb[cate] + " where detail = :url");
// qDebug() << "类名:" << cate;
// qDebug() << "所属表名:" << labelToDb[cate];
queryMeituan.bindValue(":url", url);
QStringList list = queryMeituanDatabase(queryMeituan);//获得图片链接和店铺名和id*/
imgDownloader *imgDownload = new imgDownloader();
QString imgPath = "./images/minoritylist" + QString::number(id) + ".png";
imgDownload->downloadFileFromUrl(img, imgPath);
btn = setBtn(btn, imgPath, name);
connect(btn, &QToolButton::clicked, this, [=](){web->loadPage(name, img, url, cate); subWidget->setVisible(false); web->setVisible(true);});
line->addWidget(rank, 1);
line->addWidget(btn, 10);
lineList_2[index] = line;
index++;
}
} }
void ListWidget::setFavorableList() void ListWidget::setFavorableList()
{ {
/*
QSqlQuery queryList(listDb); QSqlQuery queryList(listDb);
QSqlQuery queryMeituan(meituanDb); QSqlQuery queryMeituan(meituanDb);
int index = 1; int index = 1;
@ -264,6 +301,43 @@ void ListWidget::setFavorableList()
index++; index++;
} }
*/
QSqlQuery queryList(listDb);
QSqlQuery queryMeituan(meituanDb);
int index = 1;
queryList.prepare("select * from favorablelist order by score desc");
//queryList.bindValue(":limit", listLen);
queryList.exec();
while (queryList.next() == true && index < (listLen + 1))
{
QHBoxLayout *line = new QHBoxLayout();
QLabel *rank = new QLabel(QString::number(index));
rank->setAlignment(Qt::AlignCenter);
QToolButton *btn = new QToolButton();
int id = queryList.value("id").value<int>();
QString name = queryList.value("title").value<QString>();
QString img = queryList.value("frontimg").value<QString>();
QString url = queryList.value("detail").value<QString>();
QString cate = queryList.value("cateId").value<QString>();
/*queryMeituan.prepare("select * from " + labelToDb[cate] + " where detail = :url");
// qDebug() << "类名:" << cate;
// qDebug() << "所属表名:" << labelToDb[cate];
queryMeituan.bindValue(":url", url);
QStringList list = queryMeituanDatabase(queryMeituan);//获得图片链接和店铺名和id*/
imgDownloader *imgDownload = new imgDownloader();
QString imgPath = "./images/favorablelist" + QString::number(id) + ".png";
imgDownload->downloadFileFromUrl(img, imgPath);
btn = setBtn(btn, imgPath, name);
connect(btn, &QToolButton::clicked, this, [=](){web->loadPage(name, img, url, cate); subWidget->setVisible(false); web->setVisible(true);});
line->addWidget(rank, 1);
line->addWidget(btn, 10);
lineList_3[index] = line;
index++;
}
} }

@ -1,26 +1,26 @@
#include "loginmanager.h" #include "loginmanager.h"
LoginManager::LoginManager() LoginManager::LoginManager()
{ {
} }
bool LoginManager::loginVerify(QString account,QString password) bool LoginManager::loginVerify(QString account,QString password)
{ {
QSqlQuery query(userDb); QSqlQuery query(userDb);
query.prepare("select id,password from account where email=?"); query.prepare("select id,password from account where email=?");
query.addBindValue(account); query.addBindValue(account);
query.exec(); query.exec();
query.next(); query.next();
QString passwordget=query.value("password").toString(); QString passwordget=query.value("password").toString();
Id=query.value("id").toInt(); Id=query.value("id").toInt();
qDebug()<< "userId:" <<Id; qDebug()<< "userId:" <<Id;
if(passwordget==password) if(passwordget==password)
{ {
return true; return true;
} }
else else
{ {
return false; return false;
} }
} }

@ -1,19 +1,19 @@
#ifndef LOGINMANAGER_H #ifndef LOGINMANAGER_H
#define LOGINMANAGER_H #define LOGINMANAGER_H
#include "cglobal.h" #include "cglobal.h"
#include <QSqlQuery> #include <QSqlQuery>
#include <QVariant> #include <QVariant>
#include <QDebug> #include <QDebug>
class LoginManager class LoginManager
{ {
public: public:
LoginManager(); LoginManager();
bool loginVerify(QString account,QString password); bool loginVerify(QString account,QString password);
private: private:
}; };
#endif // LOGINMANAGER_H #endif // LOGINMANAGER_H

@ -7,47 +7,7 @@ MainWidget::MainWidget(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
verLayout = new QVBoxLayout(); InitMainWidget();
horLayout = new QHBoxLayout();
homeBtn = new QPushButton("首页");
userBtn = new QPushButton("个人主页");
searchBar = new QLineEdit();
searchBtn = new QPushButton("搜索");
//首页按钮默认选中
index = 0;
//homeBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}");
//userBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
homeWidget = new HomeWidget(this);
userWidget = new UserWidget(this);
searchWidget = new SearchWidget(this);
// home2user = new QPropertyAnimation(homeWidget, "geometry");
// user2home = new QPropertyAnimation(userWidget, "geometry");
this->setLayout(verLayout);
verLayout->addLayout(horLayout);
verLayout->addWidget(homeWidget);
verLayout->addWidget(userWidget);
verLayout->addWidget(searchWidget);
horLayout->addWidget(homeBtn);
horLayout->addWidget(userBtn);
horLayout->addWidget(searchBar);
horLayout->addWidget(searchBtn);
// homeWidget->setGeometry(11, 45, 1418, 727);
// userWidget->setGeometry(1440, 45, 1418, 727);
// searchWidget->setGeometry();
userWidget->setVisible(false);
searchWidget->setVisible(false);
connect(homeBtn, &QPushButton::clicked, this, &MainWidget::switchToHome);
connect(userBtn, &QPushButton::clicked, this, &MainWidget::switchToUser);
connect(searchBtn, &QPushButton::clicked, this, &MainWidget::actSearch);
connect(searchWidget->getReturnBtn(), &QPushButton::clicked, this, &MainWidget::returnSearch);
} }
void MainWidget::switchToHome() void MainWidget::switchToHome()
@ -56,9 +16,9 @@ void MainWidget::switchToHome()
{ {
//homeBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); //homeBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}");
//userBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); //userBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
// homeWidget->setVisible(true); homeWidget->setVisible(true);
// userWidget->setVisible(false); userWidget->setVisible(false);
user2homeAnimation(); //user2homeAnimation();
homeWidget->setVisible(true); homeWidget->setVisible(true);
userWidget->setVisible(false); userWidget->setVisible(false);
searchWidget->setVisible(false); searchWidget->setVisible(false);
@ -75,11 +35,9 @@ void MainWidget::switchToUser()
{ {
//homeBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); //homeBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
//userBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); //userBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}");
// homeWidget->setVisible(false); //home2userAnimation();
// userWidget->setVisible(true); homeWidget->setVisible(false);
home2userAnimation(); userWidget->setVisible(true);
// homeWidget->setVisible(false);
// userWidget->setVisible(true);
searchWidget->setVisible(false); searchWidget->setVisible(false);
searchBar->clear(); searchBar->clear();
index = 1; index = 1;
@ -181,3 +139,138 @@ MainWidget::~MainWidget()
{ {
delete ui; delete ui;
} }
void MainWidget::SetBackground(QString url)
{
background->setPixmap(url);
background->setScaledContents(true);
}
void MainWidget::InitMainWidget()
{
background = new QLabel(this);
SetBackground("./softImages/MainImage.jpg");
QVBoxLayout * verLayout = new QVBoxLayout();
setLayout(verLayout);
verLayout->setMargin(0);
verLayout->setSpacing(0);
firstSubWidget = new QWidget();
InitFirstSubWidget();
verLayout->addWidget(firstSubWidget);
homeWidget = new HomeWidget();
verLayout->addWidget(homeWidget);
userWidget = new UserWidget();
verLayout->addWidget(userWidget);
searchWidget = new SearchWidget();
verLayout->addWidget(searchWidget);
//首页按钮默认选中
index = 0;
userWidget->setVisible(false);
searchWidget->setVisible(false);
connect(searchWidget->getReturnBtn(), &QPushButton::clicked, this, &MainWidget::returnSearch);
}
void MainWidget::InitFirstSubWidget()
{
QHBoxLayout * horiLayout = new QHBoxLayout();
firstSubWidget->setLayout(horiLayout);
homeBtn = new QPushButton("首页");
InitButton(homeBtn);
horiLayout->addWidget(homeBtn);
userBtn = new QPushButton("个人主页");
InitButton(userBtn);
horiLayout->addWidget(userBtn);
searchBar = new QLineEdit();
InitLineEdit(searchBar);
horiLayout->addWidget(searchBar);
searchBtn = new QPushButton("搜索");
InitButton(searchBtn);
horiLayout->addWidget(searchBtn);
connect(homeBtn, &QPushButton::clicked, this, &MainWidget::switchToHome);
connect(userBtn, &QPushButton::clicked, this, &MainWidget::switchToUser);
connect(searchBtn, &QPushButton::clicked, this, &MainWidget::actSearch);
}
void MainWidget::InitLabel(QLabel * label)
{
QFont lbl_font("Microsoft YaHei");
lbl_font.setPointSize(20);
lbl_font.setBold(true);
label->setFont(lbl_font);
label->setStyleSheet("color:#FFFFFF");
label->setAlignment(Qt::AlignRight);
}
void MainWidget::InitButton(QPushButton * button)
{
button->setStyleSheet("QPushButton {"
"color:#ffffff;"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #E1B37C, stop: 1 #E1B37C);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 32px;"
"font-family: Microsoft YaHei;"
"min-width:100px;"
"min-height:20px;"
"padding:4px;"
"} "
"QPushButton:hover {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #D2AD90, stop: 1 #D2AD90);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 32px;"
"font-family: Microsoft YaHei;"
"min-width:100px;"
"min-height:20px;"
"padding:4px;"
"} "
"QPushButton:pressed {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #D2AD90, stop: 1 #D2AD90);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 32px;"
"font-family: Microsoft YaHei;"
"min-width:100px;"
"min-height:20px;"
"padding:4px;"
"}");
button->setFixedSize(195, 65);
}
void MainWidget::InitLineEdit(QLineEdit * lineEdit)
{
lineEdit->setStyleSheet("QLineEdit {"
" border-style:outset; "
//" border-width:4px; "
" border-radius: 4px; "
//" border-color: #C1D7F1; "
" color:#ffffff; "
" background-color: rgb(88, 128, 77, 0.4);"
"} "
" QLineEdit:focus { "
" border-style:outset; "
//" border-width:4px; "
" border-radius: 4px; "
//" border-color: #C1D7F1; "
" color:#ffffff; "
" background-color: rgb(88, 128, 77, 0.6);"
"} ");
lineEdit->setFont(QFont("Microsoft YaHei" , 24, QFont::Bold));
lineEdit->setFixedSize(640, 60);
}
void MainWidget::resizeEvent(QResizeEvent *event)
{
background->resize(this->size());
}

@ -30,22 +30,33 @@ public:
explicit MainWidget(QWidget *parent = nullptr); explicit MainWidget(QWidget *parent = nullptr);
~MainWidget(); ~MainWidget();
void SetBackground(QString);
void InitMainWidget();
void InitFirstSubWidget();
void InitLabel(QLabel *);
void InitButton(QPushButton *);
void InitLineEdit(QLineEdit *);
void resizeEvent(QResizeEvent *event);
void home2userAnimation(); void home2userAnimation();
void user2homeAnimation(); void user2homeAnimation();
private: private:
Ui::MainWidget *ui; Ui::MainWidget *ui;
int index; QLabel * background;
QVBoxLayout *verLayout; int index;
QHBoxLayout *horLayout;
QPushButton *homeBtn; QPushButton *homeBtn;
QPushButton *userBtn; QPushButton *userBtn;
QLineEdit *searchBar; QLineEdit *searchBar;
QPushButton *searchBtn; QPushButton *searchBtn;
QWidget * firstSubWidget;
HomeWidget *homeWidget; HomeWidget *homeWidget;
UserWidget *userWidget; UserWidget *userWidget;
SearchWidget *searchWidget; SearchWidget *searchWidget;

@ -1,243 +1,258 @@
#include "popwidget.h" #include "popwidget.h"
#include "ui_popwidget.h" #include "ui_popwidget.h"
PopWidget::PopWidget(QWidget *parent) : PopWidget::PopWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::PopWidget) ui(new Ui::PopWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
this->setWindowModality(Qt::ApplicationModal); this->setWindowModality(Qt::ApplicationModal);
this->setFixedSize(QSize(400,810)); this->setFixedSize(QSize(400,810));
this->setWindowTitle("请选择..."); this->setWindowTitle("请选择...");
chosen.append(""); chosen.append("");
chosen.append(""); chosen.append("");
chosen.append(""); chosen.append("");
showLimit = 15; showLimit = 15;
currentPage = 1; currentPage = 1;
offset = 0; offset = 0;
btnList = (QToolButton **)malloc(sizeof(QToolButton *) * showLimit); btnList = (QToolButton **)malloc(sizeof(QToolButton *) * showLimit);
idList = (int *)malloc(sizeof(int) * showLimit);
mainLayout = new QVBoxLayout();
mainLayout = new QVBoxLayout();
notify = new QLabel("请从您的收藏夹中选择场所添加到路线中");
notify->setAlignment(Qt::AlignCenter); notify = new QLabel("请从您的收藏夹中选择场所添加到路线中");
notify->setAlignment(Qt::AlignCenter);
searchLine = new QHBoxLayout();
searchBar = new QLineEdit(); searchLine = new QHBoxLayout();
searchBtn = new QPushButton("搜索"); searchBar = new QLineEdit();
returnSearchBtn = new QPushButton("退出搜索"); searchBtn = new QPushButton("搜索");
returnSearchBtn = new QPushButton("退出搜索");
scroll = new QScrollArea();
scrollWidget = new QWidget; scroll = new QScrollArea();
scrollLayout = new QVBoxLayout(); scrollWidget = new QWidget;
scrollLayout = new QVBoxLayout();
pageLine = new QHBoxLayout();
up = new QPushButton("上一页"); pageLine = new QHBoxLayout();
down = new QPushButton("下一页"); up = new QPushButton("上一页");
down = new QPushButton("下一页");
chosenLabel = new QLabel("您还未选择场所...");
chosenLabel->setAlignment(Qt::AlignLeft); chosenLabel = new QLabel("您还未选择场所...");
chosenLabel->setAlignment(Qt::AlignLeft);
closeLine = new QHBoxLayout();
confirm = new QPushButton("确认"); closeLine = new QHBoxLayout();
cancel = new QPushButton("取消"); confirm = new QPushButton("确认");
cancel = new QPushButton("取消");
this->setLayout(mainLayout);
this->setLayout(mainLayout);
mainLayout->addWidget(notify);
mainLayout->addLayout(searchLine); mainLayout->addWidget(notify);
mainLayout->addWidget(scroll); mainLayout->addLayout(searchLine);
mainLayout->addLayout(pageLine); mainLayout->addWidget(scroll);
mainLayout->addWidget(chosenLabel); mainLayout->addLayout(pageLine);
mainLayout->addLayout(closeLine); mainLayout->addWidget(chosenLabel);
mainLayout->addLayout(closeLine);
searchLine->addWidget(searchBar, 6);
searchLine->addWidget(searchBtn, 1); searchLine->addWidget(searchBar, 6);
searchLine->addWidget(searchBtn, 1);
// scrollWidget->setLayout(scrollLayout);
// //查询数据库,进行按钮布局 // scrollWidget->setLayout(scrollLayout);
// scroll->setWidget(scrollWidget); // //查询数据库,进行按钮布局
getTotalNum(); // scroll->setWidget(scrollWidget);
setScreen(); getTotalNum();
setScreen();
pageLine->addWidget(up);
pageLine->addWidget(down); pageLine->addWidget(up);
pageLine->addWidget(down);
closeLine->addWidget(confirm);
closeLine->addWidget(cancel); closeLine->addWidget(confirm);
closeLine->addWidget(cancel);
connect(up, &QPushButton::clicked, this, &PopWidget::pageUp);
connect(down, &QPushButton::clicked, this, &PopWidget::pageDown); connect(up, &QPushButton::clicked, this, &PopWidget::pageUp);
} connect(down, &QPushButton::clicked, this, &PopWidget::pageDown);
}
PopWidget::~PopWidget()
{ PopWidget::~PopWidget()
delete ui; {
} delete ui;
}
QPushButton * PopWidget::getConfirmBtn()
{ QPushButton * PopWidget::getConfirmBtn()
return confirm; {
} return confirm;
}
QPushButton * PopWidget::getCancelBtn()
{ QPushButton * PopWidget::getCancelBtn()
return cancel; {
} return cancel;
}
//从店铺收藏夹获取店铺
void PopWidget::getTotalNum() //从店铺收藏夹获取店铺
{ void PopWidget::getTotalNum()
//查询条目数 {
QSqlQuery query(userDb); //查询条目数
QSqlQuery query(userDb);
query.prepare("select count(*) as num from favPlaces where userId = :id");
query.bindValue(":id", Id); query.prepare("select count(*) as num from favPlaces where userId = :id");
query.exec(); query.bindValue(":id", Id);
query.next(); query.exec();
qDebug() << " popWidget totalNum:" << query.value("num"); query.next();
totalNum = query.value("num").value<qlonglong>(); qDebug() << " popWidget totalNum:" << query.value("num");
totalNum = query.value("num").value<qlonglong>();
pageNum = (totalNum + showLimit - 1)/showLimit;
pageNum = (totalNum + showLimit - 1)/showLimit;
}
}
void PopWidget::queryDatabase()
{ void PopWidget::queryDatabase()
QSqlQuery query(userDb); {
QSqlQuery query(userDb);
query.prepare("select * from favPlaces where userId = :id limit :offset, :limit");
query.bindValue(":id", Id); query.prepare("select * from favPlaces where userId = :id limit :offset, :limit");
query.bindValue(":offset", offset); query.bindValue(":id", Id);
query.bindValue(":limit", showLimit); query.bindValue(":offset", offset);
query.exec(); query.bindValue(":limit", showLimit);
int i = 0; query.exec();
while(query.next()==true) int i = 0;
{ while(query.next()==true)
QVariant detail = query.value("url"); {
QVariant favPlaceId = query.value("favPlaceId");
urlList.append(detail.value<QString>()); QVariant title = query.value("title");
i++; QVariant detail = query.value("detail");
} QVariant frontimg = query.value("frontimg");
currentNum = i; QVariant cateId = query.value("cateId");
qDebug() << "popWidget currentNum:" << currentNum;
idList[i] = (int)favPlaceId.value<qlonglong>();
} nameList.append(title.value<QString>());
urlList.append(detail.value<QString>());
QToolButton * PopWidget::setBtn(QToolButton *btn, QString text, QString img) imgList.append(frontimg.value<QString>());
{ cateList.append(cateId.value<QString>());
if(img != "") i++;
btn->setIcon(QIcon(img)); }
btn->setText(text); currentNum = i;
btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); qDebug() << "popWidget currentNum:" << currentNum;
btn->setIconSize(QSize(100,200));
btn->setFixedSize(300,100); }
return btn; QToolButton * PopWidget::setBtn(QToolButton *btn, QString text, QString img)
} {
if(img != "")
void PopWidget::setBtns() btn->setIcon(QIcon(img));
{ btn->setText(text);
int i = 0; btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
for (i; i < currentNum; i++) btn->setIconSize(QSize(100,200));
{ btn->setFixedSize(300,100);
int index = i;
//下载图片到本地 return btn;
// QString imgPath = "D:/Study/SE/project/images/" + cateList[currentCate] + QString::number(idList[index]) + ".png"; }
// imgDownloader *download = new imgDownloader();
// download->downloadFileFromUrl(imgList[index], imgPath); void PopWidget::setBtns()
btnList[index] = setBtn(btnList[index], urlList[index], "D:/Study/SE/project/images/transparent.png"); {
disconnect(btnList[index], 0, 0, 0); int i = 0;
connect(btnList[index], &QToolButton::clicked, this, [=](){setChosen(index);}); for (i; i < currentNum; i++)
} {
} int index = i;
//下载图片到本地
void PopWidget::setChosen(int index) QString imgPath = "./images/fav" + QString::number(Id) + "_" + QString::number(idList[index]) + ".png";
{ imgDownloader *download = new imgDownloader();
if (urlList[index] != chosen[1]) download->downloadFileFromUrl(imgList[index], imgPath);
{ btnList[index] = setBtn(btnList[index], nameList[index], imgPath);
// chosen[0] = nameList[index]; disconnect(btnList[index], 0, 0, 0);
chosen[1] = urlList[index]; connect(btnList[index], &QToolButton::clicked, this, [=](){setChosen(index);});
// chosen[2] = imgList[index]; }
qDebug() << "popWidget chosen:" + chosen[0] + chosen[1] + chosen[2]; }
chosenLabel->setText("您选择了" + chosen[1]);
} void PopWidget::setChosen(int index)
else {
{ if (urlList[index] != chosen[1])
chosen[0] = ""; {
chosen[1] = ""; chosen[0] = nameList[index];
chosen[2] = ""; chosen[1] = urlList[index];
chosenLabel->setText("您还未选择场所..."); chosen[2] = cateList[index];
} qDebug() << "popWidget chosen:" + chosen[0] + chosen[1] + chosen[2];
} chosenLabel->setText("您选择了" + chosen[0]);
}
void PopWidget::setScreen() else
{ {
qDebug() << "popWidget currentPage:" << currentPage; chosen[0] = "";
qDebug() << "popWidget offset:" << offset; chosen[1] = "";
urlList.clear(); chosen[2] = "";
imgList.clear(); chosenLabel->setText("您还未选择场所...");
nameList.clear(); }
for (int i = 0; i < showLimit; i++) }
btnList[i] = new QToolButton();
void PopWidget::setScreen()
queryDatabase(); {
qDebug("query success"); qDebug() << "popWidget currentPage:" << currentPage;
setBtns(); qDebug() << "popWidget offset:" << offset;
qDebug("setBtns success"); urlList.clear();
imgList.clear();
scroll->takeWidget(); nameList.clear();
scrollWidget->deleteLater(); cateList.clear();
scrollWidget = new QWidget(); for (int i = 0; i < showLimit; i++)
scrollLayout->deleteLater(); btnList[i] = new QToolButton();
scrollLayout = new QVBoxLayout();
scrollWidget->setLayout(scrollLayout); queryDatabase();
qDebug("query success");
for (int i = 0; i < currentNum; i++) setBtns();
{ qDebug("setBtns success");
scrollLayout->addWidget(btnList[i]);
} scroll->takeWidget();
scrollWidget->deleteLater();
scroll->setWidget(scrollWidget); scrollWidget = new QWidget();
scrollLayout->deleteLater();
} scrollLayout = new QVBoxLayout();
scrollWidget->setLayout(scrollLayout);
void PopWidget::pageUp()
{ for (int i = 0; i < currentNum; i++)
currentPage--; {
if (currentPage < 1) scrollLayout->addWidget(btnList[i]);
{ }
currentPage = 1;
qDebug("这是第一页"); scroll->setWidget(scrollWidget);
}
else }
{
offset -= showLimit; void PopWidget::pageUp()
rollTop(); {
setScreen(); currentPage--;
} if (currentPage < 1)
} {
currentPage = 1;
void PopWidget::pageDown() qDebug("这是第一页");
{ }
currentPage++; else
if (currentPage > pageNum) {
{ offset -= showLimit;
currentPage = pageNum; rollTop();
qDebug("已经是最后一页了!"); setScreen();
} }
else }
{
offset += showLimit; void PopWidget::pageDown()
rollTop(); {
setScreen(); currentPage++;
} if (currentPage > pageNum)
} {
currentPage = pageNum;
void PopWidget::rollTop() qDebug("已经是最后一页了!");
{ }
QScrollBar *scrollBar = scroll->verticalScrollBar(); else
scrollBar->setValue(scrollBar->minimum()); {
} offset += showLimit;
rollTop();
setScreen();
}
}
void PopWidget::rollTop()
{
QScrollBar *scrollBar = scroll->verticalScrollBar();
scrollBar->setValue(scrollBar->minimum());
}
QStringList PopWidget::getChosen()
{
return chosen;
}

@ -1,86 +1,90 @@
#ifndef POPWIDGET_H #ifndef POPWIDGET_H
#define POPWIDGET_H #define POPWIDGET_H
#include <QWidget> #include <QWidget>
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLineEdit> #include <QLineEdit>
#include <QLabel> #include <QLabel>
#include <QScrollArea> #include <QScrollArea>
#include <QSqlQuery> #include <QSqlQuery>
#include <QDebug> #include <QDebug>
#include <QToolButton> #include <QToolButton>
#include <QIcon> #include <QIcon>
#include <QScrollBar> #include <QScrollBar>
#include "cglobal.h" #include "cglobal.h"
#include "imgdownloader.h"
#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8") #if _MSC_VER >= 1600
#endif #pragma execution_character_set("utf-8")
#endif
namespace Ui {
class PopWidget; namespace Ui {
} class PopWidget;
}
class PopWidget : public QWidget
{ class PopWidget : public QWidget
Q_OBJECT {
Q_OBJECT
public:
explicit PopWidget(QWidget *parent = nullptr); public:
~PopWidget(); explicit PopWidget(QWidget *parent = nullptr);
~PopWidget();
QPushButton * getConfirmBtn();
QPushButton * getCancelBtn(); QPushButton * getConfirmBtn();
void getTotalNum(); QPushButton * getCancelBtn();
void queryDatabase(); void getTotalNum();
void pageUp(); void queryDatabase();
void pageDown(); void pageUp();
void setScreen(); void pageDown();
void setBtns(); void setScreen();
QToolButton * setBtn(QToolButton *btn, QString text, QString img); void setBtns();
void setChosen(int index); QToolButton * setBtn(QToolButton *btn, QString text, QString img);
void rollTop(); void setChosen(int index);
void rollTop();
private: QStringList getChosen();
Ui::PopWidget *ui;
private:
bool inSearch; Ui::PopWidget *ui;
QStringList chosen;//被选中的场所在当,有三个值name,url,img
int totalNum;//收藏夹总共有多少条 bool inSearch;
int showLimit;//一页中最多显示条数 QStringList chosen;//被选中的场所在当,有三个值name,url,cateId
int pageNum;//总页数 int totalNum;//收藏夹总共有多少条
int currentPage;//当前所在页数 int showLimit;//一页中最多显示条数
int currentNum;//当前页中条目数量 int pageNum;//总页数
int offset;//query语句中的偏移量 int currentPage;//当前所在页数
QStringList nameList; int currentNum;//当前页中条目数量
QStringList urlList; int offset;//query语句中的偏移量
QStringList imgList; QStringList nameList;
QToolButton **btnList; QStringList urlList;
QStringList imgList;
QVBoxLayout *mainLayout; QToolButton **btnList;
int *idList;
QLabel *notify; QStringList cateList;
QHBoxLayout *searchLine; QVBoxLayout *mainLayout;
QLineEdit *searchBar;
QPushButton *searchBtn; QLabel *notify;
QPushButton *returnSearchBtn;
QHBoxLayout *searchLine;
QScrollArea *scroll; QLineEdit *searchBar;
QWidget *scrollWidget; QPushButton *searchBtn;
QVBoxLayout *scrollLayout; QPushButton *returnSearchBtn;
QHBoxLayout *pageLine; QScrollArea *scroll;
QPushButton *up; QWidget *scrollWidget;
QPushButton *down; QVBoxLayout *scrollLayout;
QLabel *chosenLabel; QHBoxLayout *pageLine;
QPushButton *up;
QHBoxLayout *closeLine; QPushButton *down;
QPushButton *confirm;
QPushButton *cancel; QLabel *chosenLabel;
};
QHBoxLayout *closeLine;
#endif // POPWIDGET_H QPushButton *confirm;
QPushButton *cancel;
};
#endif // POPWIDGET_H

@ -1,21 +1,21 @@
<ui version="4.0"> <ui version="4.0">
<author/> <author/>
<comment/> <comment/>
<exportmacro/> <exportmacro/>
<class>PopWidget</class> <class>PopWidget</class>
<widget class="QWidget" name="PopWidget"> <widget class="QWidget" name="PopWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>400</width>
<height>300</height> <height>300</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
</widget> </widget>
<pixmapfunction/> <pixmapfunction/>
<connections/> <connections/>
</ui> </ui>

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 182 B

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 221 B

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 178 B

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 169 B

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 274 B

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 386 B

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 355 B

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 304 B

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 316 B

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 219 B

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 135 B

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 137 B

Before

Width:  |  Height:  |  Size: 680 B

After

Width:  |  Height:  |  Size: 680 B

Before

Width:  |  Height:  |  Size: 843 B

After

Width:  |  Height:  |  Size: 843 B

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

Before

Width:  |  Height:  |  Size: 615 B

After

Width:  |  Height:  |  Size: 615 B

@ -58,7 +58,7 @@ RecommendWidget::RecommendWidget(QWidget *parent) :
subVerLayout->addLayout(lineList[i]); subVerLayout->addLayout(lineList[i]);
} }
funcLine->addWidget(refreshBtn); //funcLine->addWidget(refreshBtn);
for (int i = 0; i < row; i++) for (int i = 0; i < row; i++)
{ {
for (int j = 0; j <column; j++) for (int j = 0; j <column; j++)

@ -1,203 +1,202 @@
#include "registerwidget.h" #include "registerwidget.h"
#include "ui_registerwidget.h" #include "ui_registerwidget.h"
#include <QDir> #include <QDir>
RegisterWidget::RegisterWidget(QWidget *parent) : RegisterWidget::RegisterWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::RegisterWidget) ui(new Ui::RegisterWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
background = new QLabel(this); background = new QLabel(this);
subWidget = new QWidget(this); subWidget = new QWidget(this);
qDebug() << QDir::currentPath();
InitRegisterWidget();
InitRegisterWidget(); }
}
QPushButton * RegisterWidget::getGetVerificationCodeButton()
QPushButton * RegisterWidget::getGetVerificationCodeButton() {
{ return getVerificationCodeButon;
return getVerificationCodeButon; }
}
QPushButton * RegisterWidget::getConfirmButton()
QPushButton * RegisterWidget::getConfirmButton() {
{ return confirmButton;
return confirmButton; }
}
QPushButton * RegisterWidget::getCancelButton()
QPushButton * RegisterWidget::getCancelButton() {
{ return cancelButton;
return cancelButton; }
}
QString RegisterWidget::getEmailAddress()
QString RegisterWidget::getEmailAddress() {
{ return emailAddressLineEdit->text();
return emailAddressLineEdit->text(); }
}
QString RegisterWidget::getPassword()
QString RegisterWidget::getPassword() {
{ return passwordLineEdit->text();
return passwordLineEdit->text(); }
}
QString RegisterWidget::getConfirmPassword()
QString RegisterWidget::getConfirmPassword() {
{ return confirmPasswordLineEdit->text();
return confirmPasswordLineEdit->text(); }
}
QString RegisterWidget::getVerificationCode()
QString RegisterWidget::getVerificationCode() {
{ return verificationCodeLineEdit->text();
return verificationCodeLineEdit->text(); }
}
void RegisterWidget::setEmailAddressNotEditable()
void RegisterWidget::setEmailAddressNotEditable() {
{ emailAddressLineEdit->setEnabled(false);
emailAddressLineEdit->setEnabled(false); }
}
RegisterWidget::~RegisterWidget()
RegisterWidget::~RegisterWidget() {
{ delete ui;
delete ui; }
}
void RegisterWidget::SetBackground(QString url)
void RegisterWidget::SetBackground(QString url) {
{ background->setPixmap(url);
background->setPixmap(url); background->setScaledContents(true);
background->setScaledContents(true); }
}
void RegisterWidget::InitRegisterWidget()
void RegisterWidget::InitRegisterWidget() {
{ SetBackground("./softImages/RegisterImage.jpg");
SetBackground("./softImages/RegisterImage.jpg"); InitSubWidget();
InitSubWidget(); }
}
void RegisterWidget::SetSubWidgetBackground(QString url)
void RegisterWidget::SetSubWidgetBackground(QString url) {
{ subBackGround->setPixmap(url);
subBackGround->setPixmap(url); subBackGround->setScaledContents(true);
subBackGround->setScaledContents(true); }
}
void RegisterWidget::InitSubWidget()
void RegisterWidget::InitSubWidget() {
{ QGridLayout * gridLayout = new QGridLayout();
QGridLayout * gridLayout = new QGridLayout(); subWidget->setLayout(gridLayout);
subWidget->setLayout(gridLayout);
subBackGround = new QLabel(subWidget);
subBackGround = new QLabel(subWidget); SetSubWidgetBackground("F:/QtDemo/StylesheetExercise/images/blackHalf.png");
SetSubWidgetBackground("F:/QtDemo/StylesheetExercise/images/blackHalf.png");
QLabel * emailLabel = new QLabel("用户邮箱: ");
QLabel * emailLabel = new QLabel("用户邮箱: "); QLabel * passwordLabel = new QLabel("用户密码: ");
QLabel * passwordLabel = new QLabel("用户密码: "); QLabel * confirmLabel = new QLabel("确认密码: ");
QLabel * confirmLabel = new QLabel("确认密码: "); QLabel * verifyLabel = new QLabel("验证码: ");
QLabel * verifyLabel = new QLabel("验证码: "); InitLabel(emailLabel);
InitLabel(emailLabel); InitLabel(passwordLabel);
InitLabel(passwordLabel); InitLabel(confirmLabel);
InitLabel(confirmLabel); InitLabel(verifyLabel);
InitLabel(verifyLabel); gridLayout->addWidget(emailLabel, 0, 0, 1, 1);
gridLayout->addWidget(emailLabel, 0, 0, 1, 1); gridLayout->addWidget(passwordLabel, 1, 0, 1, 1);
gridLayout->addWidget(passwordLabel, 1, 0, 1, 1); gridLayout->addWidget(confirmLabel, 2, 0, 1, 1);
gridLayout->addWidget(confirmLabel, 2, 0, 1, 1); gridLayout->addWidget(verifyLabel, 3, 0, 1, 1);
gridLayout->addWidget(verifyLabel, 3, 0, 1, 1);
emailAddressLineEdit = new QLineEdit();
emailAddressLineEdit = new QLineEdit(); passwordLineEdit = new QLineEdit();
passwordLineEdit = new QLineEdit(); confirmPasswordLineEdit = new QLineEdit();
confirmPasswordLineEdit = new QLineEdit(); verificationCodeLineEdit = new QLineEdit();
verificationCodeLineEdit = new QLineEdit(); InitLineEdit(emailAddressLineEdit);
InitLineEdit(emailAddressLineEdit); emailAddressLineEdit->setPlaceholderText("请输入qq邮箱地址或163邮箱地址");
emailAddressLineEdit->setPlaceholderText("请输入qq邮箱地址或163邮箱地址"); InitLineEdit(passwordLineEdit);
InitLineEdit(passwordLineEdit); passwordLineEdit->setPlaceholderText("请输入长度为6~12位的密码");
passwordLineEdit->setPlaceholderText("请输入长度为6~12位的密码"); passwordLineEdit->setEchoMode(QLineEdit::Password);
passwordLineEdit->setEchoMode(QLineEdit::Password); InitLineEdit(confirmPasswordLineEdit);
InitLineEdit(confirmPasswordLineEdit); confirmPasswordLineEdit->setEchoMode(QLineEdit::Password);
confirmPasswordLineEdit->setEchoMode(QLineEdit::Password); InitLineEdit(verificationCodeLineEdit);
InitLineEdit(verificationCodeLineEdit); gridLayout->addWidget(emailAddressLineEdit, 0, 1, 1, 1);
gridLayout->addWidget(emailAddressLineEdit, 0, 1, 1, 1); gridLayout->addWidget(passwordLineEdit, 1, 1, 1, 1);
gridLayout->addWidget(passwordLineEdit, 1, 1, 1, 1); gridLayout->addWidget(confirmPasswordLineEdit, 2, 1, 1, 1);
gridLayout->addWidget(confirmPasswordLineEdit, 2, 1, 1, 1); gridLayout->addWidget(verificationCodeLineEdit, 3, 1, 1, 1);
gridLayout->addWidget(verificationCodeLineEdit, 3, 1, 1, 1);
getVerificationCodeButon = new QPushButton("获取验证码");
getVerificationCodeButon = new QPushButton("获取验证码"); InitButton(getVerificationCodeButon);
InitButton(getVerificationCodeButon); gridLayout->addWidget(getVerificationCodeButon, 3, 2, 1, 1);
gridLayout->addWidget(getVerificationCodeButon, 3, 2, 1, 1);
QHBoxLayout * horiLayout = new QHBoxLayout();
QHBoxLayout * horiLayout = new QHBoxLayout(); gridLayout->addLayout(horiLayout, 4, 1, 1, 1);
gridLayout->addLayout(horiLayout, 4, 1, 1, 1);
confirmButton = new QPushButton("确认");
confirmButton = new QPushButton("确认"); InitButton(confirmButton);
InitButton(confirmButton); horiLayout->addWidget(confirmButton);
horiLayout->addWidget(confirmButton);
cancelButton = new QPushButton("取消");
cancelButton = new QPushButton("取消"); InitButton(cancelButton);
InitButton(cancelButton); horiLayout->addWidget(cancelButton);
horiLayout->addWidget(cancelButton); }
}
void RegisterWidget::InitLabel(QLabel * label)
void RegisterWidget::InitLabel(QLabel * label) {
{ QFont lbl_font("Microsoft YaHei");
QFont lbl_font("Microsoft YaHei"); lbl_font.setPointSize(20);
lbl_font.setPointSize(20); lbl_font.setBold(true);
lbl_font.setBold(true); label->setFont(lbl_font);
label->setFont(lbl_font); label->setStyleSheet("color:#FFFFFF");
label->setStyleSheet("color:#FFFFFF"); label->setAlignment(Qt::AlignRight);
label->setAlignment(Qt::AlignRight); }
}
void RegisterWidget::InitButton(QPushButton * button)
void RegisterWidget::InitButton(QPushButton * button) {
{ button->setStyleSheet("QPushButton {"
button->setStyleSheet("QPushButton {" "color:#ffffff;"
"color:#ffffff;" "background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #8CA8CC, stop: 1 #8CA8CC);"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #8CA8CC, stop: 1 #8CA8CC);" "border-style:outset;"
"border-style:outset;" "border-radius:10px;"
"border-radius:10px;" "font:bold 20px;"
"font:bold 20px;" "font-family: Microsoft YaHei;"
"font-family: Microsoft YaHei;" "min-width:100px;"
"min-width:100px;" "min-height:20px;"
"min-height:20px;" "padding:4px;"
"padding:4px;" "} "
"} " "QPushButton:hover {"
"QPushButton:hover {" "background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6E8AB2, stop: 1 #6E8AB2);"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6E8AB2, stop: 1 #6E8AB2);" "border-style:outset;"
"border-style:outset;" "border-radius:10px;"
"border-radius:10px;" "font:bold 20px;"
"font:bold 20px;" "font-family: Microsoft YaHei;"
"font-family: Microsoft YaHei;" "min-width:100px;"
"min-width:100px;" "min-height:20px;"
"min-height:20px;" "padding:4px;"
"padding:4px;" "} "
"} " "QPushButton:pressed {"
"QPushButton:pressed {" "background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6783AB, stop: 1 #6783AB);"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6783AB, stop: 1 #6783AB);" "border-style:outset;"
"border-style:outset;" "border-radius:10px;"
"border-radius:10px;" "font:bold 20px;"
"font:bold 20px;" "font-family: Microsoft YaHei;"
"font-family: Microsoft YaHei;" "min-width:100px;"
"min-width:100px;" "min-height:20px;"
"min-height:20px;" "padding:4px;"
"padding:4px;" "}");
"}"); }
}
void RegisterWidget::InitLineEdit(QLineEdit * lineEdit)
void RegisterWidget::InitLineEdit(QLineEdit * lineEdit) {
{ lineEdit->setStyleSheet("QLineEdit {"
lineEdit->setStyleSheet("QLineEdit {" " border-radius: 4px; "
" border-radius: 4px; " " color:rgb(0, 0, 0); "
" color:rgb(0, 0, 0); " " background-color: rgb(255, 255, 255);"
" background-color: rgb(255, 255, 255);" "} "
"} " " QLineEdit:focus { "
" QLineEdit:focus { " " border-style:outset; "
" border-style:outset; " //" border-width:4px; "
//" border-width:4px; " " border-radius: 4px; "
" border-radius: 4px; " //" border-color: #C1D7F1; "
//" border-color: #C1D7F1; " " color:#ffffff; "
" color:#ffffff; " " background-color: #C1D7F1;"
" background-color: #C1D7F1;" "} ");
"} "); lineEdit->setFont(QFont("Microsoft YaHei" , 14, QFont::Bold));
lineEdit->setFont(QFont("Microsoft YaHei" , 14, QFont::Bold)); }
}
void RegisterWidget::resizeEvent(QResizeEvent *event)
void RegisterWidget::resizeEvent(QResizeEvent *event) {
{ background->resize(this->size());
background->resize(this->size()); subWidget->resize(this->size());
subWidget->resize(this->size()); subBackGround->resize(subWidget->size());
subBackGround->resize(subWidget->size()); }
}

@ -1,68 +1,68 @@
#ifndef REGISTERWIDGET_H #ifndef REGISTERWIDGET_H
#define REGISTERWIDGET_H #define REGISTERWIDGET_H
#include <QWidget> #include <QWidget>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
#include "registermanager.h" #include "registermanager.h"
#if _MSC_VER >= 1600 #if _MSC_VER >= 1600
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#endif #endif
namespace Ui { namespace Ui {
class RegisterWidget; class RegisterWidget;
} }
class RegisterWidget : public QWidget class RegisterWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit RegisterWidget(QWidget *parent = nullptr); explicit RegisterWidget(QWidget *parent = nullptr);
~RegisterWidget(); ~RegisterWidget();
void SetBackground(QString); void SetBackground(QString);
void InitRegisterWidget(); void InitRegisterWidget();
void SetSubWidgetBackground(QString); void SetSubWidgetBackground(QString);
void InitSubWidget(); void InitSubWidget();
void InitLabel(QLabel *); void InitLabel(QLabel *);
void InitButton(QPushButton *); void InitButton(QPushButton *);
void InitLineEdit(QLineEdit *); void InitLineEdit(QLineEdit *);
void resizeEvent(QResizeEvent * event); void resizeEvent(QResizeEvent * event);
QPushButton * getGetVerificationCodeButton(); QPushButton * getGetVerificationCodeButton();
QPushButton * getConfirmButton(); QPushButton * getConfirmButton();
QPushButton * getCancelButton(); QPushButton * getCancelButton();
QString getEmailAddress(); QString getEmailAddress();
QString getPassword(); QString getPassword();
QString getConfirmPassword(); QString getConfirmPassword();
QString getVerificationCode(); QString getVerificationCode();
void setEmailAddressNotEditable(); void setEmailAddressNotEditable();
private: private:
Ui::RegisterWidget *ui; Ui::RegisterWidget *ui;
QLabel * background; QLabel * background;
QLabel * subBackGround; QLabel * subBackGround;
QWidget * subWidget; QWidget * subWidget;
QLineEdit * emailAddressLineEdit; QLineEdit * emailAddressLineEdit;
QLineEdit * passwordLineEdit; QLineEdit * passwordLineEdit;
QLineEdit * confirmPasswordLineEdit; QLineEdit * confirmPasswordLineEdit;
QLineEdit * verificationCodeLineEdit; QLineEdit * verificationCodeLineEdit;
QPushButton * getVerificationCodeButon; QPushButton * getVerificationCodeButon;
QPushButton * confirmButton; QPushButton * confirmButton;
QPushButton * cancelButton; QPushButton * cancelButton;
}; };
#endif // REGISTERWIDGET_H #endif // REGISTERWIDGET_H

@ -1,21 +1,21 @@
<ui version="4.0"> <ui version="4.0">
<author/> <author/>
<comment/> <comment/>
<exportmacro/> <exportmacro/>
<class>RegisterWidget</class> <class>RegisterWidget</class>
<widget name="RegisterWidget" class="QWidget"> <widget name="RegisterWidget" class="QWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>400</width>
<height>300</height> <height>300</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
</widget> </widget>
<pixmapfunction/> <pixmapfunction/>
<connections/> <connections/>
</ui> </ui>

@ -1,97 +1,97 @@
#include "route.h" #include "route.h"
#include <QDebug> #include <QDebug>
Route::Route() Route::Route()
{ {
routeItems=new RouteItem; routeItems=new RouteItem;
routeItems->next=NULL; routeItems->next=NULL;
} }
//route结构体使用方式和query类似 //route结构体使用方式和query类似
//Route * oneRoute = getAllItems(); //Route * oneRoute = getAllItems();
//while (oneRoute->next!=NULL) //while (oneRoute->next!=NULL)
//{ //{
// oneRoute=oneRoute->next; // oneRoute=oneRoute->next;
// url=oneRoute->url; // url=oneRoute->url;
//} //}
RouteItem * Route::getAllItems() RouteItem * Route::getAllItems()
{ {
return this->routeItems; return this->routeItems;
} }
int Route::getRouteId() int Route::getRouteId()
{ {
return this->routeId; return this->routeId;
} }
QString Route::getRouteName() QString Route::getRouteName()
{ {
return this->routeName; return this->routeName;
} }
int Route::getUserId() int Route::getUserId()
{ {
return this->userId; return this->userId;
} }
void Route::setRouteName(QString name) void Route::setRouteName(QString name)
{ {
this->routeName = name; this->routeName = name;
return; return;
} }
void Route::setUserId(int id) void Route::setUserId(int id)
{ {
this->userId=id; this->userId=id;
} }
void Route::setRouteId(int id) void Route::setRouteId(int id)
{ {
this->routeId=id; this->routeId=id;
} }
void Route::setAllItems(QStringList titleList,QStringList urlList,QStringList cateIdList,QDateTime * startTimeList,QDateTime * endTimeList,QStringList trafficList,double * distanceList,double * timeCostList,QStringList descriptionList) void Route::setAllItems(QStringList titleList,QStringList urlList,QStringList cateIdList,QDateTime * startTimeList,QDateTime * endTimeList,QStringList trafficList,double * distanceList,double * timeCostList,QStringList descriptionList)
{ {
RouteItem * head= routeItems; RouteItem * head= routeItems;
RouteItem * p; RouteItem * p;
int totalSize=titleList.size(); int totalSize=titleList.size();
int i; int i;
for(i=0;i<totalSize;i++) for(i=0;i<totalSize;i++)
{ {
p=new RouteItem; p=new RouteItem;
p->placeName = titleList[i]; p->placeName = titleList[i];
p->url = urlList[i]; p->url = urlList[i];
p->cateId = cateIdList[i]; p->cateId = cateIdList[i];
p->startTime = startTimeList[i]; p->startTime = startTimeList[i];
p->endTime = endTimeList[i]; p->endTime = endTimeList[i];
p->traffic = trafficList[i]; p->traffic = trafficList[i];
p->distance = distanceList[i]; p->distance = distanceList[i];
p->timeCost = timeCostList[i]; p->timeCost = timeCostList[i];
p->description = descriptionList[i]; p->description = descriptionList[i];
p->next = NULL; p->next = NULL;
head->next = p; head->next = p;
head=head->next; head=head->next;
} }
} }
//删除和添加都是根据位置位置从1开始计数 //删除和添加都是根据位置位置从1开始计数
RouteItem * Route::addItem(RouteItem * oneItem,int locate) RouteItem * Route::addItem(RouteItem * oneItem,int locate)
{ {
RouteItem * p = routeItems; RouteItem * p = routeItems;
int i = 0; int i = 0;
while(p->next != NULL&&i<locate) while(p->next != NULL&&i<locate)
{ {
p = p->next; p = p->next;
i++; i++;
} }
oneItem->next = p->next; oneItem->next = p->next;
p->next=oneItem; p->next=oneItem;
return routeItems; return routeItems;
} }
RouteItem * Route::deleteItem(int locate) RouteItem * Route::deleteItem(int locate)
{ {
RouteItem * p = routeItems; RouteItem * p = routeItems;
RouteItem * pre = routeItems; RouteItem * pre = routeItems;
int i = 0; int i = 0;
while(p->next != NULL&&i<locate) while(p->next != NULL&&i<locate)
{ {
pre = p; pre = p;
p = p->next; p = p->next;
i++; i++;
} }
pre->next = p->next; pre->next = p->next;
free(p); free(p);
return routeItems; return routeItems;
} }

@ -1,28 +1,28 @@
#ifndef ROUTE_H #ifndef ROUTE_H
#define ROUTE_H #define ROUTE_H
#include "RouteItem.h" #include "RouteItem.h"
#include <QStringList> #include <QStringList>
class Route class Route
{ {
public: public:
Route(); Route();
struct routeItem * getAllItems(); struct routeItem * getAllItems();
//距离和时间都用int表示单位m/km时间s/min统一一下 //距离和时间都用int表示单位m/km时间s/min统一一下
void setAllItems(QStringList titleList,QStringList urlList,QStringList cateIdList,QDateTime * startTimeList,QDateTime * endTimeList,QStringList trafficList,double *distanceList,double *timeCostList,QStringList descriptionList); void setAllItems(QStringList titleList,QStringList urlList,QStringList cateIdList,QDateTime * startTimeList,QDateTime * endTimeList,QStringList trafficList,double *distanceList,double *timeCostList,QStringList descriptionList);
int getRouteId(); int getRouteId();
int getUserId(); int getUserId();
QString getRouteName(); QString getRouteName();
void setRouteName(QString name); void setRouteName(QString name);
void setRouteId(int id); void setRouteId(int id);
void setUserId(int id); void setUserId(int id);
RouteItem * addItem(RouteItem * oneItem,int locate); RouteItem * addItem(RouteItem * oneItem,int locate);
RouteItem * deleteItem(int locate); RouteItem * deleteItem(int locate);
private: private:
QString routeName; QString routeName;
int userId=0;//路线没有用户时默认为0 int userId=0;//路线没有用户时默认为0
int routeId=0;//路线编号默认为0 int routeId=0;//路线编号默认为0
struct routeItem *routeItems; struct routeItem *routeItems;
}; };
#endif // ROUTE_H #endif // ROUTE_H

@ -1,322 +1,322 @@
#include "searchwidget.h" #include "searchwidget.h"
#include "ui_searchwidget.h" #include "ui_searchwidget.h"
SearchWidget::SearchWidget(QWidget *parent) : SearchWidget::SearchWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::SearchWidget) ui(new Ui::SearchWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
showLimit = 15; showLimit = 15;
cateList.append("food"); cateList.append("food");
cateList.append("entertainment"); cateList.append("entertainment");
cateList.append("hotel"); cateList.append("hotel");
cateList.append("attractions"); cateList.append("attractions");
cateList.append("sport"); cateList.append("sport");
lengthList = (int *)malloc(sizeof(int) * cateList.length()); lengthList = (int *)malloc(sizeof(int) * cateList.length());
idList = (int *)malloc(sizeof(int) * showLimit); idList = (int *)malloc(sizeof(int) * showLimit);
mainLayout = new QVBoxLayout(); mainLayout = new QVBoxLayout();
subWidget = new QWidget(); subWidget = new QWidget();
web = new WebWidget(); web = new WebWidget();
nullWidget = new QLabel("抱歉,未找到您要的结果。"); nullWidget = new QLabel("抱歉,未找到您要的结果。");
subLayout = new QVBoxLayout(); subLayout = new QVBoxLayout();
rtn = new QPushButton("返回"); rtn = new QPushButton("返回");
scroll = new QScrollArea(); scroll = new QScrollArea();
scrollWidget = new QWidget(); scrollWidget = new QWidget();
scrollLayout = new QVBoxLayout(); scrollLayout = new QVBoxLayout();
btnList = (QToolButton **)malloc(sizeof(QToolButton *) * showLimit); btnList = (QToolButton **)malloc(sizeof(QToolButton *) * showLimit);
switchLine = new QHBoxLayout(); switchLine = new QHBoxLayout();
up = new QPushButton("上一页"); up = new QPushButton("上一页");
down = new QPushButton("下一页"); down = new QPushButton("下一页");
//设置布局 //设置布局
this->setLayout(mainLayout); this->setLayout(mainLayout);
mainLayout->addWidget(subWidget); mainLayout->addWidget(subWidget);
mainLayout->addWidget(web); mainLayout->addWidget(web);
mainLayout->addWidget(nullWidget); mainLayout->addWidget(nullWidget);
web->setVisible(false); web->setVisible(false);
nullWidget->setVisible(false); nullWidget->setVisible(false);
subWidget->setLayout(subLayout); subWidget->setLayout(subLayout);
subLayout->addWidget(rtn); subLayout->addWidget(rtn);
subLayout->addWidget(scroll); subLayout->addWidget(scroll);
subLayout->addLayout(switchLine); subLayout->addLayout(switchLine);
switchLine->addWidget(up); switchLine->addWidget(up);
switchLine->addWidget(down); switchLine->addWidget(down);
connect(web->getReturnBtn(), &QPushButton::clicked, this, &SearchWidget::returnWeb); connect(web->getReturnBtn(), &QPushButton::clicked, this, &SearchWidget::returnWeb);
connect(up, &QPushButton::clicked, this, &SearchWidget::pageUp); connect(up, &QPushButton::clicked, this, &SearchWidget::pageUp);
connect(down, &QPushButton::clicked, this, &SearchWidget::pageDown); connect(down, &QPushButton::clicked, this, &SearchWidget::pageDown);
} }
SearchWidget::~SearchWidget() SearchWidget::~SearchWidget()
{ {
delete ui; delete ui;
} }
QPushButton *SearchWidget::getReturnBtn() QPushButton *SearchWidget::getReturnBtn()
{ {
return rtn; return rtn;
} }
void SearchWidget::sendInput(QString input) void SearchWidget::sendInput(QString input)
{ {
this->segment = input; this->segment = input;
qDebug() << "segment:" <<segment; qDebug() << "segment:" <<segment;
} }
void SearchWidget::getTotalNum() void SearchWidget::getTotalNum()
{ {
//查询条目数 //查询条目数
QSqlQuery query(meituanDb); QSqlQuery query(meituanDb);
int length = cateList.length(); int length = cateList.length();
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {
query.prepare("select count(*) as num from " + cateList[i] + " where title like :segment"); query.prepare("select count(*) as num from " + cateList[i] + " where title like :segment");
query.bindValue(":segment", "%" + segment + "%"); query.bindValue(":segment", "%" + segment + "%");
query.exec(); query.exec();
query.next(); query.next();
qDebug() << cateList[i] + " totalNum:" << query.value("num"); qDebug() << cateList[i] + " totalNum:" << query.value("num");
lengthList[i] = query.value("num").value<qlonglong>(); lengthList[i] = query.value("num").value<qlonglong>();
totalNum += query.value("num").value<qlonglong>(); totalNum += query.value("num").value<qlonglong>();
} }
pageNum = (totalNum + showLimit - 1)/showLimit; pageNum = (totalNum + showLimit - 1)/showLimit;
page2cate = (int *)malloc(sizeof(int) * pageNum); page2cate = (int *)malloc(sizeof(int) * pageNum);
page2offset = (int *)malloc(sizeof(int) * pageNum); page2offset = (int *)malloc(sizeof(int) * pageNum);
} }
void SearchWidget::queryDatabase(QSqlQuery query) void SearchWidget::queryDatabase(QSqlQuery query)
{ {
query.exec(); query.exec();
int i = currentHead; int i = currentHead;
while(query.next()==true && i < showLimit) while(query.next()==true && i < showLimit)
{ {
QVariant id = query.value("id"); QVariant id = query.value("id");
QVariant detail = query.value("detail"); QVariant detail = query.value("detail");
QVariant frontimg = query.value("frontimg"); QVariant frontimg = query.value("frontimg");
QVariant title = query.value("title"); QVariant title = query.value("title");
QVariant avgscore = query.value("avgscore"); QVariant avgscore = query.value("avgscore");
QVariant comments = query.value("comments"); QVariant comments = query.value("comments");
QVariant address = query.value("address"); QVariant address = query.value("address");
QVariant cateId = query.value("cateId"); QVariant cateId = query.value("cateId");
// QVariant avgprice = query.value("avgprice"); // QVariant avgprice = query.value("avgprice");
QString name = title.value<QString>(); QString name = title.value<QString>();
QString score = QString::number(avgscore.value<double>()); QString score = QString::number(avgscore.value<double>());
QString commentNum = QString::number(comments.value<qlonglong>()); QString commentNum = QString::number(comments.value<qlonglong>());
QString addr = address.value<QString>(); QString addr = address.value<QString>();
// QString price = QString::number(avgprice.value<qlonglong>()); // QString price = QString::number(avgprice.value<qlonglong>());
QString text = name + "\n" + score + "" + commentNum + "条评论\n" + addr + "\n";// + "人均" + price + "元"; QString text = name + "\n" + score + "" + commentNum + "条评论\n" + addr + "\n";// + "人均" + price + "元";
QString cateid = cateId.value<QString>(); QString cateid = cateId.value<QString>();
idList[i] = id.value<qlonglong>(); idList[i] = id.value<qlonglong>();
nameList.append(name); nameList.append(name);
urlList.append(detail.value<QString>()); urlList.append(detail.value<QString>());
imgList.append(frontimg.value<QString>()); imgList.append(frontimg.value<QString>());
textList.append(text); textList.append(text);
cateIdList.append(cateid); cateIdList.append(cateid);
i++; i++;
} }
currentQueryLength = i - currentHead; currentQueryLength = i - currentHead;
} }
QToolButton *SearchWidget::setBtn(QToolButton *btn, const QString iconPath, const QString text) QToolButton *SearchWidget::setBtn(QToolButton *btn, const QString iconPath, const QString text)
{ {
if(iconPath != "") if(iconPath != "")
btn->setIcon(QIcon(iconPath)); btn->setIcon(QIcon(iconPath));
btn->setText(text); btn->setText(text);
btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
btn->setIconSize(QSize(100,200)); btn->setIconSize(QSize(100,200));
btn->setFixedSize(1230,200); btn->setFixedSize(1230,200);
return btn; return btn;
} }
void SearchWidget::setBtns() void SearchWidget::setBtns()
{ {
int i = currentHead; int i = currentHead;
// qDebug() << "currentHead:" << currentHead; // qDebug() << "currentHead:" << currentHead;
// qDebug() << "currentQueryLength:" << currentQueryLength; // qDebug() << "currentQueryLength:" << currentQueryLength;
for (i; i < currentHead + currentQueryLength; i++) for (i; i < currentHead + currentQueryLength; i++)
{ {
int index = i; int index = i;
//下载图片到本地 //下载图片到本地
QString imgPath = "./images/" + cateList[currentCate] + QString::number(idList[index]) + ".png"; QString imgPath = "./images/" + cateList[currentCate] + QString::number(idList[index]) + ".png";
imgDownloader *download = new imgDownloader(); imgDownloader *download = new imgDownloader();
download->downloadFileFromUrl(imgList[index], imgPath); download->downloadFileFromUrl(imgList[index], imgPath);
btnList[index] = setBtn(btnList[index], imgPath, textList[index]); btnList[index] = setBtn(btnList[index], imgPath, textList[index]);
qDebug() << "info:" << cateList[currentCate] << idList[index] << urlList[index] << imgList[index]; qDebug() << "info:" << cateList[currentCate] << idList[index] << urlList[index] << imgList[index];
// btnList[index]->setVisible(true); // btnList[index]->setVisible(true);
disconnect(btnList[index], 0, 0, 0); disconnect(btnList[index], 0, 0, 0);
connect(btnList[index], &QToolButton::clicked, this, [=](){web->loadPage(nameList[index], imgList[index], urlList[index], cateIdList[index]); subWidget->setVisible(false); web->setVisible(true); nullWidget->setVisible(false);}); connect(btnList[index], &QToolButton::clicked, this, [=](){web->loadPage(nameList[index], imgList[index], urlList[index], cateIdList[index]); subWidget->setVisible(false); web->setVisible(true); nullWidget->setVisible(false);});
} }
for (i; i < showLimit; i++) for (i; i < showLimit; i++)
{ {
int index = i; int index = i;
btnList[index] = setBtn(btnList[index], "./images/transparent.png", ""); btnList[index] = setBtn(btnList[index], "./images/transparent.png", "");
// btnList[index]->setVisible(false); // btnList[index]->setVisible(false);
disconnect(btnList[index], 0, 0, 0); disconnect(btnList[index], 0, 0, 0);
} }
// offset += currentQueryLength; // offset += currentQueryLength;
// currentHead += currentQueryLength; // currentHead += currentQueryLength;
} }
void SearchWidget::querySet() void SearchWidget::querySet()
{ {
rollTop(); rollTop();
//重置存储查询信息的列表 //重置存储查询信息的列表
nameList.clear(); nameList.clear();
urlList.clear(); urlList.clear();
imgList.clear(); imgList.clear();
textList.clear(); textList.clear();
cateIdList.clear(); cateIdList.clear();
currentHead = 0; currentHead = 0;
currentQueryLength = 0; currentQueryLength = 0;
currentCate = page2cate[currentPage - 1]; currentCate = page2cate[currentPage - 1];
currentOffset = page2offset[currentPage - 1]; currentOffset = page2offset[currentPage - 1];
for (int i = 0; i <showLimit; i++) for (int i = 0; i <showLimit; i++)
{ {
int index = i; int index = i;
btnList[index] = new QToolButton(); btnList[index] = new QToolButton();
} }
// subLayout->removeWidget(scroll); // subLayout->removeWidget(scroll);
scroll->takeWidget(); scroll->takeWidget();
scrollWidget->deleteLater(); scrollWidget->deleteLater();
scrollWidget = new QWidget(); scrollWidget = new QWidget();
scrollLayout->deleteLater(); scrollLayout->deleteLater();
scrollLayout = new QVBoxLayout(); scrollLayout = new QVBoxLayout();
scrollWidget->setLayout(scrollLayout); scrollWidget->setLayout(scrollLayout);
qDebug() << "currentPage:" << currentPage; qDebug() << "currentPage:" << currentPage;
QSqlQuery query(meituanDb); QSqlQuery query(meituanDb);
while (currentHead < showLimit) while (currentHead < showLimit)
{ {
//判断是否换表 //判断是否换表
if (currentOffset >= lengthList[currentCate]) if (currentOffset >= lengthList[currentCate])
{ {
currentCate += 1; currentCate += 1;
currentOffset = 0; currentOffset = 0;
if (currentCate >= cateList.length()) if (currentCate >= cateList.length())
break; break;
} }
//查询数据 //查询数据
query.prepare("select * from " + cateList[currentCate] + " where title like :segment limit :offset , :showLimit"); query.prepare("select * from " + cateList[currentCate] + " where title like :segment limit :offset , :showLimit");
query.bindValue(":segment", "%" + segment + "%"); query.bindValue(":segment", "%" + segment + "%");
query.bindValue(":offset", currentOffset); query.bindValue(":offset", currentOffset);
qDebug() << "currentCate:" << currentCate; qDebug() << "currentCate:" << currentCate;
// qDebug() << "offset:" << offset; // qDebug() << "offset:" << offset;
query.bindValue(":showLimit", showLimit); query.bindValue(":showLimit", showLimit);
queryDatabase(query); queryDatabase(query);
// qDebug() << "query success"; // qDebug() << "query success";
//设置按钮 //设置按钮
setBtns(); setBtns();
// qDebug() << "set buttons success"; // qDebug() << "set buttons success";
//设置滚动界面布局 //设置滚动界面布局
for (int i = currentHead; i < currentHead + currentQueryLength; i++) for (int i = currentHead; i < currentHead + currentQueryLength; i++)
{ {
scrollLayout->addWidget(btnList[i]); scrollLayout->addWidget(btnList[i]);
} }
currentOffset += currentQueryLength; currentOffset += currentQueryLength;
currentHead += currentQueryLength; currentHead += currentQueryLength;
} }
page2cate[currentPage] = currentCate; page2cate[currentPage] = currentCate;
page2offset[currentPage] = currentOffset; page2offset[currentPage] = currentOffset;
scroll->setWidget(scrollWidget); scroll->setWidget(scrollWidget);
} }
void SearchWidget::showResult() void SearchWidget::showResult()
{ {
totalNum = 0; totalNum = 0;
pageNum = 0; pageNum = 0;
getTotalNum(); getTotalNum();
qDebug() << "totalNum:" << totalNum; qDebug() << "totalNum:" << totalNum;
qDebug() << "pageNum:" << pageNum; qDebug() << "pageNum:" << pageNum;
currentPage = 1; currentPage = 1;
currentCate = 0; currentCate = 0;
currentOffset = 0; currentOffset = 0;
page2cate[0] = currentCate; page2cate[0] = currentCate;
page2offset[0] = currentOffset; page2offset[0] = currentOffset;
if (totalNum) if (totalNum)
{ {
querySet(); querySet();
subWidget->setVisible(true); subWidget->setVisible(true);
nullWidget->setVisible(false); nullWidget->setVisible(false);
} }
else else
{ {
subWidget->setVisible(false); subWidget->setVisible(false);
nullWidget->setVisible(true); nullWidget->setVisible(true);
} }
web->setVisible(false); web->setVisible(false);
} }
void SearchWidget::returnWeb() void SearchWidget::returnWeb()
{ {
subWidget->setVisible(true); subWidget->setVisible(true);
web->setVisible(false); web->setVisible(false);
nullWidget->setVisible(false); nullWidget->setVisible(false);
} }
void SearchWidget::pageUp() void SearchWidget::pageUp()
{ {
currentPage--; currentPage--;
if (currentPage < 1) if (currentPage < 1)
{ {
currentPage = 1; currentPage = 1;
qDebug("这是第一页"); qDebug("这是第一页");
} }
else else
{ {
rollTop(); rollTop();
querySet(); querySet();
} }
} }
void SearchWidget::pageDown() void SearchWidget::pageDown()
{ {
currentPage++; currentPage++;
if (currentPage > pageNum) if (currentPage > pageNum)
{ {
currentPage = pageNum; currentPage = pageNum;
qDebug("已经是最后一页了!"); qDebug("已经是最后一页了!");
} }
else else
{ {
rollTop(); rollTop();
querySet(); querySet();
} }
} }
void SearchWidget::rollTop() void SearchWidget::rollTop()
{ {
QScrollBar *scrollBar = scroll->verticalScrollBar(); QScrollBar *scrollBar = scroll->verticalScrollBar();
scrollBar->setValue(scrollBar->minimum()); scrollBar->setValue(scrollBar->minimum());
} }

@ -1,95 +1,95 @@
#ifndef SEARCHWIDGET_H #ifndef SEARCHWIDGET_H
#define SEARCHWIDGET_H #define SEARCHWIDGET_H
#include <QWidget> #include <QWidget>
#include <QPushButton> #include <QPushButton>
#include <QToolButton> #include <QToolButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QSqlQuery> #include <QSqlQuery>
#include <QVariant> #include <QVariant>
#include <QDebug> #include <QDebug>
#include <QScrollArea> #include <QScrollArea>
#include <QScrollBar> #include <QScrollBar>
#include <QLabel> #include <QLabel>
#include "databaseconnector.h" #include "databaseconnector.h"
#include "webwidget.h" #include "webwidget.h"
#include "imgdownloader.h" #include "imgdownloader.h"
#if _MSC_VER >= 1600 #if _MSC_VER >= 1600
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#endif #endif
namespace Ui { namespace Ui {
class SearchWidget; class SearchWidget;
} }
class SearchWidget : public QWidget class SearchWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SearchWidget(QWidget *parent = nullptr); explicit SearchWidget(QWidget *parent = nullptr);
~SearchWidget(); ~SearchWidget();
void sendInput(QString input); void sendInput(QString input);
void queryDatabase(QSqlQuery query); void queryDatabase(QSqlQuery query);
void getTotalNum(); void getTotalNum();
void showResult(); void showResult();
QPushButton *getReturnBtn(); QPushButton *getReturnBtn();
QToolButton *setBtn(QToolButton *btn, const QString iconPath, const QString text); QToolButton *setBtn(QToolButton *btn, const QString iconPath, const QString text);
void querySet(); void querySet();
void setBtns(); void setBtns();
void pageUp(); void pageUp();
void pageDown(); void pageDown();
void returnWeb(); void returnWeb();
void rollTop(); void rollTop();
private: private:
Ui::SearchWidget *ui; Ui::SearchWidget *ui;
QString segment; QString segment;
QStringList nameList; QStringList nameList;
QStringList urlList; QStringList urlList;
QStringList imgList; QStringList imgList;
QStringList textList; QStringList textList;
int *idList; int *idList;
QStringList cateIdList; QStringList cateIdList;
QStringList cateList; QStringList cateList;
int totalNum; int totalNum;
int *lengthList; int *lengthList;
int pageNum; int pageNum;
int showLimit; int showLimit;
int currentPage; int currentPage;
int currentHead; int currentHead;
int currentQueryLength; int currentQueryLength;
int currentCate; int currentCate;
int currentOffset; int currentOffset;
int *page2cate; int *page2cate;
int *page2offset; int *page2offset;
QVBoxLayout *mainLayout; QVBoxLayout *mainLayout;
QWidget *subWidget; QWidget *subWidget;
WebWidget *web; WebWidget *web;
QLabel *nullWidget; QLabel *nullWidget;
QVBoxLayout *subLayout; QVBoxLayout *subLayout;
QPushButton *rtn; QPushButton *rtn;
QScrollArea *scroll; QScrollArea *scroll;
QWidget *scrollWidget; QWidget *scrollWidget;
QVBoxLayout *scrollLayout; QVBoxLayout *scrollLayout;
QToolButton **btnList; QToolButton **btnList;
QHBoxLayout *switchLine; QHBoxLayout *switchLine;
QPushButton *up; QPushButton *up;
QPushButton *down; QPushButton *down;
}; };
#endif // SEARCHWIDGET_H #endif // SEARCHWIDGET_H

@ -1,21 +1,21 @@
<ui version="4.0"> <ui version="4.0">
<author/> <author/>
<comment/> <comment/>
<exportmacro/> <exportmacro/>
<class>SearchWidget</class> <class>SearchWidget</class>
<widget name="SearchWidget" class="QWidget"> <widget name="SearchWidget" class="QWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>400</width>
<height>300</height> <height>300</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
</widget> </widget>
<pixmapfunction/> <pixmapfunction/>
<connections/> <connections/>
</ui> </ui>

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

Loading…
Cancel
Save