Commit ccbedfbc by NitefllWind

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

parent a2562082
......@@ -286,7 +286,14 @@ void FMVipForward::logined(const QJsonObject &serverJob, QJsonObject &posJob)
foreach(QJsonValue value , couponArr)
{
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();
......
......@@ -39,7 +39,7 @@ FMVipOrder::FMVipOrder(QDialog *parent) :
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()));
......@@ -97,18 +97,19 @@ void FMVipOrder::on_pay_chk_clicked(bool checked)
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();
auto item = ui->scrollAreaWidgetContents->item(row);
Qt::CheckState state = item->checkState();
switch (state) {
case Qt::Checked:
item->setCheckState(Qt::Unchecked);
break;
case Qt::Unchecked:
item->setCheckState(Qt::Checked);
default:
break;
if(item != NULL)
{
Qt::CheckState state = item->checkState();
switch (state) {
case Qt::Checked:
item->setCheckState(Qt::Unchecked);
break;
case Qt::Unchecked:
item->setCheckState(Qt::Checked);
default:
break;
}
}
}
#ifndef FMVIPORDER_H
#define FMVIPORDER_H
#include <QModelIndex>
#include <QListWidgetItem>
#include "fmvipwnd.h"
#define MIN(a,b) ((a<b) ? a : b)
......@@ -22,7 +22,7 @@ public slots:
void on_pay_btn_clicked();
void on_pay_chk_clicked(bool checked);
void on_list_view_clicked(QModelIndex);
void on_item_clicked(QListWidgetItem*);
private:
class OrderInfo
......
......@@ -76,6 +76,10 @@ int FMVipWnd::exec()
showNormal();
::SetForegroundWindow((HWND)effectiveWinId());
QDesktopWidget w;
QRect rc = w.availableGeometry();
setGeometry((rc.width() - width()) / 2, (rc.height() - height()) / 2, width(), height());
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