-
Notifications
You must be signed in to change notification settings - Fork 0
/
selectitem.cpp
61 lines (55 loc) · 1.45 KB
/
selectitem.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "selectitem.h"
#include "ui_selectitem.h"
#include "settings.h"
#include <QPushButton>
#include <QJsonDocument>
#include <QJsonObject>
#include <QPixmap>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QMenu>
#include <QAction>
#include <QMouseEvent>
SelectItem::SelectItem(int id, QString name, double price, int day, QWidget *parent) :
QWidget(parent),ui(new Ui::SelectItem),id(id)
{
ui->setupUi(this);
ui->NameLable->setText(name);
ui->price->setText("售价:"+QString::number(price)+"万");
ui->time->setText("还需"+QString::number(day)+"天购买");
connect(ui->SelectButton,&QPushButton::clicked,this,&SelectItem::select);
}
SelectItem::~SelectItem()
{
delete ui;
}
void SelectItem::mousePressEvent(QMouseEvent *e)
{
// if(e->buttons().testFlag(Qt::LeftButton))
// {
// PressTime=QTime::currentTime();
// }
QWidget::mousePressEvent(e);
}
void SelectItem::mouseReleaseEvent(QMouseEvent *e)
{
// if(e->buttons().testFlag(Qt::LeftButton))
// {
// if(PressTime.secsTo(QTime::currentTime())<1)
// {
// detail->setId(id.toLong());
// connect(detail,&CarDetail::accepted,static_cast<QWidget *>(this->parent()),&QWidget::close);
// detail->exec();
// }
// }
QWidget::mouseReleaseEvent(e);
}
void SelectItem::select()
{
emit selected(id);
}
void SelectItem::on_DetailButton_clicked()
{
CarDetail d(id,this);
d.exec();
}