diff --git a/src/ChangShaTour/ChangShaTour.pro b/src/ChangShaTour/ChangShaTour.pro new file mode 100644 index 0000000..3807e0c --- /dev/null +++ b/src/ChangShaTour/ChangShaTour.pro @@ -0,0 +1,99 @@ +QT += core gui webenginewidgets sql + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + conditionwidget.cpp \ + confirmwidget.cpp \ + customizewidget.cpp \ + databaseconnector.cpp \ + favoritewidget.cpp \ + historywidget.cpp \ + homewidget.cpp \ + imgdownloader.cpp \ + journywidget.cpp \ + listwidget.cpp \ + loginwidget.cpp \ + main.cpp \ + mainwidget.cpp \ + mainwindow.cpp \ + planwidget.cpp \ + preferencewidget.cpp \ + recommendwidget.cpp \ + routechoicewidget.cpp \ + showplaceinfowidget.cpp \ + showrouteinfowidget.cpp \ + sortwidget.cpp \ + userinfowidget.cpp \ + userwidget.cpp \ + webwidget.cpp + +HEADERS += \ + conditionwidget.h \ + confirmwidget.h \ + customizewidget.h \ + databaseconnector.h \ + favoritewidget.h \ + historywidget.h \ + homewidget.h \ + imgdownloader.h \ + journywidget.h \ + listwidget.h \ + loginwidget.h \ + mainwidget.h \ + mainwindow.h \ + planwidget.h \ + preferencewidget.h \ + recommendwidget.h \ + routechoicewidget.h \ + showplaceinfowidget.h \ + showrouteinfowidget.h \ + sortwidget.h \ + userinfowidget.h \ + userwidget.h \ + webwidget.h + +FORMS += \ + conditionwidget.ui \ + confirmwidget.ui \ + customizewidget.ui \ + databaseconnector.ui \ + favoritewidget.ui \ + historywidget.ui \ + homewidget.ui \ + journywidget.ui \ + listwidget.ui \ + loginwidget.ui \ + mainwidget.ui \ + mainwindow.ui \ + planwidget.ui \ + preferencewidget.ui \ + recommendwidget.ui \ + routechoicewidget.ui \ + showplaceinfowidget.ui \ + showrouteinfowidget.ui \ + sortwidget.ui \ + userinfowidget.ui \ + userwidget.ui \ + webwidget.ui + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +RESOURCES += \ + resource.qrc diff --git a/src/Changsha_Tour/Changsha_Tour.pro.user.0c4c8cc b/src/ChangShaTour/ChangShaTour.pro.user similarity index 51% rename from src/Changsha_Tour/Changsha_Tour.pro.user.0c4c8cc rename to src/ChangShaTour/ChangShaTour.pro.user index de10e0b..54b70f7 100644 --- a/src/Changsha_Tour/Changsha_Tour.pro.user.0c4c8cc +++ b/src/ChangShaTour/ChangShaTour.pro.user @@ -1,337 +1,562 @@ - - - - - - EnvironmentId - {0c4c8ccc-c524-4850-ba23-7e124d5915df} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.13.1 MinGW 64-bit - Desktop Qt 5.13.1 MinGW 64-bit - qt.qt5.5131.win64_mingw73_kit - 0 - 0 - 0 - - F:/QtDemo/build-Changsha_Tour-Desktop_Qt_5_13_1_MinGW_64_bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - F:/QtDemo/build-Changsha_Tour-Desktop_Qt_5_13_1_MinGW_64_bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - F:/QtDemo/build-Changsha_Tour-Desktop_Qt_5_13_1_MinGW_64_bit-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - 部署 - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy Configuration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Changsha_Tour - - Qt4ProjectManager.Qt4RunConfiguration:F:/QtDemo/Changsha_Tour/Changsha_Tour.pro - - 3768 - false - true - true - false - false - true - - F:/QtDemo/build-Changsha_Tour-Desktop_Qt_5_13_1_MinGW_64_bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - + + + + + + EnvironmentId + {4109ff11-a646-43d1-9619-aeb32783df6e} + + + ProjectExplorer.Project.ActiveTarget + 1 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.14.2 MinGW 64-bit + Desktop Qt 5.14.2 MinGW 64-bit + qt.qt5.5142.win64_mingw73_kit + 0 + 0 + 0 + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + + ProjectExplorer.CustomExecutableRunConfiguration + + + false + + false + true + false + false + true + + + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop Qt 5.14.2 MSVC2017 64bit + Desktop Qt 5.14.2 MSVC2017 64bit + qt.qt5.5142.win64_msvc2017_64_kit + 0 + 0 + 0 + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:E:/ChangShaTour/Trip-in-Chang-sha/ChangShaTour/ChangShaTour.pro + E:/ChangShaTour/Trip-in-Chang-sha/ChangShaTour/ChangShaTour.pro + + false + + false + true + true + false + false + true + + E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/src/Changsha_Tour/conditionwidget.cpp b/src/ChangShaTour/conditionwidget.cpp similarity index 89% rename from src/Changsha_Tour/conditionwidget.cpp rename to src/ChangShaTour/conditionwidget.cpp index 373281b..8699e28 100644 --- a/src/Changsha_Tour/conditionwidget.cpp +++ b/src/ChangShaTour/conditionwidget.cpp @@ -1,59 +1,59 @@ -#include "conditionwidget.h" -#include "ui_conditionwidget.h" - -ConditionWidget::ConditionWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::ConditionWidget) -{ - ui->setupUi(this); - - QVBoxLayout * verticalLayout = new QVBoxLayout(); - QHBoxLayout * dateTimeHorizontalLayout = new QHBoxLayout(); - QHBoxLayout * placeHorizontalLayout = new QHBoxLayout(); - QHBoxLayout * numberHorizontalLayout = new QHBoxLayout(); - QHBoxLayout * budgetHorizontalLayout = new QHBoxLayout(); - - QLabel * startDateTimeLabel = new QLabel("开始时间"); - startDateTime = new QDateTimeEdit(); - QLabel * endDateTimeLabel = new QLabel("结束时间"); - endDateTime = new QDateTimeEdit(); - dateTimeHorizontalLayout->addWidget(startDateTimeLabel); - dateTimeHorizontalLayout->addWidget(startDateTime); - dateTimeHorizontalLayout->addWidget(endDateTimeLabel); - dateTimeHorizontalLayout->addWidget(endDateTime); - - QLabel * startPlaceLabel = new QLabel("起点"); - startPlace = new QLineEdit(); - QLabel * endPlaceLabel = new QLabel("终点"); - endPlace = new QLineEdit(); - placeHorizontalLayout->addWidget(startPlaceLabel); - placeHorizontalLayout->addWidget(startPlace); - placeHorizontalLayout->addWidget(endPlaceLabel); - placeHorizontalLayout->addWidget(endPlace); - - QLabel * numberLabel = new QLabel("人数"); - numberLine = new QLineEdit(); - numberLine->setPlaceholderText("请输入大于0小于等于8的整数"); - numberLine->setValidator(new QIntValidator(numberLine)); - numberHorizontalLayout->addWidget(numberLabel); - numberHorizontalLayout->addWidget(numberLine); - - QLabel * budgetLabel = new QLabel("预算"); - budgetLine = new QLineEdit(); - budgetLine->setPlaceholderText("请输入整数"); - budgetLine->setValidator(new QIntValidator(budgetLine)); - budgetHorizontalLayout->addWidget(budgetLabel); - budgetHorizontalLayout->addWidget(budgetLine); - - verticalLayout->addLayout(dateTimeHorizontalLayout); - verticalLayout->addLayout(placeHorizontalLayout); - verticalLayout->addLayout(numberHorizontalLayout); - verticalLayout->addLayout(budgetHorizontalLayout); - - this->setLayout(verticalLayout); -} - -ConditionWidget::~ConditionWidget() -{ - delete ui; -} +#include "conditionwidget.h" +#include "ui_conditionwidget.h" + +ConditionWidget::ConditionWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::ConditionWidget) +{ + ui->setupUi(this); + + QVBoxLayout * verticalLayout = new QVBoxLayout(); + QHBoxLayout * dateTimeHorizontalLayout = new QHBoxLayout(); + QHBoxLayout * placeHorizontalLayout = new QHBoxLayout(); + QHBoxLayout * numberHorizontalLayout = new QHBoxLayout(); + QHBoxLayout * budgetHorizontalLayout = new QHBoxLayout(); + + QLabel * startDateTimeLabel = new QLabel("start time"); + startDateTime = new QDateTimeEdit(); + QLabel * endDateTimeLabel = new QLabel("结束时间"); + endDateTime = new QDateTimeEdit(); + dateTimeHorizontalLayout->addWidget(startDateTimeLabel); + dateTimeHorizontalLayout->addWidget(startDateTime); + dateTimeHorizontalLayout->addWidget(endDateTimeLabel); + dateTimeHorizontalLayout->addWidget(endDateTime); + + QLabel * startPlaceLabel = new QLabel("起点"); + startPlace = new QLineEdit(); + QLabel * endPlaceLabel = new QLabel("终点"); + endPlace = new QLineEdit(); + placeHorizontalLayout->addWidget(startPlaceLabel); + placeHorizontalLayout->addWidget(startPlace); + placeHorizontalLayout->addWidget(endPlaceLabel); + placeHorizontalLayout->addWidget(endPlace); + + QLabel * numberLabel = new QLabel("人数"); + numberLine = new QLineEdit(); + numberLine->setPlaceholderText("enter an integer between 0 and 8"); + numberLine->setValidator(new QIntValidator(numberLine)); + numberHorizontalLayout->addWidget(numberLabel); + numberHorizontalLayout->addWidget(numberLine); + + QLabel * budgetLabel = new QLabel("预算"); + budgetLine = new QLineEdit(); + budgetLine->setPlaceholderText("enter an integer"); + budgetLine->setValidator(new QIntValidator(budgetLine)); + budgetHorizontalLayout->addWidget(budgetLabel); + budgetHorizontalLayout->addWidget(budgetLine); + + verticalLayout->addLayout(dateTimeHorizontalLayout); + verticalLayout->addLayout(placeHorizontalLayout); + verticalLayout->addLayout(numberHorizontalLayout); + verticalLayout->addLayout(budgetHorizontalLayout); + + this->setLayout(verticalLayout); +} + +ConditionWidget::~ConditionWidget() +{ + delete ui; +} diff --git a/src/Changsha_Tour/conditionwidget.h b/src/ChangShaTour/conditionwidget.h similarity index 94% rename from src/Changsha_Tour/conditionwidget.h rename to src/ChangShaTour/conditionwidget.h index d5cfdfa..4e9d515 100644 --- a/src/Changsha_Tour/conditionwidget.h +++ b/src/ChangShaTour/conditionwidget.h @@ -1,33 +1,34 @@ -#ifndef CONDITIONWIDGET_H -#define CONDITIONWIDGET_H - -#include -#include -#include -#include -#include -#include - -namespace Ui { -class ConditionWidget; -} - -class ConditionWidget : public QWidget -{ - Q_OBJECT - -public: - explicit ConditionWidget(QWidget *parent = nullptr); - ~ConditionWidget(); - -private: - Ui::ConditionWidget *ui; - QDateTimeEdit * startDateTime; - QDateTimeEdit * endDateTime; - QLineEdit * startPlace; - QLineEdit * endPlace; - QLineEdit * numberLine; - QLineEdit * budgetLine; -}; - -#endif // CONDITIONWIDGET_H +#ifndef CONDITIONWIDGET_H +#define CONDITIONWIDGET_H + +#include +#include +#include +#include +#include +#include + +namespace Ui { +class ConditionWidget; +} + +class ConditionWidget : public QWidget +{ + Q_OBJECT + +public: + explicit ConditionWidget(QWidget *parent = nullptr); + ~ConditionWidget(); + +private: + Ui::ConditionWidget *ui; + + QDateTimeEdit * startDateTime; + QDateTimeEdit * endDateTime; + QLineEdit * startPlace; + QLineEdit * endPlace; + QLineEdit * numberLine; + QLineEdit * budgetLine; +}; + +#endif // CONDITIONWIDGET_H diff --git a/src/Changsha_Tour/conditionwidget.ui b/src/ChangShaTour/conditionwidget.ui similarity index 95% rename from src/Changsha_Tour/conditionwidget.ui rename to src/ChangShaTour/conditionwidget.ui index ab9d2cf..dbd5f4e 100644 --- a/src/Changsha_Tour/conditionwidget.ui +++ b/src/ChangShaTour/conditionwidget.ui @@ -1,21 +1,21 @@ - - - - - ConditionWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - + + + + + ConditionWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/confirmwidget.cpp b/src/ChangShaTour/confirmwidget.cpp new file mode 100644 index 0000000..776b786 --- /dev/null +++ b/src/ChangShaTour/confirmwidget.cpp @@ -0,0 +1,24 @@ +#include "confirmwidget.h" +#include "ui_confirmwidget.h" + +#include +#include + +ConfirmWidget::ConfirmWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::ConfirmWidget) +{ + ui->setupUi(this); + + verLayout = new QVBoxLayout(); + + QLabel *label = new QLabel("ConfirmWidget"); + + setLayout(verLayout); + verLayout->addWidget(label); +} + +ConfirmWidget::~ConfirmWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/confirmwidget.h b/src/ChangShaTour/confirmwidget.h new file mode 100644 index 0000000..f90d60d --- /dev/null +++ b/src/ChangShaTour/confirmwidget.h @@ -0,0 +1,26 @@ +#ifndef CONFIRMWIDGET_H +#define CONFIRMWIDGET_H + +#include +#include +#include + +namespace Ui { +class ConfirmWidget; +} + +class ConfirmWidget : public QWidget +{ + Q_OBJECT + +public: + explicit ConfirmWidget(QWidget *parent = nullptr); + ~ConfirmWidget(); + +private: + Ui::ConfirmWidget *ui; + + QVBoxLayout *verLayout; +}; + +#endif // CONFIRMWIDGET_H diff --git a/src/ChangShaTour/confirmwidget.ui b/src/ChangShaTour/confirmwidget.ui new file mode 100644 index 0000000..0aee2d6 --- /dev/null +++ b/src/ChangShaTour/confirmwidget.ui @@ -0,0 +1,21 @@ + + + + + ConfirmWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/customizewidget.cpp b/src/ChangShaTour/customizewidget.cpp new file mode 100644 index 0000000..0d2ee78 --- /dev/null +++ b/src/ChangShaTour/customizewidget.cpp @@ -0,0 +1,14 @@ +#include "customizewidget.h" +#include "ui_customizewidget.h" + +CustomizeWidget::CustomizeWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::CustomizeWidget) +{ + ui->setupUi(this); +} + +CustomizeWidget::~CustomizeWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/customizewidget.h b/src/ChangShaTour/customizewidget.h new file mode 100644 index 0000000..f2d9396 --- /dev/null +++ b/src/ChangShaTour/customizewidget.h @@ -0,0 +1,22 @@ +#ifndef CUSTOMIZEWIDGET_H +#define CUSTOMIZEWIDGET_H + +#include + +namespace Ui { +class CustomizeWidget; +} + +class CustomizeWidget : public QWidget +{ + Q_OBJECT + +public: + explicit CustomizeWidget(QWidget *parent = nullptr); + ~CustomizeWidget(); + +private: + Ui::CustomizeWidget *ui; +}; + +#endif // CUSTOMIZEWIDGET_H diff --git a/src/ChangShaTour/customizewidget.ui b/src/ChangShaTour/customizewidget.ui new file mode 100644 index 0000000..268931c --- /dev/null +++ b/src/ChangShaTour/customizewidget.ui @@ -0,0 +1,21 @@ + + + + + CustomizeWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/databaseconnector.cpp b/src/ChangShaTour/databaseconnector.cpp new file mode 100644 index 0000000..f544653 --- /dev/null +++ b/src/ChangShaTour/databaseconnector.cpp @@ -0,0 +1,28 @@ +#include "databaseconnector.h" + +DatabaseConnector::DatabaseConnector() +{ + QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); //连接的MYSQL的数据库驱动 + this->db = db; +} + +QSqlDatabase DatabaseConnector::connectToDatabase() +{ + this->db.setHostName("121.36.100.63"); //主机名 + this->db.setPort(3306); //端口 + this->db.setDatabaseName("meituan"); //数据库名 + this->db.setUserName("mkl"); //用户名 + this->db.setPassword("010512"); //密码 + this->db.open(); + return this->db; +} + +void DatabaseConnector::closeDatabase() +{ + this->db.close(); +} + +DatabaseConnector::~DatabaseConnector() +{ + ; +} diff --git a/src/ChangShaTour/databaseconnector.h b/src/ChangShaTour/databaseconnector.h new file mode 100644 index 0000000..21fadd5 --- /dev/null +++ b/src/ChangShaTour/databaseconnector.h @@ -0,0 +1,19 @@ +#ifndef DATABASECONNECTOR_H +#define DATABASECONNECTOR_H + +#include + +class DatabaseConnector +{ +private: + QSqlDatabase db; + +public: + DatabaseConnector(); + ~DatabaseConnector(); + + QSqlDatabase connectToDatabase(); + void closeDatabase(); +}; + +#endif // DATABASECONNECTOR_H diff --git a/src/ChangShaTour/databaseconnector.ui b/src/ChangShaTour/databaseconnector.ui new file mode 100644 index 0000000..a4a9f93 --- /dev/null +++ b/src/ChangShaTour/databaseconnector.ui @@ -0,0 +1,21 @@ + + + + + DatabaseConnector + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/favoritewidget.cpp b/src/ChangShaTour/favoritewidget.cpp new file mode 100644 index 0000000..f706e10 --- /dev/null +++ b/src/ChangShaTour/favoritewidget.cpp @@ -0,0 +1,22 @@ +#include "favoritewidget.h" +#include "ui_favoritewidget.h" + +#include +#include + +FavoriteWidget::FavoriteWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::FavoriteWidget) +{ + ui->setupUi(this); + + QVBoxLayout *layout = new QVBoxLayout(); + + setLayout(layout); + layout->addWidget(new QLabel("FavoriteWidget")); +} + +FavoriteWidget::~FavoriteWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/favoritewidget.h b/src/ChangShaTour/favoritewidget.h new file mode 100644 index 0000000..839fc81 --- /dev/null +++ b/src/ChangShaTour/favoritewidget.h @@ -0,0 +1,22 @@ +#ifndef FAVORITEWIDGET_H +#define FAVORITEWIDGET_H + +#include + +namespace Ui { +class FavoriteWidget; +} + +class FavoriteWidget : public QWidget +{ + Q_OBJECT + +public: + explicit FavoriteWidget(QWidget *parent = nullptr); + ~FavoriteWidget(); + +private: + Ui::FavoriteWidget *ui; +}; + +#endif // FAVORITEWIDGET_H diff --git a/src/ChangShaTour/favoritewidget.ui b/src/ChangShaTour/favoritewidget.ui new file mode 100644 index 0000000..b43eb83 --- /dev/null +++ b/src/ChangShaTour/favoritewidget.ui @@ -0,0 +1,21 @@ + + + + + FavoriteWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/historywidget.cpp b/src/ChangShaTour/historywidget.cpp new file mode 100644 index 0000000..275cef7 --- /dev/null +++ b/src/ChangShaTour/historywidget.cpp @@ -0,0 +1,14 @@ +#include "historywidget.h" +#include "ui_historywidget.h" + +HistoryWidget::HistoryWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::HistoryWidget) +{ + ui->setupUi(this); +} + +HistoryWidget::~HistoryWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/historywidget.h b/src/ChangShaTour/historywidget.h new file mode 100644 index 0000000..a6535d3 --- /dev/null +++ b/src/ChangShaTour/historywidget.h @@ -0,0 +1,22 @@ +#ifndef HISTORYWIDGET_H +#define HISTORYWIDGET_H + +#include + +namespace Ui { +class HistoryWidget; +} + +class HistoryWidget : public QWidget +{ + Q_OBJECT + +public: + explicit HistoryWidget(QWidget *parent = nullptr); + ~HistoryWidget(); + +private: + Ui::HistoryWidget *ui; +}; + +#endif // HISTORYWIDGET_H diff --git a/src/ChangShaTour/historywidget.ui b/src/ChangShaTour/historywidget.ui new file mode 100644 index 0000000..e0ec93f --- /dev/null +++ b/src/ChangShaTour/historywidget.ui @@ -0,0 +1,21 @@ + + + + + HistoryWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/homewidget.cpp b/src/ChangShaTour/homewidget.cpp new file mode 100644 index 0000000..29c6ba7 --- /dev/null +++ b/src/ChangShaTour/homewidget.cpp @@ -0,0 +1,119 @@ +#include "homewidget.h" +#include "ui_homewidget.h" + +HomeWidget::HomeWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::HomeWidget) +{ + ui->setupUi(this); + + verLayout = new QVBoxLayout(); + + horLayout = new QHBoxLayout(); + rcmdBtn = new QPushButton("猜你喜欢"); + listBtn = new QPushButton("热门榜单"); + sortBtn = new QPushButton("Sort"); + 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() +{ + if (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->setVisible(true); + listWidget->setVisible(false); + sortWidget->setVisible(false); + planWidget->setVisible(false); + pageIndex = 0; + } +} + +void HomeWidget::switchToListWidget() +{ + if (pageIndex != 1) + { + //rcmdBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //listBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);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->setVisible(false); + listWidget->setVisible(true); + sortWidget->setVisible(false); + planWidget->setVisible(false); + pageIndex = 1; + } +} + +void HomeWidget::switchToSortWidget() +{ + if (pageIndex != 2) + { + //rcmdBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;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{background-color: rgb(20, 62, 134);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->setVisible(false); + listWidget->setVisible(false); + sortWidget->setVisible(true); + planWidget->setVisible(false); + pageIndex = 2; + } +} + +void HomeWidget::switchToPlanWidget() +{ + if (pageIndex != 3) + { + //rcmdBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;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{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + rcmdWidget->setVisible(false); + listWidget->setVisible(false); + sortWidget->setVisible(false); + planWidget->setVisible(true); + pageIndex = 3; + } +} + +HomeWidget::~HomeWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/homewidget.h b/src/ChangShaTour/homewidget.h new file mode 100644 index 0000000..db869f8 --- /dev/null +++ b/src/ChangShaTour/homewidget.h @@ -0,0 +1,51 @@ +#ifndef HOMEWIDGET_H +#define HOMEWIDGET_H + +#include +#include +#include +#include +#include "recommendwidget.h" +#include "listwidget.h" +#include "sortwidget.h" +#include "planwidget.h" + +namespace Ui { +class HomeWidget; +} + +class HomeWidget : public QWidget +{ + Q_OBJECT + +public: + explicit HomeWidget(QWidget *parent = nullptr); + ~HomeWidget(); + +private: + Ui::HomeWidget *ui; + + //表示现在homeWidget处在哪个界面 + int pageIndex; + + QVBoxLayout *verLayout; + + QHBoxLayout *horLayout; + QPushButton *rcmdBtn; + QPushButton *listBtn; + QPushButton *sortBtn; + QPushButton *planBtn; + + RecommendWidget *rcmdWidget; + ListWidget *listWidget; + SortWidget *sortWidget; + PlanWidget *planWidget; + +public slots: + void switchToRcmdWidget(); + void switchToListWidget(); + void switchToSortWidget(); + void switchToPlanWidget(); +}; + +#endif // HOMEWIDGET_H diff --git a/src/Changsha_Tour/rankwidget.ui b/src/ChangShaTour/homewidget.ui similarity index 77% rename from src/Changsha_Tour/rankwidget.ui rename to src/ChangShaTour/homewidget.ui index 78b43e2..3c6e743 100644 --- a/src/Changsha_Tour/rankwidget.ui +++ b/src/ChangShaTour/homewidget.ui @@ -1,21 +1,21 @@ - - - - - RankWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - + + + + + HomeWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/imgdownloader.cpp b/src/ChangShaTour/imgdownloader.cpp new file mode 100644 index 0000000..e7aeb0d --- /dev/null +++ b/src/ChangShaTour/imgdownloader.cpp @@ -0,0 +1,62 @@ +#include "imgdownloader.h" + +imgDownloader::imgDownloader() +{ + +} + +void imgDownloader::downloadFileFromUrl(QString strUrl, QString strFilePath) +{ + qDebug() << strUrl << " " << strFilePath; + QFile file; + file.setFileName(strFilePath); + if (!file.exists()) + { + if(file.open(QIODevice::WriteOnly)) + { + QByteArray byte = imgDownloader::InitGetRequest(strUrl, "downImgFromUrl"); + file.write(byte); + file.close(); + } + } +} + +//get +QByteArray imgDownloader::InitGetRequest(QString url, QString obj) +{ + //循环拼接 + QString baseUrl =url; + //构造请求 + QNetworkRequest request; + request.setUrl(QUrl(baseUrl)); + QNetworkAccessManager *manager = new QNetworkAccessManager(); + // 发送请求 + QNetworkReply *pReplay = manager->get(request); + //开启一个局部的事件循环,等待响应结束,退出 + QEventLoop eventLoop; + QObject::connect(pReplay,SIGNAL(finished()), &eventLoop, SLOT(quit())); + + //add timeout deal + QTimer *tmpTimer = new QTimer(); + QObject::connect(tmpTimer,SIGNAL(timeout()),&eventLoop, SLOT(quit())); + tmpTimer->setSingleShot(true); + tmpTimer->start(60000); + eventLoop.exec(); + tmpTimer->stop(); + + if (pReplay->error() == QNetworkReply::NoError) + { + qDebug() << QString("request %1 NoError").arg(obj); + } + else + { + qWarning()<attribute(QNetworkRequest::HttpStatusCodeAttribute); + //statusCodeV是HTTP服务器的相应码,reply->error()是Qt定义的错误码,可以参考QT的文档 + qWarning()<error()); + qWarning(qPrintable(pReplay->errorString())); + } + //获取响应信息 + QByteArray bytes = pReplay->readAll(); + return bytes; +} diff --git a/src/ChangShaTour/imgdownloader.h b/src/ChangShaTour/imgdownloader.h new file mode 100644 index 0000000..35c3bd4 --- /dev/null +++ b/src/ChangShaTour/imgdownloader.h @@ -0,0 +1,25 @@ +#ifndef IMGDOWNLOADER_H +#define IMGDOWNLOADER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class imgDownloader +{ +public: + imgDownloader(); + + void downloadFileFromUrl(QString strUrl, QString strFilePath); + QByteArray InitGetRequest(QString url, QString obj); +}; + +#endif // IMGDOWNLOADER_H diff --git a/src/ChangShaTour/journywidget.cpp b/src/ChangShaTour/journywidget.cpp new file mode 100644 index 0000000..fd36e56 --- /dev/null +++ b/src/ChangShaTour/journywidget.cpp @@ -0,0 +1,14 @@ +#include "journywidget.h" +#include "ui_journywidget.h" + +JournyWidget::JournyWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::JournyWidget) +{ + ui->setupUi(this); +} + +JournyWidget::~JournyWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/journywidget.h b/src/ChangShaTour/journywidget.h new file mode 100644 index 0000000..88ad74b --- /dev/null +++ b/src/ChangShaTour/journywidget.h @@ -0,0 +1,22 @@ +#ifndef JOURNYWIDGET_H +#define JOURNYWIDGET_H + +#include + +namespace Ui { +class JournyWidget; +} + +class JournyWidget : public QWidget +{ + Q_OBJECT + +public: + explicit JournyWidget(QWidget *parent = nullptr); + ~JournyWidget(); + +private: + Ui::JournyWidget *ui; +}; + +#endif // JOURNYWIDGET_H diff --git a/src/Changsha_Tour/recommandrouteswidget.ui b/src/ChangShaTour/journywidget.ui similarity index 76% rename from src/Changsha_Tour/recommandrouteswidget.ui rename to src/ChangShaTour/journywidget.ui index 7cb82fa..ca9cb0a 100644 --- a/src/Changsha_Tour/recommandrouteswidget.ui +++ b/src/ChangShaTour/journywidget.ui @@ -1,21 +1,21 @@ - - - - - RecommandRoutesWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - + + + + + JournyWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/lightblue.css b/src/ChangShaTour/lightblue.css new file mode 100644 index 0000000..fdf68f1 --- /dev/null +++ b/src/ChangShaTour/lightblue.css @@ -0,0 +1,642 @@ +QMainWindow{background-color:#EAF7FF;}*{outline:0px;color:#386487;} + +QWidget[form="true"],QLabel[frameShape="1"]{ +border:1px solid #C0DCF2; +border-radius:0px; +} + +QWidget[form="bottom"]{ +background:#DEF0FE; +} + +QWidget[form="bottom"] .QFrame{ +border:1px solid #386487; +} + +QWidget[form="bottom"] QLabel,QWidget[form="title"] QLabel{ +border-radius:0px; +color:#386487; +background:none; +border-style:none; +} + +QWidget[form="title"],QWidget[nav="left"],QWidget[nav="top"] QAbstractButton{ +border-style:none; +border-radius:0px; +padding:5px; +color:#386487; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #DEF0FE,stop:1 #C0DEF6); +} + +QWidget[nav="top"] QAbstractButton:hover,QWidget[nav="top"] QAbstractButton:pressed,QWidget[nav="top"] QAbstractButton:checked{ +border-style:solid; +border-width:0px 0px 2px 0px; +padding:4px 4px 2px 4px; +border-color:#00BB9E; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF); +} + +QWidget[nav="left"] QAbstractButton{ +border-radius:0px; +color:#386487; +background:none; +border-style:none; +} + +QWidget[nav="left"] QAbstractButton:hover{ +color:#FFFFFF; +background-color:#00BB9E; +} + +QWidget[nav="left"] QAbstractButton:checked,QWidget[nav="left"] QAbstractButton:pressed{ +color:#386487; +border-style:solid; +border-width:0px 0px 0px 2px; +padding:4px 4px 4px 2px; +border-color:#00BB9E; +background-color:#EAF7FF; +} + +QWidget[video="true"] QLabel{ +color:#386487; +border:1px solid #C0DCF2; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #DEF0FE,stop:1 #C0DEF6); +} + +QWidget[video="true"] QLabel:focus{ +border:1px solid #00BB9E; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF); +} + +QLineEdit,QTextEdit,QPlainTextEdit,QSpinBox,QDoubleSpinBox,QComboBox,QDateEdit,QTimeEdit,QDateTimeEdit{ +border:1px solid #C0DCF2; +border-radius:3px; +padding:2px; +background:none; +selection-background-color:#DEF0FE; +selection-color:#386487; +} + +QLineEdit:focus,QTextEdit:focus,QPlainTextEdit:focus,QSpinBox:focus,QDoubleSpinBox:focus,QComboBox:focus,QDateEdit:focus,QTimeEdit:focus,QDateTimeEdit:focus,QLineEdit:hover,QTextEdit:hover,QPlainTextEdit:hover,QSpinBox:hover,QDoubleSpinBox:hover,QComboBox:hover,QDateEdit:hover,QTimeEdit:hover,QDateTimeEdit:hover{ +border:1px solid #C0DCF2; +} + +QLineEdit[echoMode="2"]{ +lineedit-password-character:9679; +} + +.QFrame{ +border:1px solid #C0DCF2; +border-radius:3px; +} + +.QGroupBox{ +border:1px solid #C0DCF2; +border-radius:5px; +margin-top:3ex; +} + +.QGroupBox::title{ +subcontrol-origin:margin; +position:relative; +left:10px; +} + +.QPushButton,.QToolButton{ +border-style:none; +border:1px solid #C0DCF2; +color:#386487; +padding:5px; +min-height:15px; +border-radius:5px; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #DEF0FE,stop:1 #C0DEF6); +} + +.QPushButton:hover,.QToolButton:hover{ +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF); +} + +.QPushButton:pressed,.QToolButton:pressed{ +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #DEF0FE,stop:1 #C0DEF6); +} + +.QToolButton::menu-indicator{ +image:None; +} + +QToolButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{ +border-radius:3px; +color:#386487; +padding:3px; +margin:0px; +background:none; +border-style:none; +} + +QToolButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{ +color:#FFFFFF; +margin:1px 1px 2px 1px; +background-color:rgba(51,127,209,230); +} + +QPushButton#btnMenu_Close:hover{ +color:#FFFFFF; +margin:1px 1px 2px 1px; +background-color:rgba(238,0,0,128); +} + +QRadioButton::indicator{ +width:15px; +height:15px; +} + +QRadioButton::indicator::unchecked{ +image:url(:/qss/lightblue/radiobutton_unchecked.png); +} + +QRadioButton::indicator::unchecked:disabled{ +image:url(:/qss/lightblue/radiobutton_unchecked_disable.png); +} + +QRadioButton::indicator::checked{ +image:url(:/qss/lightblue/radiobutton_checked.png); +} + +QRadioButton::indicator::checked:disabled{ +image:url(:/qss/lightblue/radiobutton_checked_disable.png); +} + +QGroupBox::indicator,QTreeWidget::indicator,QListWidget::indicator{ +padding:0px -3px 0px 3px; +} + +QCheckBox::indicator,QGroupBox::indicator,QTreeWidget::indicator,QListWidget::indicator{ +width:13px; +height:13px; +} + +QCheckBox::indicator:unchecked,QGroupBox::indicator:unchecked,QTreeWidget::indicator:unchecked,QListWidget::indicator:unchecked{ +image:url(:/qss/lightblue/checkbox_unchecked.png); +} + +QCheckBox::indicator:unchecked:disabled,QGroupBox::indicator:unchecked:disabled,QTreeWidget::indicator:unchecked:disabled,QListWidget::indicator:disabled{ +image:url(:/qss/lightblue/checkbox_unchecked_disable.png); +} + +QCheckBox::indicator:checked,QGroupBox::indicator:checked,QTreeWidget::indicator:checked,QListWidget::indicator:checked{ +image:url(:/qss/lightblue/checkbox_checked.png); +} + +QCheckBox::indicator:checked:disabled,QGroupBox::indicator:checked:disabled,QTreeWidget::indicator:checked:disabled,QListWidget::indicator:checked:disabled{ +image:url(:/qss/lightblue/checkbox_checked_disable.png); +} + +QCheckBox::indicator:indeterminate,QGroupBox::indicator:indeterminate,QTreeWidget::indicator:indeterminate,QListWidget::indicator:indeterminate{ +image:url(:/qss/lightblue/checkbox_parcial.png); +} + +QCheckBox::indicator:indeterminate:disabled,QGroupBox::indicator:indeterminate:disabled,QTreeWidget::indicator:indeterminate:disabled,QListWidget::indicator:indeterminate:disabled{ +image:url(:/qss/lightblue/checkbox_parcial_disable.png); +} + +QTimeEdit::up-button,QDateEdit::up-button,QDateTimeEdit::up-button,QDoubleSpinBox::up-button,QSpinBox::up-button{ +image:url(:/qss/lightblue/add_top.png); +width:10px; +height:10px; +padding:2px 5px 0px 0px; +} + +QTimeEdit::down-button,QDateEdit::down-button,QDateTimeEdit::down-button,QDoubleSpinBox::down-button,QSpinBox::down-button{ +image:url(:/qss/lightblue/add_bottom.png); +width:10px; +height:10px; +padding:0px 5px 2px 0px; +} + +QTimeEdit::up-button:pressed,QDateEdit::up-button:pressed,QDateTimeEdit::up-button:pressed,QDoubleSpinBox::up-button:pressed,QSpinBox::up-button:pressed{ +top:-2px; +} + +QTimeEdit::down-button:pressed,QDateEdit::down-button:pressed,QDateTimeEdit::down-button:pressed,QDoubleSpinBox::down-button:pressed,QSpinBox::down-button:pressed,QSpinBox::down-button:pressed{ +bottom:-2px; +} + +QComboBox::down-arrow,QDateEdit[calendarPopup="true"]::down-arrow,QTimeEdit[calendarPopup="true"]::down-arrow,QDateTimeEdit[calendarPopup="true"]::down-arrow{ +image:url(:/qss/lightblue/add_bottom.png); +width:10px; +height:10px; +right:2px; +} + +QComboBox::drop-down,QDateEdit::drop-down,QTimeEdit::drop-down,QDateTimeEdit::drop-down{ +subcontrol-origin:padding; +subcontrol-position:top right; +width:15px; +border-left-width:0px; +border-left-style:solid; +border-top-right-radius:3px; +border-bottom-right-radius:3px; +border-left-color:#C0DCF2; +} + +QComboBox::drop-down:on{ +top:1px; +} + +QMenuBar::item{ +color:#386487; +background-color:#DEF0FE; +margin:0px; +padding:3px 10px; +} + +QMenu,QMenuBar,QMenu:disabled,QMenuBar:disabled{ +color:#386487; +background-color:#DEF0FE; +border:1px solid #C0DCF2; +margin:0px; +} + +QMenu::item{ +padding:3px 20px; +} + +QMenu::indicator{ +width:13px; +height:13px; +} + +QMenu::item:selected,QMenuBar::item:selected{ +color:#386487; +border:0px solid #C0DCF2; +background:#F2F9FF; +} + +QMenu::separator{ +height:1px; +background:#C0DCF2; +} + +QProgressBar{ +min-height:10px; +background:#DEF0FE; +border-radius:5px; +text-align:center; +border:1px solid #DEF0FE; +} + +QProgressBar:chunk{ +border-radius:5px; +background-color:#C0DCF2; +} + +QSlider::groove:horizontal{ +background:#DEF0FE; +height:8px; +border-radius:4px; +} + +QSlider::add-page:horizontal{ +background:#DEF0FE; +height:8px; +border-radius:4px; +} + +QSlider::sub-page:horizontal{ +background:#C0DCF2; +height:8px; +border-radius:4px; +} + +QSlider::handle:horizontal{ +width:13px; +margin-top:-3px; +margin-bottom:-3px; +border-radius:6px; +background:qradialgradient(spread:pad,cx:0.5,cy:0.5,radius:0.5,fx:0.5,fy:0.5,stop:0.6 #EAF7FF,stop:0.8 #C0DCF2); +} + +QSlider::groove:vertical{ +width:8px; +border-radius:4px; +background:#DEF0FE; +} + +QSlider::add-page:vertical{ +width:8px; +border-radius:4px; +background:#DEF0FE; +} + +QSlider::sub-page:vertical{ +width:8px; +border-radius:4px; +background:#C0DCF2; +} + +QSlider::handle:vertical{ +height:14px; +margin-left:-3px; +margin-right:-3px; +border-radius:6px; +background:qradialgradient(spread:pad,cx:0.5,cy:0.5,radius:0.5,fx:0.5,fy:0.5,stop:0.6 #EAF7FF,stop:0.8 #C0DCF2); +} + +QScrollBar:horizontal{ +background:#DEF0FE; +padding:0px; +border-radius:6px; +max-height:12px; +} + +QScrollBar::handle:horizontal{ +background:#DAEFFF; +min-width:50px; +border-radius:6px; +} + +QScrollBar::handle:horizontal:hover{ +background:#C0DCF2; +} + +QScrollBar::handle:horizontal:pressed{ +background:#C0DCF2; +} + +QScrollBar::add-page:horizontal{ +background:none; +} + +QScrollBar::sub-page:horizontal{ +background:none; +} + +QScrollBar::add-line:horizontal{ +background:none; +} + +QScrollBar::sub-line:horizontal{ +background:none; +} + +QScrollBar:vertical{ +background:#DEF0FE; +padding:0px; +border-radius:6px; +max-width:12px; +} + +QScrollBar::handle:vertical{ +background:#DAEFFF; +min-height:50px; +border-radius:6px; +} + +QScrollBar::handle:vertical:hover{ +background:#C0DCF2; +} + +QScrollBar::handle:vertical:pressed{ +background:#C0DCF2; +} + +QScrollBar::add-page:vertical{ +background:none; +} + +QScrollBar::sub-page:vertical{ +background:none; +} + +QScrollBar::add-line:vertical{ +background:none; +} + +QScrollBar::sub-line:vertical{ +background:none; +} + +QScrollArea{ +border:0px; +} + +QTreeView,QListView,QTableView,QTabWidget::pane{ +border:1px solid #C0DCF2; +selection-background-color:#F2F9FF; +selection-color:#386487; +alternate-background-color:#DAEFFF; +gridline-color:#C0DCF2; +} + +QTreeView::branch:closed:has-children{ +margin:4px; +border-image:url(:/qss/lightblue/branch_open.png); +} + +QTreeView::branch:open:has-children{ +margin:4px; +border-image:url(:/qss/lightblue/branch_close.png); +} + +QTreeView,QListView,QTableView,QSplitter::handle,QTreeView::branch{ +background:#EAF7FF; +} + +QTableView::item:selected,QListView::item:selected,QTreeView::item:selected{ +color:#386487; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #DEF0FE,stop:1 #C0DEF6); +} + +QTableView::item:hover,QListView::item:hover,QTreeView::item:hover{ +color:#386487; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF); +} + +QTableView::item,QListView::item,QTreeView::item{ +padding:1px; +margin:0px; +} + +QHeaderView::section,QTableCornerButton:section{ +padding:3px; +margin:0px; +color:#386487; +border:1px solid #C0DCF2; +border-left-width:0px; +border-right-width:1px; +border-top-width:0px; +border-bottom-width:1px; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF); +} + +QTabBar::tab{ +border:1px solid #C0DCF2; +color:#386487; +margin:0px; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF); +} + +QTabBar::tab:selected,QTabBar::tab:hover{ +border-style:solid; +border-color:#00BB9E; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #DEF0FE,stop:1 #C0DEF6); +} + +QTabBar::tab:top,QTabBar::tab:bottom{ +padding:3px 8px 3px 8px; +} + +QTabBar::tab:left,QTabBar::tab:right{ +padding:8px 3px 8px 3px; +} + +QTabBar::tab:top:selected,QTabBar::tab:top:hover{ +border-width:2px 0px 0px 0px; +} + +QTabBar::tab:right:selected,QTabBar::tab:right:hover{ +border-width:0px 0px 0px 2px; +} + +QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{ +border-width:0px 0px 2px 0px; +} + +QTabBar::tab:left:selected,QTabBar::tab:left:hover{ +border-width:0px 2px 0px 0px; +} + +QTabBar::tab:first:top:selected,QTabBar::tab:first:top:hover,QTabBar::tab:first:bottom:selected,QTabBar::tab:first:bottom:hover{ +border-left-width:1px; +border-left-color:#C0DCF2; +} + +QTabBar::tab:first:left:selected,QTabBar::tab:first:left:hover,QTabBar::tab:first:right:selected,QTabBar::tab:first:right:hover{ +border-top-width:1px; +border-top-color:#C0DCF2; +} + +QTabBar::tab:last:top:selected,QTabBar::tab:last:top:hover,QTabBar::tab:last:bottom:selected,QTabBar::tab:last:bottom:hover{ +border-right-width:1px; +border-right-color:#C0DCF2; +} + +QTabBar::tab:last:left:selected,QTabBar::tab:last:left:hover,QTabBar::tab:last:right:selected,QTabBar::tab:last:right:hover{ +border-bottom-width:1px; +border-bottom-color:#C0DCF2; +} + +QStatusBar::item{ +border:0px solid #DEF0FE; +border-radius:3px; +} + +QToolBox::tab,QGroupBox#gboxDevicePanel,QGroupBox#gboxDeviceTitle,QFrame#gboxDevicePanel,QFrame#gboxDeviceTitle{ +padding:3px; +border-radius:5px; +color:#386487; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #DEF0FE,stop:1 #C0DEF6); +} + +QToolTip{ +border:0px solid #386487; +padding:1px; +color:#386487; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #DEF0FE,stop:1 #C0DEF6); +} + +QToolBox::tab:selected{ +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF); +} + +QPrintPreviewDialog QToolButton{ +border:0px solid #386487; +border-radius:0px; +margin:0px; +padding:3px; +background:none; +} + +QColorDialog QPushButton,QFileDialog QPushButton{ +min-width:80px; +} + +QToolButton#qt_calendar_prevmonth{ +icon-size:0px; +min-width:20px; +image:url(:/qss/lightblue/calendar_prevmonth.png); +} + +QToolButton#qt_calendar_nextmonth{ +icon-size:0px; +min-width:20px; +image:url(:/qss/lightblue/calendar_nextmonth.png); +} + +QToolButton#qt_calendar_prevmonth,QToolButton#qt_calendar_nextmonth,QToolButton#qt_calendar_monthbutton,QToolButton#qt_calendar_yearbutton{ +border:0px solid #386487; +border-radius:3px; +margin:3px 3px 3px 3px; +padding:3px; +background:none; +} + +QToolButton#qt_calendar_prevmonth:hover,QToolButton#qt_calendar_nextmonth:hover,QToolButton#qt_calendar_monthbutton:hover,QToolButton#qt_calendar_yearbutton:hover,QToolButton#qt_calendar_prevmonth:pressed,QToolButton#qt_calendar_nextmonth:pressed,QToolButton#qt_calendar_monthbutton:pressed,QToolButton#qt_calendar_yearbutton:pressed{ +border:1px solid #C0DCF2; +} + +QCalendarWidget QSpinBox#qt_calendar_yearedit{ +margin:2px; +} + +QCalendarWidget QToolButton::menu-indicator{ +image:None; +} + +QCalendarWidget QTableView{ +border-width:0px; +} + +QCalendarWidget QWidget#qt_calendar_navigationbar{ +border:1px solid #C0DCF2; +border-width:1px 1px 0px 1px; +background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #DEF0FE,stop:1 #C0DEF6); +} + +QComboBox QAbstractItemView::item{ +min-height:20px; +min-width:10px; +} + +QTableView[model="true"]::item{ +padding:0px; +margin:0px; +} + +QTableView QLineEdit,QTableView QComboBox,QTableView QSpinBox,QTableView QDoubleSpinBox,QTableView QDateEdit,QTableView QTimeEdit,QTableView QDateTimeEdit{ +border-width:0px; +border-radius:0px; +} + +QTableView QLineEdit:focus,QTableView QComboBox:focus,QTableView QSpinBox:focus,QTableView QDoubleSpinBox:focus,QTableView QDateEdit:focus,QTableView QTimeEdit:focus,QTableView QDateTimeEdit:focus{ +border-width:0px; +border-radius:0px; +} + +QLineEdit,QTextEdit,QPlainTextEdit,QSpinBox,QDoubleSpinBox,QComboBox,QDateEdit,QTimeEdit,QDateTimeEdit{ +background:#EAF7FF; +} + +*:disabled{ +background:#EAF7FF; +border-color:#DEF0FE; +} + +/*TextColor:#386487*/ +/*PanelColor:#EAF7FF*/ +/*BorderColor:#C0DCF2*/ +/*NormalColorStart:#DEF0FE*/ +/*NormalColorEnd:#C0DEF6*/ +/*DarkColorStart:#F2F9FF*/ +/*DarkColorEnd:#DAEFFF*/ +/*HighColor:#00BB9E*/ diff --git a/src/ChangShaTour/listwidget.cpp b/src/ChangShaTour/listwidget.cpp new file mode 100644 index 0000000..70cd31d --- /dev/null +++ b/src/ChangShaTour/listwidget.cpp @@ -0,0 +1,22 @@ +#include "listwidget.h" +#include "ui_listwidget.h" + +#include +#include + +ListWidget::ListWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::ListWidget) +{ + ui->setupUi(this); + + QVBoxLayout *layout = new QVBoxLayout(); + + setLayout(layout); + layout->addWidget(new QLabel("ListWidget")); +} + +ListWidget::~ListWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/listwidget.h b/src/ChangShaTour/listwidget.h new file mode 100644 index 0000000..905c993 --- /dev/null +++ b/src/ChangShaTour/listwidget.h @@ -0,0 +1,22 @@ +#ifndef LISTWIDGET_H +#define LISTWIDGET_H + +#include + +namespace Ui { +class ListWidget; +} + +class ListWidget : public QWidget +{ + Q_OBJECT + +public: + explicit ListWidget(QWidget *parent = nullptr); + ~ListWidget(); + +private: + Ui::ListWidget *ui; +}; + +#endif // LISTWIDGET_H diff --git a/src/Changsha_Tour/searchwidget.ui b/src/ChangShaTour/listwidget.ui similarity index 77% rename from src/Changsha_Tour/searchwidget.ui rename to src/ChangShaTour/listwidget.ui index b23f6c5..e9c04df 100644 --- a/src/Changsha_Tour/searchwidget.ui +++ b/src/ChangShaTour/listwidget.ui @@ -1,21 +1,21 @@ - - - - - SearchWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - + + + + + ListWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/Changsha_Tour/loginwidget.cpp b/src/ChangShaTour/loginwidget.cpp similarity index 96% rename from src/Changsha_Tour/loginwidget.cpp rename to src/ChangShaTour/loginwidget.cpp index a6a5b0c..54701d8 100644 --- a/src/Changsha_Tour/loginwidget.cpp +++ b/src/ChangShaTour/loginwidget.cpp @@ -1,46 +1,46 @@ -#include "loginwidget.h" -#include "ui_loginwidget.h" - -LoginWidget::LoginWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::LoginWidget) -{ - ui->setupUi(this); - - QVBoxLayout * verticalLayout = new QVBoxLayout(); - QHBoxLayout * accountHorizontalLayout = new QHBoxLayout(); - QHBoxLayout * passwordHorizontalLayout = new QHBoxLayout(); - QHBoxLayout * buttonHorizontalLayout = new QHBoxLayout(); - - QLabel * accountLabel = new QLabel("账号"); - accountLine = new QLineEdit(); - accountHorizontalLayout->addWidget(accountLabel); - accountHorizontalLayout->addWidget(accountLine); - - QLabel * passwordLabel = new QLabel("密码"); - passwordLine = new QLineEdit(); - passwordLine->setEchoMode(QLineEdit::Password); - passwordHorizontalLayout->addWidget(passwordLabel); - passwordHorizontalLayout->addWidget(passwordLine); - - loginButton = new QPushButton("登陆"); - registerButton = new QPushButton("注册"); - buttonHorizontalLayout->addWidget(loginButton); - buttonHorizontalLayout->addWidget(registerButton); - - verticalLayout->addLayout(accountHorizontalLayout); - verticalLayout->addLayout(passwordHorizontalLayout); - verticalLayout->addLayout(buttonHorizontalLayout); - - this->setLayout(verticalLayout); -} - -LoginWidget::~LoginWidget() -{ - delete ui; -} - -QPushButton * LoginWidget::GetLoginButton() -{ - return loginButton; -} +#include "loginwidget.h" +#include "ui_loginwidget.h" + +LoginWidget::LoginWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::LoginWidget) +{ + ui->setupUi(this); + + QVBoxLayout * verticalLayout = new QVBoxLayout(); + QHBoxLayout * accountHorizontalLayout = new QHBoxLayout(); + QHBoxLayout * passwordHorizontalLayout = new QHBoxLayout(); + QHBoxLayout * buttonHorizontalLayout = new QHBoxLayout(); + + QLabel * accountLabel = new QLabel("账号"); + accountLine = new QLineEdit(); + accountHorizontalLayout->addWidget(accountLabel); + accountHorizontalLayout->addWidget(accountLine); + + QLabel * passwordLabel = new QLabel("密码"); + passwordLine = new QLineEdit(); + passwordLine->setEchoMode(QLineEdit::Password); + passwordHorizontalLayout->addWidget(passwordLabel); + passwordHorizontalLayout->addWidget(passwordLine); + + loginButton = new QPushButton("登陆"); + registerButton = new QPushButton("注册"); + buttonHorizontalLayout->addWidget(loginButton); + buttonHorizontalLayout->addWidget(registerButton); + + verticalLayout->addLayout(accountHorizontalLayout); + verticalLayout->addLayout(passwordHorizontalLayout); + verticalLayout->addLayout(buttonHorizontalLayout); + + this->setLayout(verticalLayout); +} + +QPushButton * LoginWidget::GetLoginButton() +{ + return loginButton; +} + +LoginWidget::~LoginWidget() +{ + delete ui; +} diff --git a/src/Changsha_Tour/loginwidget.h b/src/ChangShaTour/loginwidget.h similarity index 93% rename from src/Changsha_Tour/loginwidget.h rename to src/ChangShaTour/loginwidget.h index 309facc..72c9d93 100644 --- a/src/Changsha_Tour/loginwidget.h +++ b/src/ChangShaTour/loginwidget.h @@ -1,31 +1,33 @@ -#ifndef LOGINWIDGET_H -#define LOGINWIDGET_H - -#include -#include -#include -#include -#include - -namespace Ui { -class LoginWidget; -} - -class LoginWidget : public QWidget -{ - Q_OBJECT - -public: - explicit LoginWidget(QWidget *parent = nullptr); - ~LoginWidget(); - QPushButton * GetLoginButton(); - -private: - Ui::LoginWidget *ui; - QLineEdit * accountLine; - QLineEdit * passwordLine; - QPushButton * loginButton; - QPushButton * registerButton; -}; - -#endif // LOGINWIDGET_H +#ifndef LOGINWIDGET_H +#define LOGINWIDGET_H + +#include +#include +#include +#include +#include + +namespace Ui { +class LoginWidget; +} + +class LoginWidget : public QWidget +{ + Q_OBJECT + +public: + explicit LoginWidget(QWidget *parent = nullptr); + ~LoginWidget(); + + QPushButton * GetLoginButton(); + +private: + Ui::LoginWidget *ui; + + QLineEdit * accountLine; + QLineEdit * passwordLine; + QPushButton * loginButton; + QPushButton * registerButton; +}; + +#endif // LOGINWIDGET_H diff --git a/src/Changsha_Tour/loginwidget.ui b/src/ChangShaTour/loginwidget.ui similarity index 94% rename from src/Changsha_Tour/loginwidget.ui rename to src/ChangShaTour/loginwidget.ui index 665b2da..f8beca2 100644 --- a/src/Changsha_Tour/loginwidget.ui +++ b/src/ChangShaTour/loginwidget.ui @@ -1,21 +1,21 @@ - - - - - LoginWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - + + + + + LoginWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/main.cpp b/src/ChangShaTour/main.cpp new file mode 100644 index 0000000..7dc5ed6 --- /dev/null +++ b/src/ChangShaTour/main.cpp @@ -0,0 +1,25 @@ +#include "mainwindow.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + + QFile styleFile(":/lightblue.css"); + if(styleFile.open(QIODevice::ReadOnly)) + { + qDebug("open success"); + QString setStyleSheet(styleFile.readAll()); + a.setStyleSheet(setStyleSheet); + styleFile.close(); + } + else + { + qDebug("Open failed"); + } + + MainWindow w; + w.show(); + return a.exec(); +} diff --git a/src/ChangShaTour/mainwidget.cpp b/src/ChangShaTour/mainwidget.cpp new file mode 100644 index 0000000..de4c11d --- /dev/null +++ b/src/ChangShaTour/mainwidget.cpp @@ -0,0 +1,68 @@ +#include "mainwidget.h" +#include "ui_mainwidget.h" + +MainWidget::MainWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::MainWidget) +{ + ui->setupUi(this); + + verLayout = new QVBoxLayout(); + + horLayout = new QHBoxLayout(); + homeBtn = new QPushButton("首页"); + userBtn = new QPushButton("个人主页"); + searchBar = new QLineEdit(); + searchBtn = new QPushButton("搜索"); + //首页按钮默认选中 + atHome = true; + //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); + userWidget->setVisible(false); + + setLayout(verLayout); + + verLayout->addLayout(horLayout); + verLayout->addWidget(homeWidget); + verLayout->addWidget(userWidget); + + horLayout->addWidget(homeBtn); + horLayout->addWidget(userBtn); + horLayout->addWidget(searchBar); + horLayout->addWidget(searchBtn); + + connect(homeBtn, &QPushButton::clicked, this, &MainWidget::switchToHome); + connect(userBtn, &QPushButton::clicked, this, &MainWidget::switchToUser); +} + +void MainWidget::switchToHome() +{ + if (!atHome) + { + //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->setVisible(true); + userWidget->setVisible(false); + atHome = true; + } +} + +void MainWidget::switchToUser() +{ + if (atHome) + { + //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);}"); + homeWidget->setVisible(false); + userWidget->setVisible(true); + atHome = false; + } +} + +MainWidget::~MainWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/mainwidget.h b/src/ChangShaTour/mainwidget.h new file mode 100644 index 0000000..2fefddf --- /dev/null +++ b/src/ChangShaTour/mainwidget.h @@ -0,0 +1,45 @@ +#ifndef MAINWIDGET_H +#define MAINWIDGET_H + +#include +#include +#include +#include +#include +#include "homewidget.h" +#include "userwidget.h" + +namespace Ui { +class MainWidget; +} + +class MainWidget : public QWidget +{ + Q_OBJECT + +public: + explicit MainWidget(QWidget *parent = nullptr); + ~MainWidget(); + +private: + Ui::MainWidget *ui; + + bool atHome; + + QVBoxLayout *verLayout; + + QHBoxLayout *horLayout; + QPushButton *homeBtn; + QPushButton *userBtn; + QLineEdit *searchBar; + QPushButton *searchBtn; + + HomeWidget *homeWidget; + UserWidget *userWidget; + +public slots: + void switchToHome(); + void switchToUser(); +}; + +#endif // MAINWIDGET_H diff --git a/src/Changsha_Tour/recommandwidget.ui b/src/ChangShaTour/mainwidget.ui similarity index 77% rename from src/Changsha_Tour/recommandwidget.ui rename to src/ChangShaTour/mainwidget.ui index 7f2b4f4..7727461 100644 --- a/src/Changsha_Tour/recommandwidget.ui +++ b/src/ChangShaTour/mainwidget.ui @@ -1,21 +1,21 @@ - - - - - RecommandWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - + + + + + MainWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/mainwindow.cpp b/src/ChangShaTour/mainwindow.cpp new file mode 100644 index 0000000..f8aea30 --- /dev/null +++ b/src/ChangShaTour/mainwindow.cpp @@ -0,0 +1,31 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ + ui->setupUi(this); + + resize(400,300); + loginWidget = new LoginWidget(); + mainWidget = new MainWidget(); + + this->setCentralWidget(loginWidget); + + connect(loginWidget->GetLoginButton(), &QPushButton::clicked, this, &MainWindow::switchToMain); +} + +void MainWindow::switchToMain() +{ + resize(1340, 720); + loginWidget->deleteLater(); + setWindowTitle("Tour in Changsha"); + setCentralWidget(mainWidget); +} + +MainWindow::~MainWindow() +{ + delete ui; +} + diff --git a/src/ChangShaTour/mainwindow.h b/src/ChangShaTour/mainwindow.h new file mode 100644 index 0000000..aec6b05 --- /dev/null +++ b/src/ChangShaTour/mainwindow.h @@ -0,0 +1,30 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include "loginwidget.h" +#include "mainwidget.h" + +QT_BEGIN_NAMESPACE +namespace Ui { class MainWindow; } +QT_END_NAMESPACE + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + +private: + Ui::MainWindow *ui; + + LoginWidget *loginWidget; + MainWidget *mainWidget; + +public slots: +// void switchToLogin(); + void switchToMain(); +}; +#endif // MAINWINDOW_H diff --git a/src/Changsha_Tour/mainwindow.ui b/src/ChangShaTour/mainwindow.ui similarity index 96% rename from src/Changsha_Tour/mainwindow.ui rename to src/ChangShaTour/mainwindow.ui index b232854..b742055 100644 --- a/src/Changsha_Tour/mainwindow.ui +++ b/src/ChangShaTour/mainwindow.ui @@ -1,22 +1,22 @@ - - - MainWindow - - - - 0 - 0 - 800 - 600 - - - - MainWindow - - - - - - - - + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + + diff --git a/src/ChangShaTour/planwidget.cpp b/src/ChangShaTour/planwidget.cpp new file mode 100644 index 0000000..017437d --- /dev/null +++ b/src/ChangShaTour/planwidget.cpp @@ -0,0 +1,222 @@ +#include "planwidget.h" +#include "ui_planwidget.h" + +PlanWidget::PlanWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::PlanWidget) +{ + ui->setupUi(this); + + verLayout = new QVBoxLayout(); + + pageIndex = 0; + + horLayout = new QHBoxLayout(); + returnBtn = new QPushButton("返回"); + favoriteBtn = new QPushButton("收藏"); + confirmBtn = new QPushButton("确认"); + returnBtn->setVisible(false); + favoriteBtn->setVisible(false); + confirmBtn->setVisible(false); + + rcmdPlanBtn = new QPushButton("推荐路线"); + cstmPlanBtn = new QPushButton("定制路线"); + conditionWidget = new ConditionWidget(); + preferenceWidget = new PreferenceWidget(); + routeChoiceWidget = new RouteChoiceWidget(); + customizeWidget = new CustomizeWidget(); + confirmWidget = new ConfirmWidget(); + rcmdPlanBtn->setVisible(true); + cstmPlanBtn->setVisible(true); + conditionWidget->setVisible(false); + preferenceWidget->setVisible(false); + routeChoiceWidget->setVisible(false); + customizeWidget->setVisible(false); + confirmWidget->setVisible(false); + + setLayout(verLayout); + verLayout->addLayout(horLayout); + verLayout->addWidget(rcmdPlanBtn); + verLayout->addWidget(cstmPlanBtn); + verLayout->addWidget(conditionWidget); + verLayout->addWidget(preferenceWidget); + verLayout->addWidget(routeChoiceWidget); + verLayout->addWidget(customizeWidget); + verLayout->addWidget(confirmWidget); + + horLayout->addWidget(returnBtn); + horLayout->addWidget(favoriteBtn); + horLayout->addStretch(5); + horLayout->addWidget(confirmBtn); + + connect(rcmdPlanBtn, &QPushButton::clicked, this, &PlanWidget::switchToConditionWidget); + connect(cstmPlanBtn, &QPushButton::clicked, this, &PlanWidget::switchToCustomizeWidget); +} + +void PlanWidget::switchToPlanChoice() +{ + pageIndex = 0; + + returnBtn->setVisible(false); + favoriteBtn->setVisible(false); + confirmBtn->setVisible(false); + rcmdPlanBtn->setVisible(true); + cstmPlanBtn->setVisible(true); + conditionWidget->setVisible(false); + preferenceWidget->setVisible(false); + routeChoiceWidget->setVisible(false); + customizeWidget->setVisible(false); + confirmWidget->setVisible(false); +} + +void PlanWidget::switchToConditionWidget() +{ + if (pageIndex == 2) + { + preferenceWidget->deleteLater(); + preferenceWidget = new PreferenceWidget(); + verLayout->addWidget(preferenceWidget); + } + pageIndex = 1; + + returnBtn->setVisible(true); + favoriteBtn->setVisible(false); + confirmBtn->setVisible(true); + rcmdPlanBtn->setVisible(false); + cstmPlanBtn->setVisible(false); + conditionWidget->setVisible(true); + preferenceWidget->setVisible(false); + routeChoiceWidget->setVisible(false); + customizeWidget->setVisible(false); + confirmWidget->setVisible(false); + + disconnect(returnBtn, 0, 0, 0); + disconnect(confirmBtn, 0, 0, 0); + + connect(returnBtn, &QPushButton::clicked, this, &PlanWidget::switchToPlanChoice); + connect(confirmBtn, &QPushButton::clicked, this, &PlanWidget::switchToPreferenceWidget); + +} + +void PlanWidget::switchToPreferenceWidget() +{ + if (pageIndex == 3) + { + routeChoiceWidget->deleteLater(); + routeChoiceWidget = new RouteChoiceWidget(); + verLayout->addWidget(routeChoiceWidget); + } + pageIndex = 2; + + returnBtn->setVisible(true); + favoriteBtn->setVisible(false); + confirmBtn->setVisible(true); + rcmdPlanBtn->setVisible(false); + cstmPlanBtn->setVisible(false); + conditionWidget->setVisible(false); + preferenceWidget->setVisible(true); + routeChoiceWidget->setVisible(false); + customizeWidget->setVisible(false); + confirmWidget->setVisible(false); + + disconnect(returnBtn, 0, 0, 0); + disconnect(confirmBtn, 0, 0, 0); + + connect(returnBtn, &QPushButton::clicked, this, &PlanWidget::switchToConditionWidget); + connect(confirmBtn, &QPushButton::clicked, this, &PlanWidget::switchToRouteChoiceWidget); + +} + +void PlanWidget::switchToRouteChoiceWidget() +{ + if (pageIndex == 5) + { + confirmWidget->deleteLater(); + confirmWidget = new ConfirmWidget(); + verLayout->addWidget(confirmWidget); + } + pageIndex = 3; + + returnBtn->setVisible(true); + favoriteBtn->setVisible(false); + confirmBtn->setVisible(true); + rcmdPlanBtn->setVisible(false); + cstmPlanBtn->setVisible(false); + conditionWidget->setVisible(false); + preferenceWidget->setVisible(false); + routeChoiceWidget->setVisible(true); + customizeWidget->setVisible(false); + confirmWidget->setVisible(false); + + disconnect(returnBtn, 0, 0, 0); + disconnect(confirmBtn, 0, 0, 0); + + connect(returnBtn, &QPushButton::clicked, this, &PlanWidget::switchToPreferenceWidget); + connect(confirmBtn, &QPushButton::clicked, this, &PlanWidget::switchToConfirmWidget); + +} + +void PlanWidget::switchToCustomizeWidget() +{ + if (pageIndex == 5) + { + confirmWidget->deleteLater(); + confirmWidget = new ConfirmWidget(); + verLayout->addWidget(confirmWidget); + } + pageIndex = 4; + + returnBtn->setVisible(true); + favoriteBtn->setVisible(false); + confirmBtn->setVisible(true); + rcmdPlanBtn->setVisible(false); + cstmPlanBtn->setVisible(false); + conditionWidget->setVisible(false); + preferenceWidget->setVisible(false); + routeChoiceWidget->setVisible(false); + customizeWidget->setVisible(true); + confirmWidget->setVisible(false); + + disconnect(returnBtn, 0, 0, 0); + disconnect(confirmBtn, 0, 0, 0); + + connect(returnBtn, &QPushButton::clicked, this, &PlanWidget::switchToPlanChoice); + connect(confirmBtn, &QPushButton::clicked, this, &PlanWidget::switchToConfirmWidget); + +} + +void PlanWidget::switchToConfirmWidget() +{ + int originalIndex = pageIndex; + pageIndex = 5; + + returnBtn->setVisible(true); + favoriteBtn->setVisible(true); + confirmBtn->setVisible(true); + rcmdPlanBtn->setVisible(false); + cstmPlanBtn->setVisible(false); + conditionWidget->setVisible(false); + preferenceWidget->setVisible(false); + routeChoiceWidget->setVisible(false); + customizeWidget->setVisible(false); + confirmWidget->setVisible(true); + + disconnect(returnBtn, 0, 0, 0); + disconnect(confirmBtn, 0, 0, 0); + + if (originalIndex == 3) + { + connect(returnBtn, &QPushButton::clicked, this, &PlanWidget::switchToRouteChoiceWidget); + } + if (originalIndex == 4) + { + connect(returnBtn, &QPushButton::clicked, this, &PlanWidget::switchToCustomizeWidget); + } +// connect(confirmBtn, &QPushButton::clicked, this, &PlanWidget::switchToPreferenceWidget); + +} + +PlanWidget::~PlanWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/planwidget.h b/src/ChangShaTour/planwidget.h new file mode 100644 index 0000000..d77d7db --- /dev/null +++ b/src/ChangShaTour/planwidget.h @@ -0,0 +1,55 @@ +#ifndef PLANWIDGET_H +#define PLANWIDGET_H + +#include +#include +#include +#include +#include "conditionwidget.h" +#include "preferencewidget.h" +#include "routechoicewidget.h" +#include "customizewidget.h" +#include "confirmwidget.h" + +namespace Ui { +class PlanWidget; +} + +class PlanWidget : public QWidget +{ + Q_OBJECT + +public: + explicit PlanWidget(QWidget *parent = nullptr); + ~PlanWidget(); + +private: + Ui::PlanWidget *ui; + + int pageIndex; + + QVBoxLayout *verLayout; + + QHBoxLayout *horLayout; + QPushButton *returnBtn; + QPushButton *favoriteBtn; + QPushButton *confirmBtn; + QPushButton *rcmdPlanBtn; + QPushButton *cstmPlanBtn; + + ConditionWidget *conditionWidget; + PreferenceWidget *preferenceWidget; + RouteChoiceWidget *routeChoiceWidget; + CustomizeWidget *customizeWidget; + ConfirmWidget *confirmWidget; + +public slots: + void switchToPlanChoice(); + void switchToConditionWidget(); + void switchToPreferenceWidget(); + void switchToRouteChoiceWidget(); + void switchToCustomizeWidget(); + void switchToConfirmWidget(); +}; + +#endif // PLANWIDGET_H diff --git a/src/Changsha_Tour/planwidget.ui b/src/ChangShaTour/planwidget.ui similarity index 94% rename from src/Changsha_Tour/planwidget.ui rename to src/ChangShaTour/planwidget.ui index b9e2b49..9455d52 100644 --- a/src/Changsha_Tour/planwidget.ui +++ b/src/ChangShaTour/planwidget.ui @@ -1,21 +1,21 @@ - - - - - PlanWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - + + + + + PlanWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/Changsha_Tour/preferencewidget.cpp b/src/ChangShaTour/preferencewidget.cpp similarity index 94% rename from src/Changsha_Tour/preferencewidget.cpp rename to src/ChangShaTour/preferencewidget.cpp index 55950c6..6d5a948 100644 --- a/src/Changsha_Tour/preferencewidget.cpp +++ b/src/ChangShaTour/preferencewidget.cpp @@ -1,132 +1,132 @@ -#include "preferencewidget.h" -#include "ui_preferencewidget.h" - -PreferenceWidget::PreferenceWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::PreferenceWidget) -{ - ui->setupUi(this); - - gridLayout = new QGridLayout(); - QVBoxLayout * landscapeVerticalLayout = new QVBoxLayout(); - QVBoxLayout * customVerticalLayout = new QVBoxLayout(); - QVBoxLayout * foodVerticalLayout = new QVBoxLayout(); - QVBoxLayout * nightVerticalLayout = new QVBoxLayout(); - QVBoxLayout * animeVerticalLayout = new QVBoxLayout(); - QVBoxLayout * loveVerticalLayout = new QVBoxLayout(); - - landscapeButton = new QPushButton("游风景名胜"); - customButton = new QPushButton("赏风土人情"); - foodButton = new QPushButton("品当地美食"); - nightButton = new QPushButton("星满夜来香"); - animeButton = new QPushButton("打破次元壁"); - loveButton = new QPushButton("感情升温中"); - - landscapeLine = new QTextEdit("偏重自然风光"); - customLine = new QTextEdit("偏重人文风俗"); - foodLine = new QTextEdit("偏重特色美食"); - nightLine = new QTextEdit("偏重夜生活"); - animeLine = new QTextEdit("偏重二次元"); - loveLine = new QTextEdit("偏重恋人出游"); - - landscapeLine->setReadOnly(true); - customLine->setReadOnly(true); - foodLine->setReadOnly(true); - nightLine->setReadOnly(true); - animeLine->setReadOnly(true); - loveLine->setReadOnly(true); - - landscapeVerticalLayout->addWidget(landscapeButton); - landscapeVerticalLayout->addWidget(landscapeLine); - customVerticalLayout->addWidget(customButton); - customVerticalLayout->addWidget(customLine); - foodVerticalLayout->addWidget(foodButton); - foodVerticalLayout->addWidget(foodLine); - nightVerticalLayout->addWidget(nightButton); - nightVerticalLayout->addWidget(nightLine); - animeVerticalLayout->addWidget(animeButton); - animeVerticalLayout->addWidget(animeLine); - loveVerticalLayout->addWidget(loveButton); - loveVerticalLayout->addWidget(loveLine); - - gridLayout->addLayout(landscapeVerticalLayout, 0, 0); - gridLayout->addLayout(customVerticalLayout, 0, 1); - gridLayout->addLayout(foodVerticalLayout, 0, 2); - gridLayout->addLayout(nightVerticalLayout, 1, 0); - gridLayout->addLayout(animeVerticalLayout, 1, 1); - gridLayout->addLayout(loveVerticalLayout, 1, 2); - - setLayout(gridLayout); - - connect(landscapeButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseLandscape); - connect(customButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseCustom); - connect(foodButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseFood); - connect(nightButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseNight); - connect(animeButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseAnime); - connect(loveButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseLove); -} - -PreferenceWidget::~PreferenceWidget() -{ - delete ui; -} - -void PreferenceWidget::ChooseLandscape() -{ - landscapeButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - customButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - foodButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - nightButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - animeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - loveButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); -} - -void PreferenceWidget::ChooseCustom() -{ - customButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - landscapeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - foodButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - nightButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - animeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - loveButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); -} - -void PreferenceWidget::ChooseFood() -{ - foodButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - customButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - landscapeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - nightButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - animeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - loveButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); -} - -void PreferenceWidget::ChooseNight() -{ - nightButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - customButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - foodButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - landscapeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - animeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - loveButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); -} - -void PreferenceWidget::ChooseAnime() -{ - animeButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - customButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - foodButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - nightButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - landscapeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - loveButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); -} - -void PreferenceWidget::ChooseLove() -{ - loveButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - customButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - foodButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - nightButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - animeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - landscapeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); -} +#include "preferencewidget.h" +#include "ui_preferencewidget.h" + +PreferenceWidget::PreferenceWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::PreferenceWidget) +{ + ui->setupUi(this); + + gridLayout = new QGridLayout(); + QVBoxLayout * landscapeVerticalLayout = new QVBoxLayout(); + QVBoxLayout * customVerticalLayout = new QVBoxLayout(); + QVBoxLayout * foodVerticalLayout = new QVBoxLayout(); + QVBoxLayout * nightVerticalLayout = new QVBoxLayout(); + QVBoxLayout * animeVerticalLayout = new QVBoxLayout(); + QVBoxLayout * loveVerticalLayout = new QVBoxLayout(); + + landscapeButton = new QPushButton("a"); + customButton = new QPushButton("b"); + foodButton = new QPushButton("c"); + nightButton = new QPushButton("d"); + animeButton = new QPushButton("e"); + loveButton = new QPushButton("f"); + + landscapeLine = new QTextEdit("偏重自然风光"); + customLine = new QTextEdit("偏重人文风俗"); + foodLine = new QTextEdit("偏重特色美食"); + nightLine = new QTextEdit("night life"); + animeLine = new QTextEdit("anime"); + loveLine = new QTextEdit("偏重恋人出游"); + + landscapeLine->setReadOnly(true); + customLine->setReadOnly(true); + foodLine->setReadOnly(true); + nightLine->setReadOnly(true); + animeLine->setReadOnly(true); + loveLine->setReadOnly(true); + + landscapeVerticalLayout->addWidget(landscapeButton); + landscapeVerticalLayout->addWidget(landscapeLine); + customVerticalLayout->addWidget(customButton); + customVerticalLayout->addWidget(customLine); + foodVerticalLayout->addWidget(foodButton); + foodVerticalLayout->addWidget(foodLine); + nightVerticalLayout->addWidget(nightButton); + nightVerticalLayout->addWidget(nightLine); + animeVerticalLayout->addWidget(animeButton); + animeVerticalLayout->addWidget(animeLine); + loveVerticalLayout->addWidget(loveButton); + loveVerticalLayout->addWidget(loveLine); + + gridLayout->addLayout(landscapeVerticalLayout, 0, 0); + gridLayout->addLayout(customVerticalLayout, 0, 1); + gridLayout->addLayout(foodVerticalLayout, 0, 2); + gridLayout->addLayout(nightVerticalLayout, 1, 0); + gridLayout->addLayout(animeVerticalLayout, 1, 1); + gridLayout->addLayout(loveVerticalLayout, 1, 2); + + setLayout(gridLayout); + + connect(landscapeButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseLandscape); + connect(customButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseCustom); + connect(foodButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseFood); + connect(nightButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseNight); + connect(animeButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseAnime); + connect(loveButton, &QPushButton::clicked, this, &PreferenceWidget::ChooseLove); +} + +void PreferenceWidget::ChooseLandscape() +{ + landscapeButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + customButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + foodButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + nightButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + animeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + loveButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); +} + +void PreferenceWidget::ChooseCustom() +{ + customButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + landscapeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + foodButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + nightButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + animeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + loveButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); +} + +void PreferenceWidget::ChooseFood() +{ + foodButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + customButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + landscapeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + nightButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + animeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + loveButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); +} + +void PreferenceWidget::ChooseNight() +{ + nightButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + customButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + foodButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + landscapeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + animeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + loveButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); +} + +void PreferenceWidget::ChooseAnime() +{ + animeButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + customButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + foodButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + nightButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + landscapeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + loveButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); +} + +void PreferenceWidget::ChooseLove() +{ + loveButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + customButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + foodButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + nightButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + animeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + landscapeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); +} + +PreferenceWidget::~PreferenceWidget() +{ + delete ui; +} diff --git a/src/Changsha_Tour/preferencewidget.h b/src/ChangShaTour/preferencewidget.h similarity index 95% rename from src/Changsha_Tour/preferencewidget.h rename to src/ChangShaTour/preferencewidget.h index 3c76c1b..c81053b 100644 --- a/src/Changsha_Tour/preferencewidget.h +++ b/src/ChangShaTour/preferencewidget.h @@ -1,49 +1,50 @@ -#ifndef PREFERENCEWIDGET_H -#define PREFERENCEWIDGET_H - -#include -#include -#include -#include -#include - -namespace Ui { -class PreferenceWidget; -} - -class PreferenceWidget : public QWidget -{ - Q_OBJECT - -public: - explicit PreferenceWidget(QWidget *parent = nullptr); - ~PreferenceWidget(); - -private: - Ui::PreferenceWidget *ui; - QGridLayout * gridLayout; - - QPushButton * landscapeButton; - QPushButton * customButton; - QPushButton * foodButton; - QPushButton * nightButton; - QPushButton * animeButton; - QPushButton * loveButton; - - QTextEdit * landscapeLine; - QTextEdit * customLine; - QTextEdit * foodLine; - QTextEdit * nightLine; - QTextEdit * animeLine; - QTextEdit * loveLine; - -private slots: - void ChooseLandscape(); - void ChooseCustom(); - void ChooseFood(); - void ChooseNight(); - void ChooseAnime(); - void ChooseLove(); -}; - -#endif // PREFERENCEWIDGET_H +#ifndef PREFERENCEWIDGET_H +#define PREFERENCEWIDGET_H + +#include +#include +#include +#include +#include + +namespace Ui { +class PreferenceWidget; +} + +class PreferenceWidget : public QWidget +{ + Q_OBJECT + +public: + explicit PreferenceWidget(QWidget *parent = nullptr); + ~PreferenceWidget(); + +private: + Ui::PreferenceWidget *ui; + + QGridLayout * gridLayout; + + QPushButton * landscapeButton; + QPushButton * customButton; + QPushButton * foodButton; + QPushButton * nightButton; + QPushButton * animeButton; + QPushButton * loveButton; + + QTextEdit * landscapeLine; + QTextEdit * customLine; + QTextEdit * foodLine; + QTextEdit * nightLine; + QTextEdit * animeLine; + QTextEdit * loveLine; + +private slots: + void ChooseLandscape(); + void ChooseCustom(); + void ChooseFood(); + void ChooseNight(); + void ChooseAnime(); + void ChooseLove(); +}; + +#endif // PREFERENCEWIDGET_H diff --git a/src/Changsha_Tour/preferencewidget.ui b/src/ChangShaTour/preferencewidget.ui similarity index 95% rename from src/Changsha_Tour/preferencewidget.ui rename to src/ChangShaTour/preferencewidget.ui index d82976a..4ce95e6 100644 --- a/src/Changsha_Tour/preferencewidget.ui +++ b/src/ChangShaTour/preferencewidget.ui @@ -1,21 +1,21 @@ - - - - - PreferenceWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - + + + + + PreferenceWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/qss/lightblue/add_bottom.png b/src/ChangShaTour/qss/lightblue/add_bottom.png new file mode 100644 index 0000000..11c409a Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/add_bottom.png differ diff --git a/src/ChangShaTour/qss/lightblue/add_left.png b/src/ChangShaTour/qss/lightblue/add_left.png new file mode 100644 index 0000000..62f8532 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/add_left.png differ diff --git a/src/ChangShaTour/qss/lightblue/add_right.png b/src/ChangShaTour/qss/lightblue/add_right.png new file mode 100644 index 0000000..fa043d4 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/add_right.png differ diff --git a/src/ChangShaTour/qss/lightblue/add_top.png b/src/ChangShaTour/qss/lightblue/add_top.png new file mode 100644 index 0000000..2636e2a Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/add_top.png differ diff --git a/src/ChangShaTour/qss/lightblue/branch_close.png b/src/ChangShaTour/qss/lightblue/branch_close.png new file mode 100644 index 0000000..507bc0e Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/branch_close.png differ diff --git a/src/ChangShaTour/qss/lightblue/branch_open.png b/src/ChangShaTour/qss/lightblue/branch_open.png new file mode 100644 index 0000000..129ef87 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/branch_open.png differ diff --git a/src/ChangShaTour/qss/lightblue/calendar_nextmonth.png b/src/ChangShaTour/qss/lightblue/calendar_nextmonth.png new file mode 100644 index 0000000..98da7a7 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/calendar_nextmonth.png differ diff --git a/src/ChangShaTour/qss/lightblue/calendar_prevmonth.png b/src/ChangShaTour/qss/lightblue/calendar_prevmonth.png new file mode 100644 index 0000000..e4bfa5a Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/calendar_prevmonth.png differ diff --git a/src/ChangShaTour/qss/lightblue/checkbox_checked.png b/src/ChangShaTour/qss/lightblue/checkbox_checked.png new file mode 100644 index 0000000..a42c663 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/checkbox_checked.png differ diff --git a/src/ChangShaTour/qss/lightblue/checkbox_checked_disable.png b/src/ChangShaTour/qss/lightblue/checkbox_checked_disable.png new file mode 100644 index 0000000..47e6e3f Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/checkbox_checked_disable.png differ diff --git a/src/ChangShaTour/qss/lightblue/checkbox_parcial.png b/src/ChangShaTour/qss/lightblue/checkbox_parcial.png new file mode 100644 index 0000000..0f15672 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/checkbox_parcial.png differ diff --git a/src/ChangShaTour/qss/lightblue/checkbox_parcial_disable.png b/src/ChangShaTour/qss/lightblue/checkbox_parcial_disable.png new file mode 100644 index 0000000..4207b3c Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/checkbox_parcial_disable.png differ diff --git a/src/ChangShaTour/qss/lightblue/checkbox_unchecked.png b/src/ChangShaTour/qss/lightblue/checkbox_unchecked.png new file mode 100644 index 0000000..162a9a7 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/checkbox_unchecked.png differ diff --git a/src/ChangShaTour/qss/lightblue/checkbox_unchecked_disable.png b/src/ChangShaTour/qss/lightblue/checkbox_unchecked_disable.png new file mode 100644 index 0000000..d275208 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/checkbox_unchecked_disable.png differ diff --git a/src/ChangShaTour/qss/lightblue/radiobutton_checked.png b/src/ChangShaTour/qss/lightblue/radiobutton_checked.png new file mode 100644 index 0000000..c2a4b83 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/radiobutton_checked.png differ diff --git a/src/ChangShaTour/qss/lightblue/radiobutton_checked_disable.png b/src/ChangShaTour/qss/lightblue/radiobutton_checked_disable.png new file mode 100644 index 0000000..acb8278 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/radiobutton_checked_disable.png differ diff --git a/src/ChangShaTour/qss/lightblue/radiobutton_unchecked.png b/src/ChangShaTour/qss/lightblue/radiobutton_unchecked.png new file mode 100644 index 0000000..433ab0f Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/radiobutton_unchecked.png differ diff --git a/src/ChangShaTour/qss/lightblue/radiobutton_unchecked_disable.png b/src/ChangShaTour/qss/lightblue/radiobutton_unchecked_disable.png new file mode 100644 index 0000000..0a782f7 Binary files /dev/null and b/src/ChangShaTour/qss/lightblue/radiobutton_unchecked_disable.png differ diff --git a/src/ChangShaTour/recommendwidget.cpp b/src/ChangShaTour/recommendwidget.cpp new file mode 100644 index 0000000..35b3683 --- /dev/null +++ b/src/ChangShaTour/recommendwidget.cpp @@ -0,0 +1,131 @@ +#include "recommendwidget.h" +#include "ui_recommendwidget.h" + +RecommendWidget::RecommendWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::RecommendWidget) +{ + ui->setupUi(this); + + row = 8; + column = 4; + web = new WebWidget(); + connector = new DatabaseConnector(); + db = connector->connectToDatabase(); + QSqlQuery query(db); + + verLayout = new QVBoxLayout(); + + scroll = new QScrollArea(); + + subWidget = new QWidget(); + subVerLayout = new QVBoxLayout(); + + funcLine = new QHBoxLayout(); + lineList = (QHBoxLayout **)malloc(sizeof(QHBoxLayout *) * row); + + refreshBtn = new QPushButton("刷新"); + btnList = (QToolButton **)malloc(sizeof(QToolButton *) * row * column); + + //读取数据库,获取按钮信息,初始化各List + + query.exec("select * from meishi limit 32"); + int i=0; + while(query.next()==true&&i<(row * column)) + { + i++; + QVariant id = query.value("id"); + + QVariant detail = query.value("detail"); + + QVariant frontimg = query.value("frontimg"); + + QVariant title = query.value("title"); + QVariant avgscore = query.value("avgscore"); + QVariant comments = query.value("comments"); + QVariant address = query.value("address"); + QVariant avgprice = query.value("avgprice"); + + QString name = title.value(); + QString score = QString::number(avgscore.value()); + QString commentNum = QString::number(comments.value()); + QString addr = address.value(); + QString price = QString::number(avgprice.value()); + QString text = name + "\n" + score + "分 " + commentNum + "条评论\n" + addr + "\n" + "人均" + price; + + idList.append(id.value()); + urlList.append(detail.value()); + imgList.append(frontimg.value()); + textList.append(text); + } + + /*for (int i = 0; i < row; i++) + { + for (int j = 0; j downloadFileFromUrl(imgList[index], imgPath); + btnList[index] = setBtn(btnList[index], imgPath, textList[index]); + connect(btnList[index], &QToolButton::clicked, this, [=](){web->view->load(QUrl((const QString)urlList[index])); scroll->setVisible(false); web->setVisible(true);}); + } + } + + //安排布局 + setLayout(verLayout); + + verLayout->addWidget(scroll); + verLayout->addWidget(web); + web->setVisible(false); + + subWidget->setLayout(subVerLayout); + subVerLayout->addLayout(funcLine); + for (int i = 0; i < row; i++) + { + lineList[i] = new QHBoxLayout(); + subVerLayout->addLayout(lineList[i]); + } + + funcLine->addWidget(refreshBtn); + for (int i = 0; i < row; i++) + { + for (int j = 0; j addWidget(btnList[index]); + } + } + + //必选要在setWidget方法调用之前把subWidget中的layout设置好,否则显示不出来 + scroll->setWidget(subWidget); + + connect(web->rtn, &QPushButton::clicked, this, &RecommendWidget::webReturn);*/ +} + +QToolButton *RecommendWidget::setBtn(QToolButton *btn, const QString iconPath, const QString text) +{ + btn->setIcon(QIcon(iconPath)); + btn->setText(text); + btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + btn->setIconSize(QSize(100,200)); + btn->setFixedSize(500,200); + + return btn; +} + + +void RecommendWidget::webReturn() +{ + scroll->setVisible(true); + web->setVisible(false); +} + +RecommendWidget::~RecommendWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/recommendwidget.h b/src/ChangShaTour/recommendwidget.h new file mode 100644 index 0000000..62b8a18 --- /dev/null +++ b/src/ChangShaTour/recommendwidget.h @@ -0,0 +1,65 @@ +#ifndef RECOMMENDWIDGET_H +#define RECOMMENDWIDGET_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "webwidget.h" +#include "databaseconnector.h" +#include "imgdownloader.h" + +namespace Ui { +class RecommendWidget; +} + +class RecommendWidget : public QWidget +{ + Q_OBJECT + +public: + explicit RecommendWidget(QWidget *parent = nullptr); + ~RecommendWidget(); + + QToolButton *setBtn(QToolButton *btn, const QString iconPath, const QString text); + void refresh(); + void connectWeb(); + void webReturn(); + void setBtnIndex(); + +private: + Ui::RecommendWidget *ui; + + int row; + int column; + QStringList urlList; + QStringList imgList; + QStringList textList; + QStringList idList; + WebWidget *web; + DatabaseConnector * connector; + QSqlDatabase db; + QString currentUrl; + + QVBoxLayout *verLayout; + QScrollArea *scroll; + QWidget *subWidget; + QVBoxLayout *subVerLayout; + + QHBoxLayout *funcLine; + QHBoxLayout **lineList; + + QPushButton *refreshBtn; + QToolButton **btnList; + +signals: + void btnSignal(QToolButton *btn); +}; + +#endif // RECOMMENDWIDGET_H diff --git a/src/ChangShaTour/recommendwidget.ui b/src/ChangShaTour/recommendwidget.ui new file mode 100644 index 0000000..5d4f60d --- /dev/null +++ b/src/ChangShaTour/recommendwidget.ui @@ -0,0 +1,21 @@ + + + + + RecommendWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/resource.qrc b/src/ChangShaTour/resource.qrc new file mode 100644 index 0000000..e84f1ba --- /dev/null +++ b/src/ChangShaTour/resource.qrc @@ -0,0 +1,23 @@ + + + lightblue.css + qss/lightblue/add_bottom.png + qss/lightblue/add_left.png + qss/lightblue/add_right.png + qss/lightblue/add_top.png + qss/lightblue/branch_close.png + qss/lightblue/branch_open.png + qss/lightblue/calendar_nextmonth.png + qss/lightblue/calendar_prevmonth.png + qss/lightblue/checkbox_checked.png + qss/lightblue/checkbox_checked_disable.png + qss/lightblue/checkbox_parcial.png + qss/lightblue/checkbox_parcial_disable.png + qss/lightblue/checkbox_unchecked.png + qss/lightblue/checkbox_unchecked_disable.png + qss/lightblue/radiobutton_checked.png + qss/lightblue/radiobutton_checked_disable.png + qss/lightblue/radiobutton_unchecked.png + qss/lightblue/radiobutton_unchecked_disable.png + + diff --git a/src/ChangShaTour/routechoicewidget.cpp b/src/ChangShaTour/routechoicewidget.cpp new file mode 100644 index 0000000..19f4f27 --- /dev/null +++ b/src/ChangShaTour/routechoicewidget.cpp @@ -0,0 +1,14 @@ +#include "routechoicewidget.h" +#include "ui_routechoicewidget.h" + +RouteChoiceWidget::RouteChoiceWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::RouteChoiceWidget) +{ + ui->setupUi(this); +} + +RouteChoiceWidget::~RouteChoiceWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/routechoicewidget.h b/src/ChangShaTour/routechoicewidget.h new file mode 100644 index 0000000..1832cab --- /dev/null +++ b/src/ChangShaTour/routechoicewidget.h @@ -0,0 +1,22 @@ +#ifndef ROUTECHOICEWIDGET_H +#define ROUTECHOICEWIDGET_H + +#include + +namespace Ui { +class RouteChoiceWidget; +} + +class RouteChoiceWidget : public QWidget +{ + Q_OBJECT + +public: + explicit RouteChoiceWidget(QWidget *parent = nullptr); + ~RouteChoiceWidget(); + +private: + Ui::RouteChoiceWidget *ui; +}; + +#endif // ROUTECHOICEWIDGET_H diff --git a/src/ChangShaTour/routechoicewidget.ui b/src/ChangShaTour/routechoicewidget.ui new file mode 100644 index 0000000..1bd9eb4 --- /dev/null +++ b/src/ChangShaTour/routechoicewidget.ui @@ -0,0 +1,21 @@ + + + + + RouteChoiceWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/showplaceinfowidget.cpp b/src/ChangShaTour/showplaceinfowidget.cpp new file mode 100644 index 0000000..35e07ce --- /dev/null +++ b/src/ChangShaTour/showplaceinfowidget.cpp @@ -0,0 +1,14 @@ +#include "showplaceinfowidget.h" +#include "ui_showplaceinfowidget.h" + +ShowPlaceInfoWidget::ShowPlaceInfoWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::ShowPlaceInfoWidget) +{ + ui->setupUi(this); +} + +ShowPlaceInfoWidget::~ShowPlaceInfoWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/showplaceinfowidget.h b/src/ChangShaTour/showplaceinfowidget.h new file mode 100644 index 0000000..9af420a --- /dev/null +++ b/src/ChangShaTour/showplaceinfowidget.h @@ -0,0 +1,22 @@ +#ifndef SHOWPLACEINFOWIDGET_H +#define SHOWPLACEINFOWIDGET_H + +#include + +namespace Ui { +class ShowPlaceInfoWidget; +} + +class ShowPlaceInfoWidget : public QWidget +{ + Q_OBJECT + +public: + explicit ShowPlaceInfoWidget(QWidget *parent = nullptr); + ~ShowPlaceInfoWidget(); + +private: + Ui::ShowPlaceInfoWidget *ui; +}; + +#endif // SHOWPLACEINFOWIDGET_H diff --git a/src/ChangShaTour/showplaceinfowidget.ui b/src/ChangShaTour/showplaceinfowidget.ui new file mode 100644 index 0000000..8543e97 --- /dev/null +++ b/src/ChangShaTour/showplaceinfowidget.ui @@ -0,0 +1,21 @@ + + + + + ShowPlaceInfoWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/showrouteinfowidget.cpp b/src/ChangShaTour/showrouteinfowidget.cpp new file mode 100644 index 0000000..785960d --- /dev/null +++ b/src/ChangShaTour/showrouteinfowidget.cpp @@ -0,0 +1,14 @@ +#include "showrouteinfowidget.h" +#include "ui_showrouteinfowidget.h" + +ShowRouteInfoWidget::ShowRouteInfoWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::ShowRouteInfoWidget) +{ + ui->setupUi(this); +} + +ShowRouteInfoWidget::~ShowRouteInfoWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/showrouteinfowidget.h b/src/ChangShaTour/showrouteinfowidget.h new file mode 100644 index 0000000..aebbf53 --- /dev/null +++ b/src/ChangShaTour/showrouteinfowidget.h @@ -0,0 +1,22 @@ +#ifndef SHOWROUTEINFOWIDGET_H +#define SHOWROUTEINFOWIDGET_H + +#include + +namespace Ui { +class ShowRouteInfoWidget; +} + +class ShowRouteInfoWidget : public QWidget +{ + Q_OBJECT + +public: + explicit ShowRouteInfoWidget(QWidget *parent = nullptr); + ~ShowRouteInfoWidget(); + +private: + Ui::ShowRouteInfoWidget *ui; +}; + +#endif // SHOWROUTEINFOWIDGET_H diff --git a/src/ChangShaTour/showrouteinfowidget.ui b/src/ChangShaTour/showrouteinfowidget.ui new file mode 100644 index 0000000..7f295dd --- /dev/null +++ b/src/ChangShaTour/showrouteinfowidget.ui @@ -0,0 +1,21 @@ + + + + + ShowRouteInfoWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/sortwidget.cpp b/src/ChangShaTour/sortwidget.cpp new file mode 100644 index 0000000..65687ee --- /dev/null +++ b/src/ChangShaTour/sortwidget.cpp @@ -0,0 +1,22 @@ +#include "sortwidget.h" +#include "ui_sortwidget.h" + +#include +#include + +SortWidget::SortWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::SortWidget) +{ + ui->setupUi(this); + + QVBoxLayout *layout = new QVBoxLayout(); + + setLayout(layout); + layout->addWidget(new QLabel("SortWidget")); +} + +SortWidget::~SortWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/sortwidget.h b/src/ChangShaTour/sortwidget.h new file mode 100644 index 0000000..92b1768 --- /dev/null +++ b/src/ChangShaTour/sortwidget.h @@ -0,0 +1,22 @@ +#ifndef SORTWIDGET_H +#define SORTWIDGET_H + +#include + +namespace Ui { +class SortWidget; +} + +class SortWidget : public QWidget +{ + Q_OBJECT + +public: + explicit SortWidget(QWidget *parent = nullptr); + ~SortWidget(); + +private: + Ui::SortWidget *ui; +}; + +#endif // SORTWIDGET_H diff --git a/src/ChangShaTour/sortwidget.ui b/src/ChangShaTour/sortwidget.ui new file mode 100644 index 0000000..76fe811 --- /dev/null +++ b/src/ChangShaTour/sortwidget.ui @@ -0,0 +1,21 @@ + + + + + SortWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/userinfowidget.cpp b/src/ChangShaTour/userinfowidget.cpp new file mode 100644 index 0000000..193999d --- /dev/null +++ b/src/ChangShaTour/userinfowidget.cpp @@ -0,0 +1,22 @@ +#include "userinfowidget.h" +#include "ui_userinfowidget.h" + +#include +#include + +UserInfoWidget::UserInfoWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserInfoWidget) +{ + ui->setupUi(this); + + QVBoxLayout *layout = new QVBoxLayout(); + + setLayout(layout); + layout->addWidget(new QLabel("UserInfoWidget")); +} + +UserInfoWidget::~UserInfoWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/userinfowidget.h b/src/ChangShaTour/userinfowidget.h new file mode 100644 index 0000000..390303a --- /dev/null +++ b/src/ChangShaTour/userinfowidget.h @@ -0,0 +1,22 @@ +#ifndef USERINFOWIDGET_H +#define USERINFOWIDGET_H + +#include + +namespace Ui { +class UserInfoWidget; +} + +class UserInfoWidget : public QWidget +{ + Q_OBJECT + +public: + explicit UserInfoWidget(QWidget *parent = nullptr); + ~UserInfoWidget(); + +private: + Ui::UserInfoWidget *ui; +}; + +#endif // USERINFOWIDGET_H diff --git a/src/ChangShaTour/userinfowidget.ui b/src/ChangShaTour/userinfowidget.ui new file mode 100644 index 0000000..b431b8a --- /dev/null +++ b/src/ChangShaTour/userinfowidget.ui @@ -0,0 +1,21 @@ + + + + + UserInfoWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/userwidget.cpp b/src/ChangShaTour/userwidget.cpp new file mode 100644 index 0000000..ed63113 --- /dev/null +++ b/src/ChangShaTour/userwidget.cpp @@ -0,0 +1,118 @@ +#include "userwidget.h" +#include "ui_userwidget.h" + +UserWidget::UserWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::UserWidget) +{ + ui->setupUi(this); + + verLayout = new QVBoxLayout(); + + horLayout = new QHBoxLayout(); + userInfoBtn = new QPushButton("个人资料"); + journyBtn = new QPushButton("行程"); + favoriteBtn = new QPushButton("Favorite"); + historyBtn = new QPushButton("历史记录"); + //默认初始选择为个人资料 + pageIndex = 0; + //userInfoBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + //journyBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //favoriteBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //historyBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + + userInfoWidget = new UserInfoWidget(this); + journyWidget = new JournyWidget(this); + favoriteWidget = new FavoriteWidget(this); + historyWidget = new HistoryWidget(this); + journyWidget->setVisible(false); + favoriteWidget->setVisible(false); + historyWidget->setVisible(false); + + setLayout(verLayout); + + verLayout->addLayout(horLayout); + verLayout->addWidget(userInfoWidget); + verLayout->addWidget(journyWidget); + verLayout->addWidget(favoriteWidget); + verLayout->addWidget(historyWidget); + + horLayout->addWidget(userInfoBtn); + horLayout->addWidget(journyBtn); + horLayout->addWidget(favoriteBtn); + horLayout->addWidget(historyBtn); + + connect(userInfoBtn, &QPushButton::clicked, this, &UserWidget::switchToUserInfo); + connect(journyBtn, &QPushButton::clicked, this, &UserWidget::switchToJourny); + connect(favoriteBtn, &QPushButton::clicked, this, &UserWidget::switchToFavorite); + connect(historyBtn, &QPushButton::clicked, this, &UserWidget::switchToHistory); +} + +void UserWidget::switchToUserInfo() +{ + if (pageIndex != 0) + { + //userInfoBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + //journyBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //favoriteBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //historyBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + userInfoWidget->setVisible(true); + journyWidget->setVisible(false); + favoriteWidget->setVisible(false); + historyWidget->setVisible(false); + pageIndex = 0; + } +} + +void UserWidget::switchToJourny() +{ + if (pageIndex != 1) + { + //userInfoBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //journyBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + //favoriteBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //historyBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + userInfoWidget->setVisible(false); + journyWidget->setVisible(true); + favoriteWidget->setVisible(false); + historyWidget->setVisible(false); + pageIndex = 1; + } +} + +void UserWidget::switchToFavorite() +{ + if (pageIndex != 2) + { + //userInfoBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //journyBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //favoriteBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + //historyBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + userInfoWidget->setVisible(false); + journyWidget->setVisible(false); + favoriteWidget->setVisible(true); + historyWidget->setVisible(false); + pageIndex = 2; + } +} + +void UserWidget::switchToHistory() +{ + if (pageIndex != 3) + { + //userInfoBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //journyBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //favoriteBtn->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); + //historyBtn->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); + userInfoWidget->setVisible(false); + journyWidget->setVisible(false); + favoriteWidget->setVisible(false); + historyWidget->setVisible(true); + pageIndex = 3; + } +} + +UserWidget::~UserWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/userwidget.h b/src/ChangShaTour/userwidget.h new file mode 100644 index 0000000..eafcdfc --- /dev/null +++ b/src/ChangShaTour/userwidget.h @@ -0,0 +1,50 @@ +#ifndef USERWIDGET_H +#define USERWIDGET_H + +#include +#include +#include +#include +#include "userinfowidget.h" +#include "journywidget.h" +#include "favoritewidget.h" +#include "historywidget.h" + +namespace Ui { +class UserWidget; +} + +class UserWidget : public QWidget +{ + Q_OBJECT + +public: + explicit UserWidget(QWidget *parent = nullptr); + ~UserWidget(); + +private: + Ui::UserWidget *ui; + + int pageIndex; + + QVBoxLayout *verLayout; + + QHBoxLayout *horLayout; + QPushButton *userInfoBtn; + QPushButton *journyBtn; + QPushButton *favoriteBtn; + QPushButton *historyBtn; + + UserInfoWidget *userInfoWidget; + JournyWidget *journyWidget; + FavoriteWidget *favoriteWidget; + HistoryWidget *historyWidget; + +public slots: + void switchToUserInfo(); + void switchToJourny(); + void switchToFavorite(); + void switchToHistory(); +}; + +#endif // USERWIDGET_H diff --git a/src/ChangShaTour/userwidget.ui b/src/ChangShaTour/userwidget.ui new file mode 100644 index 0000000..605c5f2 --- /dev/null +++ b/src/ChangShaTour/userwidget.ui @@ -0,0 +1,21 @@ + + + + + UserWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/ChangShaTour/webwidget.cpp b/src/ChangShaTour/webwidget.cpp new file mode 100644 index 0000000..8d0c396 --- /dev/null +++ b/src/ChangShaTour/webwidget.cpp @@ -0,0 +1,28 @@ +#include "webwidget.h" +#include "ui_webwidget.h" + +WebWidget::WebWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::WebWidget) +{ + ui->setupUi(this); + + verLayout = new QVBoxLayout(); + + horLayout = new QHBoxLayout(); + view = new QWebEngineView(); + + rtn = new QPushButton("返回"); + + setLayout(verLayout); + + verLayout->addLayout(horLayout); + verLayout->addWidget(view); + + horLayout->addWidget(rtn); +} + +WebWidget::~WebWidget() +{ + delete ui; +} diff --git a/src/ChangShaTour/webwidget.h b/src/ChangShaTour/webwidget.h new file mode 100644 index 0000000..bf4ea72 --- /dev/null +++ b/src/ChangShaTour/webwidget.h @@ -0,0 +1,31 @@ +#ifndef WEBWIDGET_H +#define WEBWIDGET_H + +#include +#include +#include +#include +#include + +namespace Ui { +class WebWidget; +} + +class WebWidget : public QWidget +{ + Q_OBJECT + +public: + explicit WebWidget(QWidget *parent = nullptr); + ~WebWidget(); + + QPushButton *rtn; + QWebEngineView *view; + QVBoxLayout *verLayout; + QHBoxLayout *horLayout; + +private: + Ui::WebWidget *ui; +}; + +#endif // WEBWIDGET_H diff --git a/src/Changsha_Tour/informationwidget.ui b/src/ChangShaTour/webwidget.ui similarity index 77% rename from src/Changsha_Tour/informationwidget.ui rename to src/ChangShaTour/webwidget.ui index d4c6903..d93c0c5 100644 --- a/src/Changsha_Tour/informationwidget.ui +++ b/src/ChangShaTour/webwidget.ui @@ -1,21 +1,21 @@ - - - - - InformationWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - + + + + + WebWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/Changsha_Tour/Changsha_Tour.pro b/src/Changsha_Tour/Changsha_Tour.pro deleted file mode 100644 index e98be64..0000000 --- a/src/Changsha_Tour/Changsha_Tour.pro +++ /dev/null @@ -1,61 +0,0 @@ -QT += core gui - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -CONFIG += c++11 - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - conditionwidget.cpp \ - informationwidget.cpp \ - loginwidget.cpp \ - main.cpp \ - mainwindow.cpp \ - planwidget.cpp \ - preferencewidget.cpp \ - rankwidget.cpp \ - recommandrouteswidget.cpp \ - recommandwidget.cpp \ - searchwidget.cpp \ - showroutewidget.cpp - -HEADERS += \ - conditionwidget.h \ - informationwidget.h \ - loginwidget.h \ - mainwindow.h \ - planwidget.h \ - preferencewidget.h \ - rankwidget.h \ - recommandrouteswidget.h \ - recommandwidget.h \ - searchwidget.h \ - showroutewidget.h - -FORMS += \ - conditionwidget.ui \ - informationwidget.ui \ - loginwidget.ui \ - mainwindow.ui \ - planwidget.ui \ - preferencewidget.ui \ - rankwidget.ui \ - recommandrouteswidget.ui \ - recommandwidget.ui \ - searchwidget.ui \ - showroutewidget.ui - -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target diff --git a/src/Changsha_Tour/Changsha_Tour.pro.user b/src/Changsha_Tour/Changsha_Tour.pro.user deleted file mode 100644 index 5b1bf7a..0000000 --- a/src/Changsha_Tour/Changsha_Tour.pro.user +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - EnvironmentId - {5009ac75-b61d-4c91-8540-bc9e10b6e582} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 GCC 64bit - Desktop Qt 5.14.2 GCC 64bit - qt.qt5.5142.gcc_64_kit - 0 - 0 - 0 - - /home/extra/Program/Qt5.14.2/Trip-in-Chang-sha/build-Changsha_Tour-Desktop_Qt_5_14_2_GCC_64bit-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - /home/extra/Program/Qt5.14.2/Trip-in-Chang-sha/build-Changsha_Tour-Desktop_Qt_5_14_2_GCC_64bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - /home/extra/Program/Qt5.14.2/Trip-in-Chang-sha/build-Changsha_Tour-Desktop_Qt_5_14_2_GCC_64bit-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:/home/extra/Program/Qt5.14.2/Trip-in-Chang-sha/Changsha_Tour/Changsha_Tour.pro - /home/extra/Program/Qt5.14.2/Trip-in-Chang-sha/Changsha_Tour/Changsha_Tour.pro - - false - - false - true - true - false - false - true - - /home/extra/Program/Qt5.14.2/Trip-in-Chang-sha/build-Changsha_Tour-Desktop_Qt_5_14_2_GCC_64bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/src/Changsha_Tour/informationwidget.cpp b/src/Changsha_Tour/informationwidget.cpp deleted file mode 100644 index 22d45cb..0000000 --- a/src/Changsha_Tour/informationwidget.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "informationwidget.h" -#include "ui_informationwidget.h" - -InformationWidget::InformationWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::InformationWidget) -{ - ui->setupUi(this); - - QVBoxLayout * verticalLayout = new QVBoxLayout(); - logoutButton = new QPushButton("注销"); - - verticalLayout->addWidget(logoutButton); - - this->setLayout(verticalLayout); -} - -InformationWidget::~InformationWidget() -{ - delete ui; -} - -QPushButton * InformationWidget::GetLogoutButton() -{ - return logoutButton; -} diff --git a/src/Changsha_Tour/informationwidget.h b/src/Changsha_Tour/informationwidget.h deleted file mode 100644 index 2e48013..0000000 --- a/src/Changsha_Tour/informationwidget.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef INFORMATIONWIDGET_H -#define INFORMATIONWIDGET_H - -#include -#include -#include -#include - -namespace Ui { -class InformationWidget; -} - -class InformationWidget : public QWidget -{ - Q_OBJECT - -public: - explicit InformationWidget(QWidget *parent = nullptr); - ~InformationWidget(); - QPushButton * GetLogoutButton(); - -private: - Ui::InformationWidget *ui; - QPushButton * logoutButton; -}; - -#endif // INFORMATIONWIDGET_H diff --git a/src/Changsha_Tour/main.cpp b/src/Changsha_Tour/main.cpp deleted file mode 100644 index fd3e533..0000000 --- a/src/Changsha_Tour/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "mainwindow.h" - -#include - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.show(); - return a.exec(); -} diff --git a/src/Changsha_Tour/mainwindow.cpp b/src/Changsha_Tour/mainwindow.cpp deleted file mode 100644 index 4dd320a..0000000 --- a/src/Changsha_Tour/mainwindow.cpp +++ /dev/null @@ -1,270 +0,0 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" -#include "recommandwidget.h" -#include "rankwidget.h" -#include "searchwidget.h" -#include "planwidget.h" - -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) - , ui(new Ui::MainWindow) -{ - ui->setupUi(this); - setWindowTitle("长沙游"); - - loginInterface = new LoginWidget(this); - centralWidget = GetCentralWidget(); - - setCentralWidget(loginInterface); - - connect(loginInterface->GetLoginButton(), &QPushButton::clicked, this, &MainWindow::SwitchCentralInterface); -} - -MainWindow::~MainWindow() -{ - delete ui; -} - -QWidget * MainWindow::GetCentralWidget() -{ - centralWidget = new QWidget(this); - verticalLayout = new QVBoxLayout(); - horizontalLayout = new QHBoxLayout(); - - /*在horizontalLayout添加首页按键*/ - homeButton = new QPushButton("首页"); - homeButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - //设置按键样式:默认高亮 - horizontalLayout->addWidget(homeButton); - - /*在horizontalLayout添加个人主页按键*/ - userButton = new QPushButton("个人主页"); - userButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - //设置按键样式:光标悬停时高亮 - horizontalLayout->addWidget(userButton); - - /*在horizontalLayout添加搜索框和搜索按键*/ - findLine = new QLineEdit(); - horizontalLayout->addWidget(findLine); - - findButton = new QPushButton("搜索"); - findButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - horizontalLayout->addWidget(findButton); - - homeSubWidget = GetHomeSubWidget(); //初始化首页 - userSubWidget = GetUserSubWidget(); //初始化个人主页 - - verticalLayout->addLayout(horizontalLayout); - verticalLayout->addWidget(homeSubWidget); - verticalLayout->addWidget(userSubWidget); - userSubWidget->setVisible(false); - centralWidget->setLayout(verticalLayout); - - inHomePage = true; //默认显示首页界面 - - connect(homeButton, &QPushButton::clicked, this, &MainWindow::SwitchHomeInterface); - connect(userButton, &QPushButton::clicked, this, &MainWindow::SwitchUserInterface); - - return centralWidget; -} - -QWidget * MainWindow::GetHomeSubWidget() -{ - QWidget * subWidget = new QWidget(centralWidget); - QHBoxLayout * subHorizontalLayout = new QHBoxLayout(); - homeSubVerticalLayout = new QVBoxLayout(); - - recommandButton = new QPushButton("猜你喜欢"); - recommandButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - subHorizontalLayout->addWidget(recommandButton); - - rankButton = new QPushButton("热门榜单"); - rankButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - subHorizontalLayout->addWidget(rankButton); - - searchButton = new QPushButton("分类检索"); - searchButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - subHorizontalLayout->addWidget(searchButton); - - planButton = new QPushButton("方案规划"); - planButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - subHorizontalLayout->addWidget(planButton); - - recommandInterface = new RecommandWidget(); - rankInterface = new RankWidget(); - searchInterface = new SearchWidget(); - planInterface = new PlanWidget(); - - homeSubVerticalLayout->addLayout(subHorizontalLayout); - homeSubVerticalLayout->addWidget(recommandInterface); - homeSubVerticalLayout->addWidget(rankInterface); - rankInterface->setVisible(false); - homeSubVerticalLayout->addWidget(searchInterface); - searchInterface->setVisible(false); - homeSubVerticalLayout->addWidget(planInterface); - planInterface->setVisible(false); - subWidget->setLayout(homeSubVerticalLayout); - - homeIndex = 0; //首页显示猜你喜欢界面 - - connect(recommandButton, &QPushButton::clicked, this, &MainWindow::SwitchRecommandInterface); - connect(rankButton, &QPushButton::clicked, this, &MainWindow::SwitchRankInterface); - connect(searchButton, &QPushButton::clicked, this, &MainWindow::SwitchSearchInterface); - connect(planButton, &QPushButton::clicked, this, &MainWindow::SwitchPlanInterface); - - return subWidget; -} - -QWidget * MainWindow::GetUserSubWidget() -{ - QWidget * subWidget = new QWidget(centralWidget); - QHBoxLayout * subHorizontalLayout = new QHBoxLayout(); - userSubVerticalLayout = new QVBoxLayout(); - - informationButton = new QPushButton("个人资料"); - informationButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - subHorizontalLayout->addWidget(informationButton); - - favoriteButton = new QPushButton("收藏夹"); - favoriteButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - subHorizontalLayout->addWidget(favoriteButton); - - informationInterface = new InformationWidget(); - - userSubVerticalLayout->addLayout(subHorizontalLayout); - userSubVerticalLayout->addWidget(informationInterface); - subWidget->setLayout(userSubVerticalLayout); - - userIndex = 0; //个人主页显示个人资料界面 - - connect(informationButton, &QPushButton::clicked, this, &MainWindow::SwitchInformationInterface); - connect(favoriteButton, &QPushButton::clicked, this, &MainWindow::SwitchFavoriteInterface); - connect(informationInterface->GetLogoutButton(), &QPushButton::clicked, this, &MainWindow::SwitchLoginInterface); - - return subWidget; -} - -void MainWindow::SwitchLoginInterface() -{ - setCentralWidget(loginInterface); - centralWidget = GetCentralWidget(); -} - -void MainWindow::SwitchCentralInterface() -{ - setCentralWidget(centralWidget); - loginInterface = new LoginWidget(); - connect(loginInterface->GetLoginButton(), &QPushButton::clicked, this, &MainWindow::SwitchCentralInterface); -} - -void MainWindow::SwitchHomeInterface() -{ - if ( !inHomePage ) - { - homeButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - userButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - userSubWidget->setVisible(false); - homeSubWidget->setVisible(true); - } - inHomePage = true; -} - -void MainWindow::SwitchUserInterface() -{ - if ( inHomePage ) - { - userButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - homeButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - homeSubWidget->setVisible(false); - userSubWidget->setVisible(true); - } - inHomePage = false; -} - -void MainWindow::SwitchRecommandInterface() -{ - if ( homeIndex != 0 ) - { - recommandButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - rankButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - searchButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - planButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - - rankInterface->setVisible(false); - searchInterface->setVisible(false); - planInterface->setVisible(false); - recommandInterface->setVisible(true); - } - homeIndex = 0; -} - -void MainWindow::SwitchRankInterface() -{ - if ( homeIndex != 1 ) - { - rankButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - recommandButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - searchButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - planButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - - rankInterface->setVisible(true); - searchInterface->setVisible(false); - planInterface->setVisible(false); - recommandInterface->setVisible(false); - } - homeIndex = 1; -} - -void MainWindow::SwitchSearchInterface() -{ - if ( homeIndex != 2 ) - { - searchButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - rankButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - recommandButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - planButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - - rankInterface->setVisible(false); - searchInterface->setVisible(true); - planInterface->setVisible(false); - recommandInterface->setVisible(false); - } - homeIndex = 2; -} - -void MainWindow::SwitchPlanInterface() -{ - if ( homeIndex != 3 ) - { - planButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - rankButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - searchButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - recommandButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - - rankInterface->setVisible(false); - searchInterface->setVisible(false); - planInterface->setVisible(true); - recommandInterface->setVisible(false); - } - homeIndex = 3; -} - -void MainWindow::SwitchInformationInterface() -{ - if ( userIndex != 0 ) - { - informationButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - favoriteButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - } - userIndex = 0; -} - -void MainWindow::SwitchFavoriteInterface() -{ - if ( userIndex != 1 ) - { - favoriteButton->setStyleSheet("QPushButton{background-color: rgb(20, 62, 134);color:rgb(255, 255, 255);}"); - informationButton->setStyleSheet("QPushButton{color:rgb(255, 255, 255);}""QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}""QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}"); - } - userIndex = 1; -} diff --git a/src/Changsha_Tour/mainwindow.h b/src/Changsha_Tour/mainwindow.h deleted file mode 100644 index c9caa5b..0000000 --- a/src/Changsha_Tour/mainwindow.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include -#include -#include -#include -#include -#include "loginwidget.h" -#include "recommandwidget.h" -#include "rankwidget.h" -#include "searchwidget.h" -#include "planwidget.h" -#include "informationwidget.h" - -QT_BEGIN_NAMESPACE -namespace Ui { class MainWindow; } -QT_END_NAMESPACE - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - MainWindow(QWidget *parent = nullptr); - ~MainWindow(); - QWidget * GetCentralWidget(); - QWidget * GetHomeSubWidget(); - QWidget * GetUserSubWidget(); - -private: - Ui::MainWindow *ui; - - bool inHomePage; //首页是否正在被显示 - int homeIndex; //首页正在显示的窗口部件索引 0-猜你喜欢 1-热门榜单 2-分类检索 3-方案规划 - int userIndex; //个人主页正在显示的窗口部件索引 0-个人资料 1-收藏夹 - - QWidget * centralWidget; - QVBoxLayout * verticalLayout; - QHBoxLayout * horizontalLayout; - - LoginWidget * loginInterface; - - QPushButton * homeButton; - QPushButton * userButton; - QLineEdit * findLine; - QPushButton * findButton; - - QWidget * homeSubWidget; - QWidget * userSubWidget; - QVBoxLayout * homeSubVerticalLayout; - QVBoxLayout * userSubVerticalLayout; - - QPushButton * recommandButton; - QPushButton * rankButton; - QPushButton * searchButton; - QPushButton * planButton; - QTableWidget * table; - - RecommandWidget * recommandInterface; - RankWidget * rankInterface; - SearchWidget * searchInterface; - PlanWidget * planInterface; - - QPushButton * informationButton; - QPushButton * favoriteButton; - - InformationWidget * informationInterface; - -private slots: - void SwitchLoginInterface(); //切换到登陆界面 - void SwitchCentralInterface(); //切换到中心界面 - void SwitchHomeInterface(); //切换到首页 - void SwitchUserInterface(); //切换到个人主页 - void SwitchRecommandInterface(); //将首页中子界面切换到猜你喜欢界面 - void SwitchRankInterface(); //将首页中子界面切换到热门榜单界面 - void SwitchSearchInterface(); //将首页中子界面切换到分类检索界面 - void SwitchPlanInterface(); //将首页中子界面切换到方案规划界面 - void SwitchInformationInterface(); //将个人主页中子界面切换到个人资料界面 - void SwitchFavoriteInterface(); //将个人主页中子界面切换到收藏夹界面 -}; -#endif // MAINWINDOW_H diff --git a/src/Changsha_Tour/planwidget.cpp b/src/Changsha_Tour/planwidget.cpp deleted file mode 100644 index ea98d0e..0000000 --- a/src/Changsha_Tour/planwidget.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include "planwidget.h" -#include "ui_planwidget.h" - -PlanWidget::PlanWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::PlanWidget) -{ - ui->setupUi(this); - - verticalLayout = new QVBoxLayout(); - horizontalLayout = new QHBoxLayout(); - - backButton = new QPushButton("返回"); - nextButton = new QPushButton("确认"); - favoriteButton = new QPushButton("收藏"); - - horizontalLayout->addWidget(backButton); - horizontalLayout->addStretch(5); - backButton->setVisible(false); - horizontalLayout->addWidget(favoriteButton); - favoriteButton->setVisible(false); - horizontalLayout->addWidget(nextButton); - nextButton->setVisible(false); - - choiceInterface = GetChoiceWidget(); - conditionInterface = new ConditionWidget(); - preferenceInterface = new PreferenceWidget(); - recommandRoutesInterface = new RecommandRoutesWidget(); - showRouteInterface = new ShowRouteWidget(); - - /*默认显示功能选择界面*/ - verticalLayout->addLayout(horizontalLayout); - verticalLayout->addWidget(choiceInterface); - verticalLayout->addWidget(conditionInterface); - conditionInterface->setVisible(false); - verticalLayout->addWidget(preferenceInterface); - preferenceInterface->setVisible(false); - verticalLayout->addWidget(recommandRoutesInterface); - recommandRoutesInterface->setVisible(false); - verticalLayout->addWidget(showRouteInterface); - showRouteInterface->setVisible(false); - interfaceIndex = 0; - - this->setLayout(verticalLayout); - - connect(recommandRouteButton, &QPushButton::clicked, this, &PlanWidget::SwitchConditionInterface); -} - -PlanWidget::~PlanWidget() -{ - delete ui; -} - -QWidget * PlanWidget::GetChoiceWidget() -{ - QWidget * widget = new QWidget(this); - QVBoxLayout * verticalLayout = new QVBoxLayout(); - - recommandRouteButton = new QPushButton("推荐方案"); - customizeRouteButton = new QPushButton("定制方案"); - verticalLayout->addWidget(recommandRouteButton); - verticalLayout->addWidget(customizeRouteButton); - - widget->setLayout(verticalLayout); - - return widget; -} - -void PlanWidget::SwitchChoiceInterface() -{ - if ( interfaceIndex == 4 ) - { - showRouteInterface->deleteLater(); - showRouteInterface = new ShowRouteWidget(); - verticalLayout->addWidget(showRouteInterface); - } - - conditionInterface->deleteLater(); - conditionInterface = new ConditionWidget(); - verticalLayout->addWidget(conditionInterface); - - conditionInterface->setVisible(false); - choiceInterface->setVisible(true); - backButton->setVisible(false); - favoriteButton->setVisible(false); - nextButton->setVisible(false); - - interfaceIndex = 0; - - disconnect(nextButton, nullptr, nullptr, nullptr); - connect(nextButton, &QPushButton::clicked, this, &PlanWidget::SwitchConditionInterface); -} - -void PlanWidget::SwitchConditionInterface() -{ - /*若后退至此界面则刷新下一个页面*/ - if ( interfaceIndex == 2 ) - { - preferenceInterface->deleteLater(); - preferenceInterface = new PreferenceWidget(); - verticalLayout->addWidget(preferenceInterface); - } - - choiceInterface->setVisible(false); - conditionInterface->setVisible(true); - preferenceInterface->setVisible(false); - backButton->setVisible(true); - nextButton->setVisible(true); - - interfaceIndex = 1; - - disconnect(backButton, nullptr, nullptr, nullptr); - disconnect(nextButton, nullptr, nullptr, nullptr); - connect(backButton, &QPushButton::clicked, this, &PlanWidget::SwitchChoiceInterface); - connect(nextButton, &QPushButton::clicked, this, &PlanWidget::SwitchPreferenceInterface); -} - -void PlanWidget::SwitchPreferenceInterface() -{ - if ( interfaceIndex == 3 ) - { - recommandRoutesInterface->deleteLater(); - recommandRoutesInterface = new RecommandRoutesWidget(); - verticalLayout->addWidget(recommandRoutesInterface); - } - - conditionInterface->setVisible(false); - preferenceInterface->setVisible(true); - recommandRoutesInterface->setVisible(false); - backButton->setVisible(true); - nextButton->setVisible(true); - - interfaceIndex = 2; - - disconnect(backButton, nullptr, nullptr, nullptr); - disconnect(nextButton, nullptr, nullptr, nullptr); - connect(backButton, &QPushButton::clicked, this, &PlanWidget::SwitchConditionInterface); - connect(nextButton, &QPushButton::clicked, this, &PlanWidget::SwitchRecommandRoutesInterface); -} - -void PlanWidget::SwitchRecommandRoutesInterface() -{ - if ( interfaceIndex == 4 ) - { - showRouteInterface->deleteLater(); - showRouteInterface = new ShowRouteWidget(); - verticalLayout->addWidget(showRouteInterface); - } - - preferenceInterface->setVisible(false); - recommandRoutesInterface->setVisible(true); - showRouteInterface->setVisible(false); - backButton->setVisible(true); - favoriteButton->setVisible(false); - nextButton->setVisible(true); - - interfaceIndex = 3; - - disconnect(backButton, nullptr, nullptr, nullptr); - disconnect(nextButton, nullptr, nullptr, nullptr); - connect(backButton, &QPushButton::clicked, this, &PlanWidget::SwitchPreferenceInterface); - connect(nextButton, &QPushButton::clicked, this, &PlanWidget::SwitchShowRouteInterface); -} - -void PlanWidget::SwitchShowRouteInterface() -{ - recommandRoutesInterface->setVisible(false); - showRouteInterface->setVisible(true); - backButton->setVisible(true); - favoriteButton->setVisible(true); - nextButton->setVisible(true); - - interfaceIndex = 4; - - disconnect(backButton, nullptr, nullptr, nullptr); - disconnect(nextButton, nullptr, nullptr, nullptr); - connect(backButton, &QPushButton::clicked, this, &PlanWidget::SwitchRecommandRoutesInterface); - connect(nextButton, &QPushButton::clicked, this, &PlanWidget::SwitchChoiceInterface); -} diff --git a/src/Changsha_Tour/planwidget.h b/src/Changsha_Tour/planwidget.h deleted file mode 100644 index 9d14906..0000000 --- a/src/Changsha_Tour/planwidget.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef PLANWIDGET_H -#define PLANWIDGET_H - -#include -#include -#include -#include -#include -#include -#include -#include "conditionwidget.h" -#include "preferencewidget.h" -#include "recommandrouteswidget.h" -#include "showroutewidget.h" - -namespace Ui { -class PlanWidget; -} - -class PlanWidget : public QWidget -{ - Q_OBJECT - -public: - explicit PlanWidget(QWidget *parent = nullptr); - ~PlanWidget(); - - QWidget * GetChoiceWidget(); - -private: - Ui::PlanWidget *ui; - int interfaceIndex; //界面索引 0-选择界面 1-条件界面 2-偏好界面 3-推荐界面 4-显示界面 - QVBoxLayout * verticalLayout; - QHBoxLayout * horizontalLayout; - - QPushButton * backButton; - QPushButton * nextButton; - QPushButton * favoriteButton; - - QWidget * choiceInterface; - - QPushButton * recommandRouteButton; - QPushButton * customizeRouteButton; - - ConditionWidget * conditionInterface; - - PreferenceWidget * preferenceInterface; - - RecommandRoutesWidget * recommandRoutesInterface; - - ShowRouteWidget * showRouteInterface; - -private slots: - void SwitchChoiceInterface(); - void SwitchConditionInterface(); - void SwitchPreferenceInterface(); - void SwitchRecommandRoutesInterface(); - void SwitchShowRouteInterface(); -}; - -#endif // PLANWIDGET_H diff --git a/src/Changsha_Tour/rankwidget.cpp b/src/Changsha_Tour/rankwidget.cpp deleted file mode 100644 index 5048d25..0000000 --- a/src/Changsha_Tour/rankwidget.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "rankwidget.h" -#include "ui_rankwidget.h" - -RankWidget::RankWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::RankWidget) -{ - ui->setupUi(this); - - verticalLayout = new QVBoxLayout(); - - QTableWidget * table = new QTableWidget(); - verticalLayout->addWidget(table); - this->setLayout(verticalLayout); -} - -RankWidget::~RankWidget() -{ - delete ui; -} diff --git a/src/Changsha_Tour/rankwidget.h b/src/Changsha_Tour/rankwidget.h deleted file mode 100644 index 76fc3cc..0000000 --- a/src/Changsha_Tour/rankwidget.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef RANKWIDGET_H -#define RANKWIDGET_H - -#include -#include -#include - -namespace Ui { -class RankWidget; -} - -class RankWidget : public QWidget -{ - Q_OBJECT - -public: - explicit RankWidget(QWidget *parent = nullptr); - ~RankWidget(); - -private: - Ui::RankWidget *ui; - QVBoxLayout * verticalLayout; -}; - -#endif // RANKWIDGET_H diff --git a/src/Changsha_Tour/recommandrouteswidget.cpp b/src/Changsha_Tour/recommandrouteswidget.cpp deleted file mode 100644 index 12c3937..0000000 --- a/src/Changsha_Tour/recommandrouteswidget.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "recommandrouteswidget.h" -#include "ui_recommandrouteswidget.h" - -RecommandRoutesWidget::RecommandRoutesWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::RecommandRoutesWidget) -{ - ui->setupUi(this); -} - -RecommandRoutesWidget::~RecommandRoutesWidget() -{ - delete ui; -} diff --git a/src/Changsha_Tour/recommandrouteswidget.h b/src/Changsha_Tour/recommandrouteswidget.h deleted file mode 100644 index f9fef45..0000000 --- a/src/Changsha_Tour/recommandrouteswidget.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef RECOMMANDROUTESWIDGET_H -#define RECOMMANDROUTESWIDGET_H - -#include -#include - -namespace Ui { -class RecommandRoutesWidget; -} - -class RecommandRoutesWidget : public QWidget -{ - Q_OBJECT - -public: - explicit RecommandRoutesWidget(QWidget *parent = nullptr); - ~RecommandRoutesWidget(); - -private: - Ui::RecommandRoutesWidget *ui; - QVBoxLayout * verticalLayout; -}; - -#endif // RECOMMANDROUTESWIDGET_H diff --git a/src/Changsha_Tour/recommandwidget.cpp b/src/Changsha_Tour/recommandwidget.cpp deleted file mode 100644 index 8eea9a5..0000000 --- a/src/Changsha_Tour/recommandwidget.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "recommandwidget.h" -#include "ui_recommandwidget.h" - -RecommandWidget::RecommandWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::RecommandWidget) -{ - ui->setupUi(this); -} - -RecommandWidget::~RecommandWidget() -{ - delete ui; -} diff --git a/src/Changsha_Tour/recommandwidget.h b/src/Changsha_Tour/recommandwidget.h deleted file mode 100644 index 22d46e3..0000000 --- a/src/Changsha_Tour/recommandwidget.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef RECOMMANDWIDGET_H -#define RECOMMANDWIDGET_H - -#include -#include -#include - -namespace Ui { -class RecommandWidget; -} - -class RecommandWidget : public QWidget -{ - Q_OBJECT - -public: - explicit RecommandWidget(QWidget *parent = nullptr); - ~RecommandWidget(); - -private: - Ui::RecommandWidget *ui; - QVBoxLayout * verticalLayout; -}; - -#endif // RECOMMANDWIDGET_H diff --git a/src/Changsha_Tour/searchwidget.cpp b/src/Changsha_Tour/searchwidget.cpp deleted file mode 100644 index ebf8b54..0000000 --- a/src/Changsha_Tour/searchwidget.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "searchwidget.h" -#include "ui_searchwidget.h" - -SearchWidget::SearchWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::SearchWidget) -{ - ui->setupUi(this); - - verticalLayout = new QVBoxLayout(); - - QTableWidget * table = new QTableWidget(); - verticalLayout->addWidget(table); - this->setLayout(verticalLayout); -} - -SearchWidget::~SearchWidget() -{ - delete ui; -} diff --git a/src/Changsha_Tour/searchwidget.h b/src/Changsha_Tour/searchwidget.h deleted file mode 100644 index 900c2c1..0000000 --- a/src/Changsha_Tour/searchwidget.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef SEARCHWIDGET_H -#define SEARCHWIDGET_H - -#include -#include -#include - -namespace Ui { -class SearchWidget; -} - -class SearchWidget : public QWidget -{ - Q_OBJECT - -public: - explicit SearchWidget(QWidget *parent = nullptr); - ~SearchWidget(); - -private: - Ui::SearchWidget *ui; - QVBoxLayout * verticalLayout; -}; - -#endif // SEARCHWIDGET_H diff --git a/src/Changsha_Tour/showroutewidget.cpp b/src/Changsha_Tour/showroutewidget.cpp deleted file mode 100644 index 6454010..0000000 --- a/src/Changsha_Tour/showroutewidget.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "showroutewidget.h" -#include "ui_showroutewidget.h" - -ShowRouteWidget::ShowRouteWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::ShowRouteWidget) -{ - ui->setupUi(this); -} - -ShowRouteWidget::~ShowRouteWidget() -{ - delete ui; -} diff --git a/src/Changsha_Tour/showroutewidget.h b/src/Changsha_Tour/showroutewidget.h deleted file mode 100644 index 9ccbfe7..0000000 --- a/src/Changsha_Tour/showroutewidget.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef SHOWROUTEWIDGET_H -#define SHOWROUTEWIDGET_H - -#include - -namespace Ui { -class ShowRouteWidget; -} - -class ShowRouteWidget : public QWidget -{ - Q_OBJECT - -public: - explicit ShowRouteWidget(QWidget *parent = nullptr); - ~ShowRouteWidget(); - -private: - Ui::ShowRouteWidget *ui; -}; - -#endif // SHOWROUTEWIDGET_H diff --git a/src/Changsha_Tour/showroutewidget.ui b/src/Changsha_Tour/showroutewidget.ui deleted file mode 100644 index 1d324b7..0000000 --- a/src/Changsha_Tour/showroutewidget.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - ShowRouteWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - -