实现modifyWidget,完成popWidget,modifyWidget,定制功能,推荐功能的美化

master
liukunlin123 4 years ago
parent 9ef5a89425
commit 73b870fac1

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2021-07-08T13:36:31. --> <!-- Written by QtCreator 4.11.1, 2021-07-09T16:19:24. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
<value type="QByteArray">{4109ff11-a646-43d1-9619-aeb32783df6e}</value> <value type="QByteArray">{d82e82d4-1ed7-46a6-9098-5e0a8f0d7fa3}</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -64,14 +64,14 @@
<data> <data>
<variable>ProjectExplorer.Project.Target.0</variable> <variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.2 MSVC2017 64bit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.2 MSVC2017 32bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MSVC2017 64bit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MSVC2017 32bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win64_msvc2017_64_kit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win32_msvc2017_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value> <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/大三下/软件体系结构/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_32bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -119,7 +119,7 @@
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/大三下/软件体系结构/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_32bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -167,7 +167,7 @@
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/大三下/软件体系结构/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_32bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -287,9 +287,8 @@
</valuelist> </valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">ChangShaTour2</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/大三下/软件体系结构/Trip-in-Chang-sha/ChangShaTour/ChangShaTour.pro</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/13648/Desktop/Trip-in-Chang-sha-8a043ecb0a246aecbb035065accda093da77fdf0/ChangShaTour/ChangShaTour.pro</value> <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/大三下/软件体系结构/Trip-in-Chang-sha/ChangShaTour/ChangShaTour.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/13648/Desktop/Trip-in-Chang-sha-8a043ecb0a246aecbb035065accda093da77fdf0/ChangShaTour/ChangShaTour.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value> <value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value> <value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value> <value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
@ -300,7 +299,7 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value> <value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release</value> <value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/大三下/软件体系结构/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_32bit-Debug</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap> </valuemap>
@ -308,14 +307,14 @@
<data> <data>
<variable>ProjectExplorer.Project.Target.1</variable> <variable>ProjectExplorer.Project.Target.1</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.2 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win64_mingw73_kit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win64_msvc2017_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/大三下/软件体系结构/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -363,7 +362,7 @@
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Release</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/大三下/软件体系结构/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -411,7 +410,7 @@
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/ChangShaTour/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MinGW_64_bit-Profile</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/大三下/软件体系结构/Trip-in-Chang-sha/build-ChangShaTour-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>

@ -1,8 +1,6 @@
#include "confirmwidget.h" #include "confirmwidget.h"
#include "ui_confirmwidget.h" #include "ui_confirmwidget.h"
ConfirmWidget::ConfirmWidget(QWidget *parent) : ConfirmWidget::ConfirmWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::ConfirmWidget) ui(new Ui::ConfirmWidget)
@ -56,6 +54,7 @@ void ConfirmWidget::initInfoWidget()
RouteItem * routeItems = routeToConfirm->getAllItems(); RouteItem * routeItems = routeToConfirm->getAllItems();
int i = 0; int i = 0;
routeNameLabel = new QLabel("路线名称:"); routeNameLabel = new QLabel("路线名称:");
InitLabel(routeNameLabel, true, false, "#FFFFFF");
routeNameLineEdit->setText(routeToConfirm->getRouteName()); routeNameLineEdit->setText(routeToConfirm->getRouteName());
nameLine = new QHBoxLayout(); nameLine = new QHBoxLayout();
nameLine->addWidget(routeNameLabel); nameLine->addWidget(routeNameLabel);
@ -66,32 +65,41 @@ void ConfirmWidget::initInfoWidget()
routeItems=routeItems->next; routeItems=routeItems->next;
qDebug()<<i<<routeItems->placeName<<routeItems->startTime<<routeItems->endTime; qDebug()<<i<<routeItems->placeName<<routeItems->startTime<<routeItems->endTime;
placeLabelList[i] = new QLabel(routeItems->placeName); placeLabelList[i] = new QLabel(routeItems->placeName);
InitLabel(placeLabelList[i], true, false, "#E1B37C");
startTimeLabelList[i] = new QLabel(routeItems->startTime.toString()); startTimeLabelList[i] = new QLabel(routeItems->startTime.toString());
InitLabel(startTimeLabelList[i], true, true, "#FFFFFF");
endTimeLabelList[i] = new QLabel(routeItems->endTime.toString()); endTimeLabelList[i] = new QLabel(routeItems->endTime.toString());
InitLabel(endTimeLabelList[i], true, true, "#FFFFFF");
double * tt =getLatAndLng(routeItems->placeName,routeItems->cateId); double * tt =getLatAndLng(routeItems->placeName,routeItems->cateId);
lats[i] = tt[0]; lats[i] = tt[0];
lngs[i] = tt[1]; lngs[i] = tt[1];
i++; i++;
} }
allInfo = new QStringList *[size-1];
//需要根据接口返回的数据调整顺序 //需要根据接口返回的数据调整顺序
trafficLabels<<"步行"<<"公交地铁"<<"驾车"<<"骑行"; trafficLabels<<"步行"<<"公交地铁"<<"驾车"<<"骑行";
qDebug()<<trafficLabels[0]; qDebug()<<trafficLabels[0];
for(i = 0;i< size - 1;i++) for(i = 0;i< size - 1;i++)
{ {
allInfo[i] = new QStringList();
trafficCBoxList[i] = new QComboBox(); trafficCBoxList[i] = new QComboBox();
InitComboBox(trafficCBoxList[i]);
trafficCBoxList[i]->addItems(trafficLabels); trafficCBoxList[i]->addItems(trafficLabels);
QString location1 = QString::number(lngs[i]) + "," + QString::number(lats[i]); QString location1 = QString::number(lngs[i]) + "," + QString::number(lats[i]);
qDebug()<<location1; qDebug()<<location1;
QString location2 = QString::number(lngs[i+1]) + "," + QString::number(lats[i+1]); QString location2 = QString::number(lngs[i+1]) + "," + QString::number(lats[i+1]);
QStringList * allInfo = routePlan->getAllInfo(location1,location2); allInfo[i] = routePlan->getAllInfo(location1,location2);
int k = trafficCBoxList[i]->currentIndex(); int k = trafficCBoxList[i]->currentIndex();
descriptionLabelList[i]=new QLabel(allInfo[k][2]); descriptionLabelList[i]=new QLabel(allInfo[i][k][2]);
distanceLabelList[i]=new QLabel("距离:"+allInfo[k][0]); InitLabel(descriptionLabelList[i], false, true, "#FFFFFF");
timeCostLabelList[i]=new QLabel("时间:"+allInfo[k][1]); distanceLabelList[i]=new QLabel("距离:"+QString::number(allInfo[i][k][0].toInt()*1.0/1000)+"公里");
InitLabel(distanceLabelList[i], false, true, "#FFFFFF");
timeCostLabelList[i]=new QLabel("时间:"+QString::number(allInfo[i][k][1].toInt()*1.0/60)+"分钟");
InitLabel(timeCostLabelList[i], false, true, "#FFFFFF");
void(QComboBox::*fp)(int)=&QComboBox:: currentIndexChanged; void(QComboBox::*fp)(int)=&QComboBox:: currentIndexChanged;
connect(trafficCBoxList[i],fp,this,[=](){descriptionLabelList[i]->setText(allInfo[trafficCBoxList[i]->currentIndex()][2]);distanceLabelList[i]->setText("距离:"+allInfo[trafficCBoxList[i]->currentIndex()][0]);timeCostLabelList[i]->setText("时间:"+allInfo[trafficCBoxList[i]->currentIndex()][1]);}); connect(trafficCBoxList[i],fp,this,[=](){descriptionLabelList[i]->setText(allInfo[i][trafficCBoxList[i]->currentIndex()][2]);distanceLabelList[i]->setText("距离:"+QString::number(allInfo[i][trafficCBoxList[i]->currentIndex()][0].toInt()*1.0/1000)+"公里");timeCostLabelList[i]->setText("时间:"+QString::number(allInfo[i][trafficCBoxList[i]->currentIndex()][1].toInt()*1.0/60)+"分钟");});
} }
} }
@ -99,6 +107,7 @@ void ConfirmWidget::initInfo()
{ {
size = routeToConfirm->getLength(); size = routeToConfirm->getLength();
routeNameLineEdit = new QLineEdit(); routeNameLineEdit = new QLineEdit();
InitLineEdit(routeNameLineEdit);
placeLabelList = (QLabel **)malloc(sizeof(QLabel *) * size); placeLabelList = (QLabel **)malloc(sizeof(QLabel *) * size);
startTimeLabelList = (QLabel **)malloc(sizeof(QLabel *) * size); startTimeLabelList = (QLabel **)malloc(sizeof(QLabel *) * size);
endTimeLabelList = (QLabel **)malloc(sizeof(QLabel *) * size); endTimeLabelList = (QLabel **)malloc(sizeof(QLabel *) * size);
@ -140,12 +149,13 @@ Route * ConfirmWidget::genRoute()
{ {
routeItems = routeItems->next; routeItems = routeItems->next;
routeItems->traffic = trafficCBoxList[i]->currentText(); routeItems->traffic = trafficCBoxList[i]->currentText();
routeItems->description = descriptionLabelList[i]->text(); routeItems->description = allInfo[i][trafficCBoxList[i]->currentIndex()][2];
routeItems->distance = distanceLabelList[i]->text().split(":")[1].toInt(); routeItems->distance = allInfo[i][trafficCBoxList[i]->currentIndex()][0].toInt();
routeItems->timeCost = timeCostLabelList[i]->text().split(":")[1].toInt(); routeItems->timeCost = allInfo[i][trafficCBoxList[i]->currentIndex()][1].toInt();
if((routeItems->next->startTime.toTime_t()) - (routeItems->endTime.toTime_t()) < routeItems->timeCost) if((routeItems->next->startTime.toTime_t()) - (routeItems->endTime.toTime_t()) < routeItems->timeCost)
{ {
QMessageBox::warning(this,"警告","当前交通方式无法按时到达目的地!",QMessageBox::Yes); QMessageBox::warning(this,"警告","当前交通方式无法按时到达目的地!",QMessageBox::Yes);
return NULL;
} }
} }
return routeToConfirm; return routeToConfirm;
@ -161,3 +171,50 @@ ConfirmWidget::~ConfirmWidget()
{ {
delete ui; delete ui;
} }
void ConfirmWidget::InitLabel(QLabel * label, bool isBold, bool isItalic, QString color)
{
QFont lbl_font("Microsoft YaHei");
lbl_font.setPointSize(12);
lbl_font.setBold(isBold);
lbl_font.setItalic(isItalic);
label->setFont(lbl_font);
label->setStyleSheet("color:" + color);
//label->setAlignment(Qt::AlignRight);
}
void ConfirmWidget::InitComboBox(QComboBox * comboBox)
{
comboBox->setStyleSheet("QComboBox {"
" border-radius: 4px; "
" color:rgb(0, 0, 0); "
" background-color: rgb(255, 255, 255);"
"} "
" QComboBox:focus { "
" border-style:outset; "
//" border-width:4px; "
" border-radius: 4px; "
//" border-color: #C1D7F1; "
" color:#ffffff; "
" background-color: #C1D7F1;"
"} ");
comboBox->setFont(QFont("Microsoft YaHei" , 12, QFont::Bold));
}
void ConfirmWidget::InitLineEdit(QLineEdit * lineEdit)
{
lineEdit->setStyleSheet("QLineEdit {"
" border-radius: 4px; "
" color:rgb(0, 0, 0); "
" background-color: rgb(255, 255, 255);"
"} "
" QLineEdit:focus { "
" border-style:outset; "
//" border-width:4px; "
" border-radius: 4px; "
//" border-color: #C1D7F1; "
" color:#ffffff; "
" background-color: #C1D7F1;"
"} ");
lineEdit->setFont(QFont("Microsoft YaHei" , 12, QFont::Bold));
}

@ -42,6 +42,10 @@ public:
void trafficInfoChanged(const QString &); void trafficInfoChanged(const QString &);
Route * genRoute(); Route * genRoute();
void InitLabel(QLabel * label, bool isBold, bool isItalic, QString color);
void InitComboBox(QComboBox *);
void InitLineEdit(QLineEdit *);
private: private:
int size; int size;
QLineEdit * routeNameLineEdit; QLineEdit * routeNameLineEdit;
@ -57,6 +61,7 @@ private:
QLabel ** startTimeLabelList; QLabel ** startTimeLabelList;
QLabel ** descriptionLabelList; QLabel ** descriptionLabelList;
QLabel ** distanceLabelList; QLabel ** distanceLabelList;
QStringList ** allInfo;
QLabel ** timeCostLabelList; QLabel ** timeCostLabelList;
QLabel ** endTimeLabelList; QLabel ** endTimeLabelList;
QLabel ** labelList;//显示序号 QLabel ** labelList;//显示序号

@ -15,11 +15,20 @@ CustomizeWidget::CustomizeWidget(QWidget *parent) :
title = new QLabel("现在开始定制您的路线\n点击空白按钮就可以向路线中添加场所\n场所的起始/结束时间表示了您想在该场所游玩的时间段"); title = new QLabel("现在开始定制您的路线\n点击空白按钮就可以向路线中添加场所\n场所的起始/结束时间表示了您想在该场所游玩的时间段");
title->setAlignment(Qt::AlignCenter); title->setAlignment(Qt::AlignCenter);
QLabel * numberLabel = new QLabel("序号");
InitLabel(numberLabel);
QLabel * placeLabel = new QLabel("场所");
InitLabel(placeLabel);
QLabel * startTimeLabel = new QLabel("起始时间");
InitLabel(startTimeLabel);
QLabel * endTimeLabel = new QLabel("结束时间");
InitLabel(endTimeLabel);
format = new QHBoxLayout(); format = new QHBoxLayout();
format->addWidget(new QLabel("序号"),1); format->addWidget(numberLabel,1);
format->addWidget(new QLabel("场所"),12); format->addWidget(placeLabel,12);
format->addWidget(new QLabel("起始时间"),3); format->addWidget(startTimeLabel,3);
format->addWidget(new QLabel("结束时间"),3); format->addWidget(endTimeLabel,3);
format->addWidget(new QLabel(""),2); format->addWidget(new QLabel(""),2);
format->addWidget(new QLabel(""),2); format->addWidget(new QLabel(""),2);
@ -45,12 +54,17 @@ CustomizeWidget::CustomizeWidget(QWidget *parent) :
{ {
lineList[i] = new QHBoxLayout(); lineList[i] = new QHBoxLayout();
labelList[i] = new QLabel(QString::number(i+1)); labelList[i] = new QLabel(QString::number(i+1));
labelList[i]->setAlignment(Qt::AlignCenter); InitLabel(labelList[i]);
placeBtnList[i] = new QPushButton(); placeBtnList[i] = new QPushButton();
InitButton(placeBtnList[i]);
startEditList[i] = new QDateTimeEdit(); startEditList[i] = new QDateTimeEdit();
InitDateTimeEdit(startEditList[i]);
endEditList[i] = new QDateTimeEdit(); endEditList[i] = new QDateTimeEdit();
InitDateTimeEdit(endEditList[i]);
addBtnList[i] = new QPushButton("+"); addBtnList[i] = new QPushButton("+");
InitButton(addBtnList[i]);
delBtnList[i] = new QPushButton("-"); delBtnList[i] = new QPushButton("-");
InitButton(delBtnList[i]);
mainLayout->addLayout(lineList[i]); mainLayout->addLayout(lineList[i]);
@ -327,5 +341,58 @@ void CustomizeWidget::initInterface(Route *route)
// } // }
qDebug("CustomizeWidget Completed"); qDebug("CustomizeWidget Completed");
}
void CustomizeWidget::InitLabel(QLabel * label)
{
QFont lbl_font("Microsoft YaHei");
lbl_font.setPointSize(12);
lbl_font.setBold(true);
label->setFont(lbl_font);
label->setStyleSheet("color:#FFFFFF");
label->setAlignment(Qt::AlignCenter);
}
void CustomizeWidget::InitButton(QPushButton * button)
{
button->setStyleSheet("QPushButton {"
"color:#ffffff;"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #8CA8CC, stop: 1 #8CA8CC);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 14px;"
"font-family: Microsoft YaHei;"
"} "
"QPushButton:hover {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6E8AB2, stop: 1 #6E8AB2);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 14px;"
"font-family: Microsoft YaHei;"
"} "
"QPushButton:pressed {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6783AB, stop: 1 #6783AB);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 14px;"
"font-family: Microsoft YaHei;"
"}");
}
void CustomizeWidget::InitDateTimeEdit(QDateTimeEdit * lineEdit)
{
lineEdit->setStyleSheet("QDateTimeEdit {"
" border-radius: 4px; "
" color:rgb(0, 0, 0); "
" background-color: rgb(255, 255, 255);"
"} "
" QDateTimeEdit:focus { "
" border-style:outset; "
//" border-width:4px; "
" border-radius: 4px; "
//" border-color: #C1D7F1; "
" color:#ffffff; "
" background-color: #C1D7F1;"
"} ");
lineEdit->setFont(QFont("Microsoft YaHei" , 10, QFont::Bold));
} }

@ -43,6 +43,10 @@ public:
Route *getRoute(); Route *getRoute();
void initInterface(Route *r); void initInterface(Route *r);
void InitLabel(QLabel *);
void InitButton(QPushButton *);
void InitDateTimeEdit(QDateTimeEdit *);
private: private:
Ui::CustomizeWidget *ui; Ui::CustomizeWidget *ui;

@ -253,7 +253,7 @@ void FavoriteWidget::getFavRoutesList()
void FavoriteWidget::setFavRoutesBtns() void FavoriteWidget::setFavRoutesBtns()
{ {
QPushButton ** favRoutesBtnList = (QPushButton **)malloc(sizeof(QPushButton *) * 5); QPushButton ** favRoutesBtnList = (QPushButton **)malloc(sizeof(QPushButton *) * numOfFavRoutes);
for(int i = numOfFavRoutes - 1; i >= 0; i--) for(int i = numOfFavRoutes - 1; i >= 0; i--)
{ {
Route *favRoute = favRoutesList[i]; Route *favRoute = favRoutesList[i];
@ -271,9 +271,8 @@ void FavoriteWidget::setFavRoutesBtns()
text += head->placeName; text += head->placeName;
} }
favRoutesBtnList[i] = new QPushButton(text); favRoutesBtnList[i] = new QPushButton(text);
InitRouteButton(favRoutesBtnList[i]);
connect(favRoutesBtnList[i],&QPushButton::clicked,this,[=](){switchToShowRouteInfo(favRoutesList[i]);}); connect(favRoutesBtnList[i],&QPushButton::clicked,this,[=](){switchToShowRouteInfo(favRoutesList[i]);});
favRoutesBtnList[i]->setStyleSheet("text-align : left;");
InitButton(favRoutesBtnList[i]);
verticalLayout->addWidget(favRoutesBtnList[i]); verticalLayout->addWidget(favRoutesBtnList[i]);
} }
} }
@ -372,12 +371,14 @@ void FavoriteWidget::InitFavoriteWidget()
verLayout = new QVBoxLayout(); verLayout = new QVBoxLayout();
verLayout->setMargin(35); verLayout->setMargin(35);
verLayout->setAlignment(Qt::AlignTop);
setLayout(verLayout); setLayout(verLayout);
//QHBoxLayout * refreshLayout = new QHBoxLayout(); //QHBoxLayout * refreshLayout = new QHBoxLayout();
refreshButton = new QPushButton("刷新"); refreshButton = new QPushButton("刷新");
connect(refreshButton, &QPushButton::clicked, this, &FavoriteWidget::refreshe); connect(refreshButton, &QPushButton::clicked, this, &FavoriteWidget::refreshe);
verLayout->addWidget(refreshButton); //verLayout->addWidget(refreshButton);
//verLayout->addLayout(refreshLayout); //verLayout->addLayout(refreshLayout);
QHBoxLayout *screenLayout=new QHBoxLayout(); QHBoxLayout *screenLayout=new QHBoxLayout();
@ -386,12 +387,17 @@ void FavoriteWidget::InitFavoriteWidget()
InitButton(favoRoutesBtn); InitButton(favoRoutesBtn);
screenLayout->addWidget(favoRoutesBtn); screenLayout->addWidget(favoRoutesBtn);
InitButton(refreshButton);
screenLayout->addWidget(refreshButton);
favoPlacesBtn=new QPushButton("场所收藏夹"); favoPlacesBtn=new QPushButton("场所收藏夹");
screenLayout->addWidget(favoPlacesBtn);
InitButton(favoPlacesBtn); InitButton(favoPlacesBtn);
screenLayout->addWidget(favoPlacesBtn);
initFunctionWidget(); initFunctionWidget();
qDebug() << "initFunctionWidget over";
initShowRouteInfoWidget(); initShowRouteInfoWidget();
qDebug() << "initShowRouteInfoWidget over";
web = new WebWidget(); web = new WebWidget();
web->setVisible(false); web->setVisible(false);
@ -509,6 +515,13 @@ void FavoriteWidget::refreshe()
{ {
favoPlacesWidget->deleteLater(); favoPlacesWidget->deleteLater();
favoRoutesWidget->deleteLater(); favoRoutesWidget->deleteLater();
urlList.clear();
cateIdList.clear();
nameList.clear();
cateIdList.clear();
queryDatabase();
size = (size < limit? size: limit);
setFavPlaceScreen(); setFavPlaceScreen();
setFavRouteScreen(); setFavRouteScreen();
setPageBtns(); setPageBtns();
@ -584,9 +597,9 @@ void FavoriteWidget::InitButton(QPushButton * button)
"border-radius:10px;" "border-radius:10px;"
"font:bold 20px;" "font:bold 20px;"
"font-family: Microsoft YaHei;" "font-family: Microsoft YaHei;"
"min-width:100px;" //"min-width:100px;"
"min-height:20px;" //"min-height:20px;"
"padding:4px;" //"padding:4px;"
//"text-align: left;" //"text-align: left;"
"} " "} "
"QPushButton:hover {" "QPushButton:hover {"
@ -596,9 +609,9 @@ void FavoriteWidget::InitButton(QPushButton * button)
"border-radius:10px;" "border-radius:10px;"
"font:bold 20px;" "font:bold 20px;"
"font-family: Microsoft YaHei;" "font-family: Microsoft YaHei;"
"min-width:100px;" //"min-width:100px;"
"min-height:20px;" //"min-height:20px;"
"padding:4px;" //"padding:4px;"
//"text-align: left;" //"text-align: left;"
"} " "} "
"QPushButton:pressed {" "QPushButton:pressed {"
@ -608,9 +621,9 @@ void FavoriteWidget::InitButton(QPushButton * button)
"border-radius:10px;" "border-radius:10px;"
"font:bold 20px;" "font:bold 20px;"
"font-family: Microsoft YaHei;" "font-family: Microsoft YaHei;"
"min-width:100px;" //"min-width:100px;"
"min-height:20px;" //"min-height:20px;"
"padding:4px;" //"padding:4px;"
//"text-align: left;" //"text-align: left;"
"}"); "}");
} }
@ -626,7 +639,7 @@ void FavoriteWidget::InitItemButton(QToolButton * button)
//"min-width:100px;" //"min-width:100px;"
//"min-height:20px;" //"min-height:20px;"
//"padding:4px;" //"padding:4px;"
//"text-align: left;" "text-align: left;"
"} " "} "
"QToolButton:hover {" "QToolButton:hover {"
"color: #66441F;" "color: #66441F;"
@ -638,7 +651,7 @@ void FavoriteWidget::InitItemButton(QToolButton * button)
//"min-width:100px;" //"min-width:100px;"
//"min-height:20px;" //"min-height:20px;"
//"padding:4px;" //"padding:4px;"
//"text-align: left;" "text-align: left;"
"} " "} "
"QToolButton:pressed {" "QToolButton:pressed {"
"color: #66441F;" "color: #66441F;"
@ -650,7 +663,46 @@ void FavoriteWidget::InitItemButton(QToolButton * button)
//"min-width:100px;" //"min-width:100px;"
//"min-height:20px;" //"min-height:20px;"
//"padding:4px;" //"padding:4px;"
//"text-align: left;" "text-align: left;"
"}");
}
void FavoriteWidget::InitRouteButton(QPushButton * button)
{
button->setStyleSheet("QPushButton {"
"color:#ffffff;"
"background-color: rgba(0, 0, 0, 0);"
"border:none;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"text-align: left;"
"} "
"QPushButton:hover {"
"color: #66441F;"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #A9201A, stop: 1 #FFFFFF);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"text-align: left;"
"} "
"QPushButton:pressed {"
"color: #66441F;"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #A9201A, stop: 1 #FFFFFF);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"text-align: left;"
"}"); "}");
} }

@ -55,6 +55,7 @@ public:
void InitButton(QPushButton *); void InitButton(QPushButton *);
void InitItemButton(QToolButton *); void InitItemButton(QToolButton *);
void InitRouteButton(QPushButton *);
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);

@ -13,11 +13,14 @@ FeedBackWidget::FeedBackWidget(QWidget *parent) :
QHBoxLayout * scoreHintLayout = new QHBoxLayout(); QHBoxLayout * scoreHintLayout = new QHBoxLayout();
QLabel * scoreHintLabel = new QLabel("(必填部分)\n请给这条路线打个分吧~"); QLabel * scoreHintLabel = new QLabel("(必填部分)\n请给这条路线打个分吧~");
InitLabel(scoreHintLabel, true, true, "#000000");
scoreHintLayout->addWidget(scoreHintLabel); scoreHintLayout->addWidget(scoreHintLabel);
QHBoxLayout * scoreLayout = new QHBoxLayout(); QHBoxLayout * scoreLayout = new QHBoxLayout();
QLabel * scoreLable = new QLabel("分数"); QLabel * scoreLable = new QLabel("分数");
InitLabel(scoreLable, true, false, "#000000");
scoreLineEdit = new QLineEdit(); scoreLineEdit = new QLineEdit();
InitLineEdit(scoreLineEdit);
scoreLineEdit->setPlaceholderText("请输入一个1~5之间的整数"); scoreLineEdit->setPlaceholderText("请输入一个1~5之间的整数");
scoreLineEdit->setValidator(new QIntValidator(scoreLineEdit)); scoreLineEdit->setValidator(new QIntValidator(scoreLineEdit));
scoreLayout->addWidget(scoreLable); scoreLayout->addWidget(scoreLable);
@ -25,11 +28,14 @@ FeedBackWidget::FeedBackWidget(QWidget *parent) :
QHBoxLayout * shareHintLayout = new QHBoxLayout(); QHBoxLayout * shareHintLayout = new QHBoxLayout();
QLabel * shareHintLabel = new QLabel("(选填部分)\n填写下面的信息即可将你的行程分享给其他人哦~"); QLabel * shareHintLabel = new QLabel("(选填部分)\n填写下面的信息即可将你的行程分享给其他人哦~");
InitLabel(shareHintLabel, true, true, "#000000");
shareHintLayout->addWidget(shareHintLabel); shareHintLayout->addWidget(shareHintLabel);
QHBoxLayout * dayLayout = new QHBoxLayout(); QHBoxLayout * dayLayout = new QHBoxLayout();
QLabel * dayLabel = new QLabel("旅游天数"); QLabel * dayLabel = new QLabel("旅游天数");
InitLabel(dayLabel, true, false, "#000000");
dayLineEdit = new QLineEdit(); dayLineEdit = new QLineEdit();
InitLineEdit(dayLineEdit);
dayLineEdit->setPlaceholderText("请输入一个1~10之间的整数"); dayLineEdit->setPlaceholderText("请输入一个1~10之间的整数");
dayLineEdit->setValidator(new QIntValidator(dayLineEdit)); dayLineEdit->setValidator(new QIntValidator(dayLineEdit));
dayLayout->addWidget(dayLabel); dayLayout->addWidget(dayLabel);
@ -37,7 +43,9 @@ FeedBackWidget::FeedBackWidget(QWidget *parent) :
QHBoxLayout * numberLayout = new QHBoxLayout(); QHBoxLayout * numberLayout = new QHBoxLayout();
QLabel * numberLabel = new QLabel("旅游人数"); QLabel * numberLabel = new QLabel("旅游人数");
InitLabel(numberLabel, true, false, "#000000");
numberLineEdit = new QLineEdit(); numberLineEdit = new QLineEdit();
InitLineEdit(numberLineEdit);
numberLineEdit->setPlaceholderText("请输入一个1~8之间的整数"); numberLineEdit->setPlaceholderText("请输入一个1~8之间的整数");
numberLineEdit->setValidator(new QIntValidator(numberLineEdit)); numberLineEdit->setValidator(new QIntValidator(numberLineEdit));
numberLayout->addWidget(numberLabel); numberLayout->addWidget(numberLabel);
@ -45,7 +53,9 @@ FeedBackWidget::FeedBackWidget(QWidget *parent) :
QHBoxLayout * budgetLayout = new QHBoxLayout(); QHBoxLayout * budgetLayout = new QHBoxLayout();
QLabel * budgetLabel = new QLabel("旅游花费"); QLabel * budgetLabel = new QLabel("旅游花费");
InitLabel(budgetLabel, true, false, "#000000");
budgetLineEdit = new QLineEdit(); budgetLineEdit = new QLineEdit();
InitLineEdit(budgetLineEdit);
budgetLineEdit->setPlaceholderText("请输入一个1~50000之间的整数"); budgetLineEdit->setPlaceholderText("请输入一个1~50000之间的整数");
budgetLineEdit->setValidator(new QIntValidator(budgetLineEdit)); budgetLineEdit->setValidator(new QIntValidator(budgetLineEdit));
budgetLayout->addWidget(budgetLabel); budgetLayout->addWidget(budgetLabel);
@ -53,20 +63,26 @@ FeedBackWidget::FeedBackWidget(QWidget *parent) :
QHBoxLayout * preferenceLayout = new QHBoxLayout(); QHBoxLayout * preferenceLayout = new QHBoxLayout();
QLabel * preferenceLabel = new QLabel("路线重心"); QLabel * preferenceLabel = new QLabel("路线重心");
InitLabel(preferenceLabel, true, false, "#000000");
preferenceLineEdit = new QLineEdit(); preferenceLineEdit = new QLineEdit();
InitLineEdit(preferenceLineEdit);
preferenceLineEdit->setPlaceholderText("请输入一个1~6之间的整数数字的含义如下"); preferenceLineEdit->setPlaceholderText("请输入一个1~6之间的整数数字的含义如下");
preferenceLineEdit->setValidator(new QIntValidator(preferenceLineEdit)); preferenceLineEdit->setValidator(new QIntValidator(preferenceLineEdit));
preferenceLayout->addWidget(preferenceLabel); preferenceLayout->addWidget(preferenceLabel);
preferenceLayout->addWidget(preferenceLineEdit); preferenceLayout->addWidget(preferenceLineEdit);
QHBoxLayout * preferenceHintLayout = new QHBoxLayout(); QHBoxLayout * preferenceHintLayout = new QHBoxLayout();
QLabel * preferenceHintLabel = new QLabel("1:偏重自然风光 2:偏重人文风俗 3:偏重特色美食\n4:night life 5:偏重二次元 6:偏重恋人出游"); QLabel * preferenceHintLabel = new QLabel("1:偏重自然风光 2:偏重人文风俗 3:偏重特色美食\n4:偏重城市夜景 5:偏重休闲娱乐 6:偏重浪漫出游");
InitLabel(preferenceHintLabel, true, true, "#000000");
preferenceHintLayout->addWidget(preferenceHintLabel); preferenceHintLayout->addWidget(preferenceHintLabel);
QHBoxLayout * functionButtonLayout = new QHBoxLayout(); QHBoxLayout * functionButtonLayout = new QHBoxLayout();
confirmButton = new QPushButton("确认"); confirmButton = new QPushButton("确认");
InitButton(confirmButton);
cancelButton = new QPushButton("取消"); cancelButton = new QPushButton("取消");
InitButton(cancelButton);
functionButtonLayout->addWidget(confirmButton); functionButtonLayout->addWidget(confirmButton);
functionButtonLayout->addStretch();
functionButtonLayout->addWidget(cancelButton); functionButtonLayout->addWidget(cancelButton);
verticalLayout = new QVBoxLayout(); verticalLayout = new QVBoxLayout();
@ -122,3 +138,67 @@ QPushButton * FeedBackWidget::getCancleButton()
{ {
return cancelButton; return cancelButton;
} }
void FeedBackWidget::InitLabel(QLabel * label, bool isBold, bool isItalic, QString color)
{
QFont lbl_font("Microsoft YaHei");
lbl_font.setPointSize(9);
lbl_font.setBold(isBold);
lbl_font.setItalic(isItalic);
label->setFont(lbl_font);
label->setStyleSheet("color:" + color);
//label->setAlignment(Qt::AlignRight);
}
void FeedBackWidget::InitButton(QPushButton * button)
{
button->setStyleSheet("QPushButton {"
"color:#ffffff;"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #8CA8CC, stop: 1 #8CA8CC);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"} "
"QPushButton:hover {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6E8AB2, stop: 1 #6E8AB2);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"} "
"QPushButton:pressed {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6783AB, stop: 1 #6783AB);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"}");
}
void FeedBackWidget::InitLineEdit(QLineEdit * lineEdit)
{
lineEdit->setStyleSheet("QLineEdit {"
" border-radius: 4px; "
" color:rgb(0, 0, 0); "
" background-color: rgb(255, 255, 255);"
"} "
" QLineEdit:focus { "
" border-style:outset; "
//" border-width:4px; "
" border-radius: 4px; "
//" border-color: #C1D7F1; "
" color:#ffffff; "
" background-color: #C1D7F1;"
"} ");
lineEdit->setFont(QFont("Microsoft YaHei" , 9, QFont::Bold));
}

@ -32,6 +32,10 @@ public:
QPushButton * getConfirmButton(); QPushButton * getConfirmButton();
QPushButton * getCancleButton(); QPushButton * getCancleButton();
void InitLabel(QLabel * label, bool isBold, bool isItalic, QString color);
void InitButton(QPushButton *);
void InitLineEdit(QLineEdit *);
private: private:
Ui::FeedBackWidget *ui; Ui::FeedBackWidget *ui;

@ -80,6 +80,7 @@ void HistoryWidget::InitHistoryWidget()
mainLayout = new QVBoxLayout(); mainLayout = new QVBoxLayout();
mainLayout->setMargin(35); mainLayout->setMargin(35);
mainLayout->setAlignment(Qt::AlignTop);
subWidget = new QWidget(); subWidget = new QWidget();
web = new WebWidget(); web = new WebWidget();

@ -7,20 +7,16 @@ JournyWidget::JournyWidget(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
verLayout = new QVBoxLayout(); verLayout = new QVBoxLayout();
verLayout->setAlignment(Qt::AlignTop);
setLayout(verLayout); setLayout(verLayout);
functionWidget = new QWidget(); functionWidget = new QWidget();
initFunctionWidget(); initFunctionWidget();
functionWidget->setVisible(true); functionWidget->setVisible(true);
journeyChoiceWidget = new QWidget(); journeyChoiceWidget = new QWidget();
journeyChoiceWidget->setVisible(true); journeyChoiceWidget->setVisible(true);
routeIdList = new int[5]; routeIdList = new int[5];
tagList = new int[5]; tagList = new int[5];
journeyList = new Route *[5]; journeyList = new Route *[5];
@ -175,14 +171,17 @@ void JournyWidget::setBtns()
QHBoxLayout * horizontalLayout = new QHBoxLayout(); QHBoxLayout * horizontalLayout = new QHBoxLayout();
journeyBtnList[i] = new QPushButton(text); journeyBtnList[i] = new QPushButton(text);
journeyBtnList[i]->setStyleSheet("QPushButton{text-align : left;}"); InitItemButton(journeyBtnList[i]);
//journeyBtnList[i]->setStyleSheet("QPushButton{text-align : left;}");
journeyBtnList[i]->setFixedSize(1000, 50); journeyBtnList[i]->setFixedSize(1000, 50);
modifyBtnList[i] = new QPushButton("修改"); modifyBtnList[i] = new QPushButton("修改");
InitButton(modifyBtnList[i]);
modifyBtnList[i]->setFixedSize(200, 50); modifyBtnList[i]->setFixedSize(200, 50);
connect(modifyBtnList[i],&QPushButton::clicked,this,[=](){switchToModify(journeyList[i],tagList[i]);}); connect(modifyBtnList[i],&QPushButton::clicked,this,[=](){switchToModify(journeyList[i],tagList[i]);});
feedBackBtnList[i] = new QPushButton("反馈"); feedBackBtnList[i] = new QPushButton("反馈");
InitButton(feedBackBtnList[i]);
feedBackBtnList[i]->setFixedSize(200, 50); feedBackBtnList[i]->setFixedSize(200, 50);
connect(journeyBtnList[i],&QPushButton::clicked,this,[=](){journeyRoute = journeyList[i]; switchToShowRouteInfo();}); connect(journeyBtnList[i],&QPushButton::clicked,this,[=](){journeyRoute = journeyList[i]; switchToShowRouteInfo();});
@ -220,8 +219,8 @@ void JournyWidget::switchToModify(Route *routeToModofy,int journeyTag)
{ {
modifyWidget = new ModifyWidget(); modifyWidget = new ModifyWidget();
modifyWidget->show(); modifyWidget->show();
modifyWidget->setWindowModality(Qt::ApplicationModal);
modifyWidget->InitModify(routeToModofy,journeyTag); modifyWidget->InitModify(routeToModofy,journeyTag);
} }
void JournyWidget::initFunctionWidget() void JournyWidget::initFunctionWidget()
{ {
@ -251,6 +250,7 @@ void JournyWidget::initFunctionWidget()
//传入修改完毕的route和该route的Id(tagList[i]) //传入修改完毕的route和该route的Id(tagList[i])
void JournyWidget::addRoute(Route *routeToAdd,int tag) void JournyWidget::addRoute(Route *routeToAdd,int tag)
{ {
qDebug() << "routeName:" << routeToAdd->getRouteName();
RouteItem * routeItemsFav = routeToAdd->getAllItems(); RouteItem * routeItemsFav = routeToAdd->getAllItems();
QSqlQuery query(userDb); QSqlQuery query(userDb);
//QString sql_count = "select count(distinct routeId) from journey where userId = ?;"; //QString sql_count = "select count(distinct routeId) from journey where userId = ?;";
@ -419,35 +419,71 @@ void JournyWidget::InitButton(QPushButton * button)
{ {
button->setStyleSheet("QPushButton {" button->setStyleSheet("QPushButton {"
"color:#ffffff;" "color:#ffffff;"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #E1B37C, stop: 1 #E1B37C);" "background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #8CA8CC, stop: 1 #8CA8CC);"
"border-style:outset;" "border-style:outset;"
"border-radius:10px;" "border-radius:10px;"
"font:bold 20px;" "font:bold 16px;"
"font-family: Microsoft YaHei;" "font-family: Microsoft YaHei;"
"min-width:100px;" "min-width:100px;"
"min-height:20px;" "min-height:20px;"
"padding:4px;" "padding:4px;"
"} " "} "
"QPushButton:hover {" "QPushButton:hover {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #D2AD90, stop: 1 #D2AD90);" "background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6E8AB2, stop: 1 #6E8AB2);"
"border-style:outset;" "border-style:outset;"
"border-radius:10px;" "border-radius:10px;"
"font:bold 20px;" "font:bold 16px;"
"font-family: Microsoft YaHei;" "font-family: Microsoft YaHei;"
"min-width:100px;" "min-width:100px;"
"min-height:20px;" "min-height:20px;"
"padding:4px;" "padding:4px;"
"} " "} "
"QPushButton:pressed {" "QPushButton:pressed {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #D2AD90, stop: 1 #D2AD90);" "background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6783AB, stop: 1 #6783AB);"
"border-style:outset;" "border-style:outset;"
"border-radius:10px;" "border-radius:10px;"
"font:bold 20px;" "font:bold 16px;"
"font-family: Microsoft YaHei;" "font-family: Microsoft YaHei;"
"min-width:100px;" "min-width:100px;"
"min-height:20px;" "min-height:20px;"
"padding:4px;" "padding:4px;"
"}"); "}");
button->setFixedSize(120, 40); }
void JournyWidget::InitItemButton(QPushButton * button)
{
button->setStyleSheet("QPushButton {"
"color:#ffffff;"
"background-color: rgba(0, 0, 0, 0);"
"border:none;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"text-align : left;"
"} "
"QPushButton:hover {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #5F7896, stop: 1 #5F7896);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"text-align : left;"
"} "
"QPushButton:pressed {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #5F7896, stop: 1 #5F7896);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"text-align : left;"
"}");
} }

@ -38,11 +38,13 @@ public:
void switchToJourneyChoiceWidget(); void switchToJourneyChoiceWidget();
void confirmButtonProcessor(int index); void confirmButtonProcessor(int index);
void initFunctionWidget(); void initFunctionWidget();
void InitButton(QPushButton * button);
void switchToModify(Route * routeToModofy, int journeyTag); void switchToModify(Route * routeToModofy, int journeyTag);
void resetWidget(); void resetWidget();
void addRoute(Route *routeToAdd,int tag); void addRoute(Route *routeToAdd,int tag);
void InitButton(QPushButton *);
void InitItemButton(QPushButton *);
private: private:
Ui::JournyWidget *ui; Ui::JournyWidget *ui;

@ -162,10 +162,13 @@ void MainWidget::InitMainWidget()
verLayout->addWidget(firstSubWidget); verLayout->addWidget(firstSubWidget);
homeWidget = new HomeWidget(); homeWidget = new HomeWidget();
qDebug() << "homeWidget over";
verLayout->addWidget(homeWidget); verLayout->addWidget(homeWidget);
userWidget = new UserWidget(); userWidget = new UserWidget();
qDebug() << "userWidget over";
verLayout->addWidget(userWidget); verLayout->addWidget(userWidget);
searchWidget = new SearchWidget(); searchWidget = new SearchWidget();
qDebug() << "searchWidget over";
verLayout->addWidget(searchWidget); verLayout->addWidget(searchWidget);
//首页按钮默认选中 //首页按钮默认选中

@ -9,22 +9,30 @@ ModifyWidget::ModifyWidget(QWidget *parent) :
pageIndex = 0; pageIndex = 0;
this->setWindowModality(Qt::ApplicationModal);
this->setFixedSize(QSize(1000,810));
this->setWindowTitle("请修改...");
this->setWindowFlags(windowFlags()& ~Qt::WindowMaximizeButtonHint);
this->setWindowFlags(windowFlags()& ~Qt::WindowCloseButtonHint);
mainLayout = new QVBoxLayout(); mainLayout = new QVBoxLayout();
funcLine = new QHBoxLayout(); funcLine = new QHBoxLayout();
rtn = new QPushButton("返回"); rtn = new QPushButton("返回");
InitButton(rtn);
next = new QPushButton("下一步"); next = new QPushButton("下一步");
InitButton(next);
// modifyPlace = new CustomizeWidget(); modifyPlace = new CustomizeWidget();
// modifyTraffic = new ConfirmWidget(); modifyTraffic = new ConfirmWidget();
// showInfo = new ShowRouteInfoWidget(); showInfo = new ShowRouteInfoWidget();
this->setLayout(mainLayout); this->setLayout(mainLayout);
mainLayout->addLayout(funcLine); mainLayout->addLayout(funcLine);
// mainLayout->addWidget(modifyPlace); mainLayout->addWidget(modifyPlace);
// mainLayout->addWidget(modifyTraffic); mainLayout->addWidget(modifyTraffic);
// mainLayout->addWidget(showInfo); mainLayout->addWidget(showInfo);
funcLine->addWidget(rtn); funcLine->addWidget(rtn);
funcLine->addStretch(5); funcLine->addStretch(5);
@ -46,19 +54,21 @@ void ModifyWidget::invisibleAll()
void ModifyWidget::InitModify(Route *route, int t) void ModifyWidget::InitModify(Route *route, int t)
{ {
oRoute = new Route;
r = route; r = route;
oRoute->setAllInfo(r);
pageIndex = 0; pageIndex = 0;
tag = t; tag = t;
modifyPlace->deleteLater(); // modifyPlace->deleteLater();
modifyTraffic->deleteLater(); // modifyTraffic->deleteLater();
showInfo->deleteLater(); // showInfo->deleteLater();
modifyPlace = new CustomizeWidget(); // modifyPlace = new CustomizeWidget();
modifyTraffic = new ConfirmWidget(); // modifyTraffic = new ConfirmWidget();
showInfo = new ShowRouteInfoWidget(); // showInfo = new ShowRouteInfoWidget();
mainLayout->addWidget(modifyPlace); // mainLayout->addWidget(modifyPlace);
mainLayout->addWidget(modifyTraffic); // mainLayout->addWidget(modifyTraffic);
mainLayout->addWidget(showInfo); // mainLayout->addWidget(showInfo);
modifyPlace->initInterface(r); modifyPlace->initInterface(r);
@ -67,7 +77,7 @@ void ModifyWidget::InitModify(Route *route, int t)
disconnect(rtn, 0, 0, 0); disconnect(rtn, 0, 0, 0);
disconnect(next, 0, 0, 0); disconnect(next, 0, 0, 0);
connect(rtn, &QPushButton::clicked, this, [=](){this->setVisible(false);}); connect(rtn, &QPushButton::clicked, this, [=](){r->setAllInfo(oRoute); this->close();});
connect(next, &QPushButton::clicked, this, &ModifyWidget::switchToModifyTraffic); connect(next, &QPushButton::clicked, this, &ModifyWidget::switchToModifyTraffic);
} }
@ -76,6 +86,7 @@ void ModifyWidget::switchToModifyPlace()
{ {
if (pageIndex == 1) if (pageIndex == 1)
{ {
qDebug("switch to place");
modifyTraffic->deleteLater(); modifyTraffic->deleteLater();
modifyTraffic = new ConfirmWidget(); modifyTraffic = new ConfirmWidget();
mainLayout->addWidget(modifyTraffic); mainLayout->addWidget(modifyTraffic);
@ -87,7 +98,7 @@ void ModifyWidget::switchToModifyPlace()
disconnect(rtn, 0, 0, 0); disconnect(rtn, 0, 0, 0);
disconnect(next, 0, 0, 0); disconnect(next, 0, 0, 0);
connect(rtn, &QPushButton::clicked, this, [=](){this->deleteLater();}); connect(rtn, &QPushButton::clicked, this, [=](){r->setAllInfo(oRoute); this->close();});
connect(next, &QPushButton::clicked, this, &ModifyWidget::switchToModifyTraffic); connect(next, &QPushButton::clicked, this, &ModifyWidget::switchToModifyTraffic);
} }
@ -98,6 +109,7 @@ void ModifyWidget::switchToModifyTraffic()
{ {
if (pageIndex == 2) if (pageIndex == 2)
{ {
qDebug("switch to traffic");
showInfo->deleteLater(); showInfo->deleteLater();
showInfo = new ShowRouteInfoWidget(); showInfo = new ShowRouteInfoWidget();
mainLayout->addWidget(showInfo); mainLayout->addWidget(showInfo);
@ -113,23 +125,26 @@ void ModifyWidget::switchToModifyTraffic()
connect(next, &QPushButton::clicked, this, &ModifyWidget::switchToShowInfo); connect(next, &QPushButton::clicked, this, &ModifyWidget::switchToShowInfo);
} }
else
if (modifyPlace->genRoute())
{ {
pageIndex = 1; if (modifyPlace->genRoute())
r = modifyPlace->getRoute(); {
qDebug("switch to traffic");
pageIndex = 1;
r = modifyPlace->getRoute();
modifyTraffic->setRouteToConfirm(r); modifyTraffic->setRouteToConfirm(r);
modifyTraffic->initWidget(); modifyTraffic->initWidget();
invisibleAll(); invisibleAll();
modifyTraffic->setVisible(true); modifyTraffic->setVisible(true);
disconnect(rtn, 0, 0, 0); disconnect(rtn, 0, 0, 0);
disconnect(next, 0, 0, 0); disconnect(next, 0, 0, 0);
connect(rtn, &QPushButton::clicked, this, &ModifyWidget::switchToModifyPlace); connect(rtn, &QPushButton::clicked, this, &ModifyWidget::switchToModifyPlace);
connect(next, &QPushButton::clicked, this, &ModifyWidget::switchToShowInfo); connect(next, &QPushButton::clicked, this, &ModifyWidget::switchToShowInfo);
}
} }
} }
@ -138,13 +153,16 @@ void ModifyWidget::switchToShowInfo()
if (pageIndex == 1) if (pageIndex == 1)
{ {
r = modifyTraffic->genRoute(); Route *route = modifyTraffic->genRoute();
if(r == NULL) if(route == NULL)
{ {
qDebug() << "traffic send NULL";
return ; return ;
} }
else else
{ {
r = route;
qDebug("switch to Info");
pageIndex = 2; pageIndex = 2;
showInfo->setRouteToShow(r); showInfo->setRouteToShow(r);
showInfo->initWidget(); showInfo->initWidget();
@ -155,13 +173,107 @@ void ModifyWidget::switchToShowInfo()
p = p->next; p = p->next;
} }
invisibleAll();
showInfo->setVisible(true);
disconnect(rtn, 0, 0, 0); disconnect(rtn, 0, 0, 0);
disconnect(next, 0, 0, 0); disconnect(next, 0, 0, 0);
connect(rtn, &QPushButton::clicked, this, &ModifyWidget::switchToModifyTraffic); connect(rtn, &QPushButton::clicked, this, &ModifyWidget::switchToModifyTraffic);
connect(next, &QPushButton::clicked, this, [=](){this->setVisible(false);}); connect(next, &QPushButton::clicked, this, [=](){addRoute(r, tag); this->close();});
} }
} }
} }
QPushButton *ModifyWidget::getNext()
{
return next;
}
int ModifyWidget::getIndex()
{
return pageIndex;
}
void ModifyWidget::addRoute(Route *routeToAdd,int tag)
{
qDebug() << "routeName:" << routeToAdd->getRouteName();
RouteItem * routeItemsFav = routeToAdd->getAllItems();
QSqlQuery query(userDb);
//QString sql_count = "select count(distinct routeId) from journey where userId = ?;";
//query.prepare(sql_count);
//query.addBindValue(Id);
//query.exec(sql_count);
//query.next();
int routeId = routeToAdd->getRouteId();
QString sql_delete = "delete from journey where routeId = ? and userId = ?";
query.prepare(sql_delete);
query.addBindValue(routeId);
query.addBindValue(Id);
query.exec();
QString sql = "insert into journey (userId,routeId,routeName,placeNo,startTime,endTime,placeName,url,cateId,traffic,distance,timeCost,description,tag) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
int i = 1;
//int size = routeFav->getPlaceSize();
while(routeItemsFav->next != NULL)
{
routeItemsFav = routeItemsFav->next;
query.prepare(sql);
query.addBindValue(Id);
query.addBindValue(routeId);
//query.addBindValue(routeFav->getRouteId());
query.addBindValue(routeToAdd->getRouteName());
//query.addBindValue(routeFav->getRouteName());
query.addBindValue(i);
query.addBindValue(routeItemsFav->startTime.toString("yyyy-MM-dd HH:mm:ss"));
query.addBindValue(routeItemsFav->endTime.toString("yyyy-MM-dd HH:mm:ss"));
query.addBindValue(routeItemsFav->placeName);
query.addBindValue(routeItemsFav->url);
query.addBindValue(routeItemsFav->cateId);
query.addBindValue(routeItemsFav->traffic);
query.addBindValue(routeItemsFav->distance);
query.addBindValue(routeItemsFav->timeCost);
query.addBindValue(routeItemsFav->description);
query.addBindValue(tag);
query.exec();
i++;
}
}
void ModifyWidget::InitButton(QPushButton * button)
{
button->setStyleSheet("QPushButton {"
"color:#ffffff;"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #8CA8CC, stop: 1 #8CA8CC);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"} "
"QPushButton:hover {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6E8AB2, stop: 1 #6E8AB2);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"} "
"QPushButton:pressed {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6783AB, stop: 1 #6783AB);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"}");
}

@ -31,12 +31,18 @@ public:
void switchToModifyTraffic(); void switchToModifyTraffic();
void switchToShowInfo(); void switchToShowInfo();
void InitModify(Route *route, int t); void InitModify(Route *route, int t);
QPushButton *getNext();
int getIndex();
void addRoute(Route *routeToAdd,int tag);
void InitButton(QPushButton *);
private: private:
Ui::ModifyWidget *ui; Ui::ModifyWidget *ui;
int pageIndex; int pageIndex;
Route *r; Route *r;
Route *oRoute;
int tag; int tag;
QVBoxLayout *mainLayout; QVBoxLayout *mainLayout;

@ -345,8 +345,6 @@ void PlanWidget::switchToShowRouteInfo()
connect(confirmBtn, &QPushButton::clicked, this, &PlanWidget::switchToPlanChoice); connect(confirmBtn, &QPushButton::clicked, this, &PlanWidget::switchToPlanChoice);
connect(favoriteBtn,&QPushButton::clicked, this, &PlanWidget::addFavRoute); connect(favoriteBtn,&QPushButton::clicked, this, &PlanWidget::addFavRoute);
showRouteInfoWidget->setRouteToShow(route); showRouteInfoWidget->setRouteToShow(route);
showRouteInfoWidget->initWidget(); showRouteInfoWidget->initWidget();
struct routeItem * p= route->getAllItems()->next; struct routeItem * p= route->getAllItems()->next;
@ -357,7 +355,6 @@ void PlanWidget::switchToShowRouteInfo()
} }
} }
} }
} }
@ -457,11 +454,8 @@ void PlanWidget::switchToConfirmWidget()
connect(confirmBtn, &QPushButton::clicked, this, &PlanWidget::switchToShowRouteInfo); connect(confirmBtn, &QPushButton::clicked, this, &PlanWidget::switchToShowRouteInfo);
} }
} }
} }
PlanWidget::~PlanWidget() PlanWidget::~PlanWidget()
@ -648,7 +642,7 @@ void PlanWidget::addRoute()
query.prepare(sql_delete); query.prepare(sql_delete);
query.addBindValue(routeId_selected); query.addBindValue(routeId_selected);
query.addBindValue(Id); query.addBindValue(Id);
query.exec(sql_delete); query.exec();
} }
QString sql = "insert into journey (userId,routeId,routeName,placeNo,startTime,endTime,placeName,url,cateId,traffic,distance,timeCost,description,tag) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?);"; QString sql = "insert into journey (userId,routeId,routeName,placeNo,startTime,endTime,placeName,url,cateId,traffic,distance,timeCost,description,tag) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
int i = 1; int i = 1;

@ -23,27 +23,36 @@ PopWidget::PopWidget(QWidget *parent) :
mainLayout = new QVBoxLayout(); mainLayout = new QVBoxLayout();
notify = new QLabel("请从您的收藏夹中选择场所添加到路线中"); notify = new QLabel("请从您的收藏夹中选择场所添加到路线中");
InitLabel(notify);
notify->setAlignment(Qt::AlignCenter); notify->setAlignment(Qt::AlignCenter);
searchLine = new QHBoxLayout(); searchLine = new QHBoxLayout();
searchBar = new QLineEdit(); searchBar = new QLineEdit();
InitLineEdit(searchBar);
searchBtn = new QPushButton("搜索"); searchBtn = new QPushButton("搜索");
InitButton(searchBtn);
returnSearchBtn = new QPushButton("退出搜索"); returnSearchBtn = new QPushButton("退出搜索");
InitButton(returnSearchBtn);
scroll = new QScrollArea(); scroll = new QScrollArea();
scrollWidget = new QWidget; scrollWidget = new QWidget;
scrollLayout = new QVBoxLayout(); scrollLayout = new QVBoxLayout();
pageLine = new QHBoxLayout(); pageLine = new QHBoxLayout();
up = new QPushButton("上一页"); up = new QPushButton("上页");
down = new QPushButton("下一页"); InitButton(up);
down = new QPushButton("下页");
InitButton(down);
chosenLabel = new QLabel("您还未选择场所..."); chosenLabel = new QLabel("您还未选择场所...");
InitLabel(chosenLabel);
chosenLabel->setAlignment(Qt::AlignLeft); chosenLabel->setAlignment(Qt::AlignLeft);
closeLine = new QHBoxLayout(); closeLine = new QHBoxLayout();
confirm = new QPushButton("确认"); confirm = new QPushButton("确认");
InitButton(confirm);
cancel = new QPushButton("取消"); cancel = new QPushButton("取消");
InitButton(cancel);
this->setLayout(mainLayout); this->setLayout(mainLayout);
@ -190,7 +199,10 @@ void PopWidget::setScreen()
nameList.clear(); nameList.clear();
cateList.clear(); cateList.clear();
for (int i = 0; i < showLimit; i++) for (int i = 0; i < showLimit; i++)
{
btnList[i] = new QToolButton(); btnList[i] = new QToolButton();
InitItemButton(btnList[i]);
}
queryDatabase(); queryDatabase();
qDebug("popWidget query success"); qDebug("popWidget query success");
@ -255,3 +267,102 @@ QStringList PopWidget::getChosen()
{ {
return chosen; return chosen;
} }
void PopWidget::InitLabel(QLabel * label)
{
QFont lbl_font("Microsoft YaHei");
lbl_font.setPointSize(10);
//lbl_font.setBold(true);
label->setFont(lbl_font);
label->setStyleSheet("color: rgb(0, 0, 0)");
label->setAlignment(Qt::AlignRight);
}
void PopWidget::InitButton(QPushButton * button)
{
button->setStyleSheet("QPushButton {"
"color:#ffffff;"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #8CA8CC, stop: 1 #8CA8CC);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
"min-width:100px;"
"min-height:20px;"
"padding:4px;"
"} "
"QPushButton:hover {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6E8AB2, stop: 1 #6E8AB2);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
"min-width:100px;"
"min-height:20px;"
"padding:4px;"
"} "
"QPushButton:pressed {"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #6783AB, stop: 1 #6783AB);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
"min-width:100px;"
"min-height:20px;"
"padding:4px;"
"}");
}
void PopWidget::InitItemButton(QToolButton * button)
{
button->setStyleSheet("QToolButton {"
"color: rgb(0, 0, 0);"
"background-color: rgba(0, 0, 0, 0);"
"border:none;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"} "
"QToolButton:hover {"
"color: rgb(255, 255, 255);"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #5F7896, stop: 1 #5F7896);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"} "
"QToolButton:pressed {"
"color: rgb(255, 255, 255);"
"background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #5F7896, stop: 1 #5F7896);"
"border-style:outset;"
"border-radius:10px;"
"font:bold 16px;"
"font-family: Microsoft YaHei;"
//"min-width:100px;"
//"min-height:20px;"
//"padding:4px;"
"}");
}
void PopWidget::InitLineEdit(QLineEdit * lineEdit)
{
lineEdit->setStyleSheet("QLineEdit {"
" border-radius: 4px; "
" color:rgb(0, 0, 0); "
" background-color: rgb(255, 255, 255);"
"} "
" QLineEdit:focus { "
" border-style:outset; "
//" border-width:4px; "
" border-radius: 4px; "
//" border-color: #C1D7F1; "
" color:#ffffff; "
" background-color: #C1D7F1;"
"} ");
lineEdit->setFont(QFont("Microsoft YaHei" , 14, QFont::Bold));
}

@ -45,6 +45,11 @@ public:
void rollTop(); void rollTop();
QStringList getChosen(); QStringList getChosen();
void InitLabel(QLabel *);
void InitButton(QPushButton *);
void InitItemButton(QToolButton *);
void InitLineEdit(QLineEdit *);
private: private:
Ui::PopWidget *ui; Ui::PopWidget *ui;

@ -100,3 +100,33 @@ int Route::getLength()
{ {
return this->placeSize; return this->placeSize;
} }
void Route::setAllInfo(Route *otherRoute)
{
this->setRouteName(otherRoute->routeName);
this->setUserId(otherRoute->routeId);
this->setUserId(otherRoute->userId);
RouteItem * routeItemtemp = this->routeItems;
RouteItem * OtherRouteItem = otherRoute->getAllItems()->next;
while(OtherRouteItem)
{
RouteItem * p;
p = new RouteItem;
// routeItemtemp = NULL;
p->url = OtherRouteItem->url;
p->cateId = OtherRouteItem->cateId;
p->next = OtherRouteItem->next;
p->endTime = OtherRouteItem->endTime;
p->traffic = OtherRouteItem->traffic;
p->distance = OtherRouteItem->distance;
p->timeCost = OtherRouteItem->timeCost;
p->placeName = OtherRouteItem->placeName;
p->startTime = OtherRouteItem->startTime;
p->description = OtherRouteItem->description;
routeItemtemp -> next = p;
routeItemtemp = routeItemtemp->next;
routeItemtemp->next = NULL;
OtherRouteItem = OtherRouteItem->next;
}
}

@ -19,6 +19,7 @@ public:
RouteItem * addItem(RouteItem * oneItem,int locate); RouteItem * addItem(RouteItem * oneItem,int locate);
RouteItem * deleteItem(int locate); RouteItem * deleteItem(int locate);
int getLength(); int getLength();
void setAllInfo(Route *otherRoute);
private: private:
QString routeName; QString routeName;
int placeSize = 0; int placeSize = 0;

@ -19,7 +19,9 @@ void ShowRouteInfoWidget::initWidget()
initInfoWidget(); initInfoWidget();
int i; int i;
routeNameLabel = new QLabel("路线名称:"); routeNameLabel = new QLabel("路线名称:");
InitLabel(routeNameLabel, true, false, "#FFFFFF");
nameLabel = new QLabel(routeToShow->getRouteName()); nameLabel = new QLabel(routeToShow->getRouteName());
InitLabel(nameLabel, true, true, "#FFFFFF");
nameLine = new QHBoxLayout(); nameLine = new QHBoxLayout();
nameLine->addWidget(routeNameLabel); nameLine->addWidget(routeNameLabel);
nameLine->addWidget(nameLabel); nameLine->addWidget(nameLabel);
@ -54,14 +56,21 @@ void ShowRouteInfoWidget::initInfoWidget()
routeItems=routeItems->next; routeItems=routeItems->next;
placeLabelList[i] = new QLabel(routeItems->placeName); placeLabelList[i] = new QLabel(routeItems->placeName);
InitLabel(placeLabelList[i], true, false, "#E1B37C");
startTimeLabelList[i] = new QLabel(routeItems->startTime.toString()); startTimeLabelList[i] = new QLabel(routeItems->startTime.toString());
InitLabel(startTimeLabelList[i], true, true, "#FFFFFF");
endTimeLabelList[i] = new QLabel(routeItems->endTime.toString()); endTimeLabelList[i] = new QLabel(routeItems->endTime.toString());
InitLabel(endTimeLabelList[i], true, true, "#FFFFFF");
if(i != size-1) if(i != size-1)
{ {
trafficLabelList[i] = new QLabel(routeItems->traffic); trafficLabelList[i] = new QLabel(routeItems->traffic);
InitLabel(trafficLabelList[i], true, true, "#FFFFFF");
descriptionLabelList[i] = new QLabel(routeItems->description); descriptionLabelList[i] = new QLabel(routeItems->description);
distanceLabelList[i] = new QLabel("距离:"+QString::number(routeItems->distance)); InitLabel(descriptionLabelList[i], false, true, "#FFFFFF");
timeCostLabelList[i] = new QLabel("时间:"+QString::number(routeItems->timeCost)); distanceLabelList[i] = new QLabel("距离:"+QString::number((routeItems->distance)*1.0/1000)+"公里");
InitLabel(distanceLabelList[i], false, true, "#FFFFFF");
timeCostLabelList[i] = new QLabel("时间:"+QString::number((routeItems->timeCost)*1.0/60)+"分钟");
InitLabel(timeCostLabelList[i], false, true, "#FFFFFF");
} }
i++; i++;
} }
@ -84,13 +93,24 @@ void ShowRouteInfoWidget::setRouteToShow(Route *route)
{ {
this->routeToShow = route; this->routeToShow = route;
} }
Route * ShowRouteInfoWidget::getRouteToShow() Route * ShowRouteInfoWidget::getRouteToShow()
{ {
return this->routeToShow; return this->routeToShow;
} }
ShowRouteInfoWidget::~ShowRouteInfoWidget() ShowRouteInfoWidget::~ShowRouteInfoWidget()
{ {
delete ui; delete ui;
} }
void ShowRouteInfoWidget::InitLabel(QLabel * label, bool isBold, bool isItalic, QString color)
{
QFont lbl_font("Microsoft YaHei");
lbl_font.setPointSize(12);
lbl_font.setBold(isBold);
lbl_font.setItalic(isItalic);
label->setFont(lbl_font);
label->setStyleSheet("color:" + color);
//label->setAlignment(Qt::AlignRight);
}

@ -32,6 +32,7 @@ public:
void initInfoWidget(); void initInfoWidget();
void setRouteToShow(Route * route); void setRouteToShow(Route * route);
Route * getRouteToShow(); Route * getRouteToShow();
void InitLabel(QLabel * label, bool isBold, bool isItalic, QString color);
private: private:
Ui::ShowRouteInfoWidget *ui; Ui::ShowRouteInfoWidget *ui;

@ -137,9 +137,13 @@ void UserWidget::InitUserWidget()
//historyBtn->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); userInfoWidget = new UserInfoWidget(this);
qDebug() << "userInfoWidget over";
journyWidget = new JournyWidget(this); journyWidget = new JournyWidget(this);
qDebug() << "journyWidget over";
favoriteWidget = new FavoriteWidget(this); favoriteWidget = new FavoriteWidget(this);
qDebug() << "favoriteWidget over";
historyWidget = new HistoryWidget(this); historyWidget = new HistoryWidget(this);
qDebug() << "historyWidget over";
journyWidget->setVisible(false); journyWidget->setVisible(false);
favoriteWidget->setVisible(false); favoriteWidget->setVisible(false);
historyWidget->setVisible(false); historyWidget->setVisible(false);

Loading…
Cancel
Save