Commit ccbedfbc by NitefllWind

1.解决程序在多屏幕计算机中未居中显示。2.修改了代金券显示部分代码。

parent a2562082
...@@ -286,7 +286,14 @@ void FMVipForward::logined(const QJsonObject &serverJob, QJsonObject &posJob) ...@@ -286,7 +286,14 @@ void FMVipForward::logined(const QJsonObject &serverJob, QJsonObject &posJob)
foreach(QJsonValue value , couponArr) foreach(QJsonValue value , couponArr)
{ {
QJsonObject co = value.toObject(); QJsonObject co = value.toObject();
_sessionCouponMap[co["couponCode"].toString()] = co["desc"].toString(); QString codeStr = co["couponCode"].toString();
double amountStr = co["disAmount"].toInt()/100.0;
QString desc = co["desc"].toString();
QString couponInfo = QString("券码:%1 金额:%2 备注:%3")
.arg(codeStr)
.arg(amountStr)
.arg(desc);
_sessionCouponMap[co["couponCode"].toString()] = couponInfo;
} }
QString name = memberObj["name"].toString(); QString name = memberObj["name"].toString();
......
...@@ -39,7 +39,7 @@ FMVipOrder::FMVipOrder(QDialog *parent) : ...@@ -39,7 +39,7 @@ FMVipOrder::FMVipOrder(QDialog *parent) :
ui->scrollAreaWidgetContents->addItem(item); ui->scrollAreaWidgetContents->addItem(item);
} }
connect(ui->scrollAreaWidgetContents, SIGNAL(clicked(QModelIndex)), this, SLOT(on_list_view_clicked(QModelIndex))); connect(ui->scrollAreaWidgetContents, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(on_item_clicked(QListWidgetItem*)));
ui->pay_chk->setText(QString("使用积分抵扣 %1 元").arg(orderInfo->getScoreAmount())); ui->pay_chk->setText(QString("使用积分抵扣 %1 元").arg(orderInfo->getScoreAmount()));
...@@ -97,10 +97,10 @@ void FMVipOrder::on_pay_chk_clicked(bool checked) ...@@ -97,10 +97,10 @@ void FMVipOrder::on_pay_chk_clicked(bool checked)
FMVipForward::instance()->addSessionData("isUseScore", QString::number(is)); FMVipForward::instance()->addSessionData("isUseScore", QString::number(is));
} }
void FMVipOrder::on_list_view_clicked(QModelIndex index) void FMVipOrder::on_item_clicked(QListWidgetItem *item)
{ {
int row = index.row(); if(item != NULL)
auto item = ui->scrollAreaWidgetContents->item(row); {
Qt::CheckState state = item->checkState(); Qt::CheckState state = item->checkState();
switch (state) { switch (state) {
case Qt::Checked: case Qt::Checked:
...@@ -111,4 +111,5 @@ void FMVipOrder::on_list_view_clicked(QModelIndex index) ...@@ -111,4 +111,5 @@ void FMVipOrder::on_list_view_clicked(QModelIndex index)
default: default:
break; break;
} }
}
} }
#ifndef FMVIPORDER_H #ifndef FMVIPORDER_H
#define FMVIPORDER_H #define FMVIPORDER_H
#include <QModelIndex> #include <QListWidgetItem>
#include "fmvipwnd.h" #include "fmvipwnd.h"
#define MIN(a,b) ((a<b) ? a : b) #define MIN(a,b) ((a<b) ? a : b)
...@@ -22,7 +22,7 @@ public slots: ...@@ -22,7 +22,7 @@ public slots:
void on_pay_btn_clicked(); void on_pay_btn_clicked();
void on_pay_chk_clicked(bool checked); void on_pay_chk_clicked(bool checked);
void on_list_view_clicked(QModelIndex); void on_item_clicked(QListWidgetItem*);
private: private:
class OrderInfo class OrderInfo
......
...@@ -76,6 +76,10 @@ int FMVipWnd::exec() ...@@ -76,6 +76,10 @@ int FMVipWnd::exec()
showNormal(); showNormal();
::SetForegroundWindow((HWND)effectiveWinId()); ::SetForegroundWindow((HWND)effectiveWinId());
QDesktopWidget w;
QRect rc = w.availableGeometry();
setGeometry((rc.width() - width()) / 2, (rc.height() - height()) / 2, width(), height());
return QDialog::exec(); return QDialog::exec();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment