Commit e2aad1ef by Carwyn

Improved: 1. 代金券界面细节美化

parent 35851cc6
......@@ -23,7 +23,8 @@ SOURCES += main.cpp\
fmvipdispatcher.cpp \
fmvipforward.cpp \
fmmsgwnd.cpp \
fmloading.cpp
fmloading.cpp \
fmcouponwidget.cpp
HEADERS += fmviporder.h \
fmviplogin.h \
......@@ -33,14 +34,16 @@ HEADERS += fmviporder.h \
fmvipdispatcher.h \
fmvipforward.h \
fmmsgwnd.h \
fmloading.h
fmloading.h \
fmcouponwidget.h
FORMS += forms/fmviporder.ui \
forms/fmviplogin.ui \
forms/fmvippanel.ui \
forms/fmvipfund.ui \
forms/fmmsgwnd.ui \
forms/fmloading.ui
forms/fmloading.ui \
forms/fmcouponwidget.ui
RESOURCES += \
res/FMVip.qrc
......@@ -64,6 +67,7 @@ CONFIG(debug, debug|release) {
} else {
DESTDIR = $$PWD/../FMVipTest/Release
TARGET = fmvip
LIBS += -L..\FMVipTest\Release -lFMVipDC
LIBS += -L..\..\FMVip\FMVipTest\Release -lFMVipDC
}
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc -static -lpthread
#include "fmcouponwidget.h"
#include "ui_fmcouponwidget.h"
#include <QPainter>
FMCouponWidget::FMCouponWidget(Coupon conpon, QWidget *parent) :
QWidget(parent),
......@@ -15,3 +16,12 @@ FMCouponWidget::~FMCouponWidget()
{
delete ui;
}
void FMCouponWidget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
......@@ -16,6 +16,7 @@ public:
explicit FMCouponWidget(Coupon conpon, QWidget *parent = 0);
~FMCouponWidget();
void paintEvent(QPaintEvent *event);
private:
Ui::FMCouponWidget *ui;
};
......
......@@ -29,23 +29,23 @@ FMVipOrder::FMVipOrder(QDialog *parent) :
ui->price_label->setText(orderInfo->getNeedPayStr());
ui->name_label->setText(name);
ui->scrollAreaWidgetContents->setViewMode(QListView::IconMode);
// ui->scrollAreaWidgetContents->setResizeMode(QListView::Adjust);
// ui->scrollAreaWidgetContents->setMovement(QListView::Static);
// ui->coupon_page->setViewMode(QListView::IconMode);
// ui->coupon_page->setResizeMode(QListView::Adjust);
// ui->coupon_page->setMovement(QListView::Static);
couponMap = FMVipForward::instance()->sessionCouponMap();
for(Coupon coupon : couponMap.values())
{
auto item = new QListWidgetItem();
item->setData(Coupon_Code, coupon.code);
ui->scrollAreaWidgetContents->addItem(item);
FMCouponWidget *itemWidget = new FMCouponWidget(coupon, ui->scrollAreaWidgetContents);
ui->coupon_page->addItem(item);
FMCouponWidget *itemWidget = new FMCouponWidget(coupon, ui->coupon_page);
// itemWidget->show();
ui->scrollAreaWidgetContents->setItemWidget(item, itemWidget);
ui->coupon_page->setItemWidget(item, itemWidget);
//item大小
item->setSizeHint (QSize(itemWidget->rect().width(), itemWidget->rect().height()));
}
connect(ui->scrollAreaWidgetContents, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(on_item_clicked(QListWidgetItem*)));
connect(ui->coupon_page, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(on_item_clicked(QListWidgetItem*)));
ui->pay_chk->setText(QString("使用积分抵扣 %1 元").arg(orderInfo->getScoreAmount()));
......@@ -69,11 +69,11 @@ FMVipOrder::~FMVipOrder()
void FMVipOrder::on_pay_btn_clicked()
{
int count = ui->scrollAreaWidgetContents->count();
int count = ui->coupon_page->count();
QStringList checkedCode;
for(int i=0; i<count; ++i)
{
auto item = ui->scrollAreaWidgetContents->item(i);
auto item = ui->coupon_page->item(i);
if(item->checkState() == Qt::Checked) {
checkedCode << item->data(Coupon_Code).toString();
}
......@@ -106,6 +106,12 @@ void FMVipOrder::on_pay_chk_clicked(bool checked)
void FMVipOrder::on_item_clicked(QListWidgetItem *item)
{
qDebug() << item->data(Coupon_Code);
if (item->isSelected()) {
ui->coupon_page->itemWidget(item)->setStyleSheet("#FMCouponWidget{background-color: rgb(255, 255, 255); border: none; border-image: url(:/coupon_select.png);}");
}
else {
ui->coupon_page->itemWidget(item)->setStyleSheet("#FMCouponWidget{background-color: rgb(255, 255, 255); border: none; border-left: 5 solid rgb(255, 170, 37);");
}
// if(item != NULL)
// {
// Qt::CheckState state = item->checkState();
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>150</height>
<width>234</width>
<height>120</height>
</rect>
</property>
<property name="windowTitle">
......@@ -15,43 +15,45 @@
</property>
<property name="styleSheet">
<string notr="true">
#FMCouponWidget
{
background-color: rgb(255, 255, 255);
border-image: url(:/coupon_select.png);
}
#code_lab
{
max-height: 15%;
color: rgb(127,127,127);
font: 15px &quot;Microsoft YaHei&quot;;
}
#amount_lab
{
min-height: 65%;
max-height: 65%;
color: rgb(229, 11, 72);
font: bold 36px &quot;Microsoft YaHei&quot;;
}
#desc_lab
{
max-height: 30%;
color: rgb(252,255,255);
background-color: rgb(229, 11, 72);
font: bold 18px &quot;Microsoft YaHei&quot;;
}
#coupon_left
{
max-width: 5px;
background-color: rgb(255, 170, 37);
}
#coupon_separator
{
max-height: 1px;
background-image: url(:/coupon_separator.png);
margin-bottom: 5px;
}
</string>
#FMCouponWidget
{
border: 0 solid white;
border-left: 5 solid rgb(255, 170, 37);
background-color: rgb(255, 255, 255);
}
#code_lab
{
max-height: 22;
min-height: 22;
color: rgb(127,127,127);
font: 15px &quot;Microsoft YaHei&quot;;
}
#amount_lab, #currency
{
color: rgb(229, 11, 72);
font: bold 36px &quot;Microsoft YaHei&quot;;
}
#desc_lab
{
max-height: 36;
min-height: 36;
color: rgb(252,255,255);
background-color: rgb(229, 11, 72);
font: bold 18px &quot;Microsoft YaHei&quot;;
margin-left: 4px;
padding: 0 16 0 16;
}
#coupon_separator
{
max-height: 1px;
background-image: url(:/coupon_separator.png);
background-repeat: none;
background-position: center;
margin-bottom: 5px;
}</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
......@@ -70,56 +72,123 @@
<number>0</number>
</property>
<item>
<widget class="QLabel" name="coupon_left"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>5</number>
<number>0</number>
</property>
<property name="topMargin">
<number>5</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>5</number>
<number>0</number>
</property>
<property name="bottomMargin">
<number>5</number>
<number>0</number>
</property>
<item>
<widget class="QLabel" name="amount_lab">
<property name="text">
<string>¥40.00</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
</widget>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="currency">
<property name="text">
<string></string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="amount_lab">
<property name="text">
<string>40.00</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="coupon_separator"/>
</item>
<item>
<widget class="QLabel" name="desc_lab">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>测试代金券</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="desc_lab">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>36</height>
</size>
</property>
<property name="text">
<string>测试代金券</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="code_lab">
......
......@@ -112,11 +112,12 @@
border-top: 0 solid silver;
}
#coupon_page QWidget{
background: rgb(248,239,222);
#coupon_page{
background: rgb(246,246,246);
border: 1 solid white;
border-top: 1 solid silver;
border-right: 1 solid silver;
border-bottom: 1 solid silver;
border-left: 0 solid silver;
}
#coupon_label {
background: rgb(222,88,51);
......@@ -212,7 +213,48 @@
border: 1 solid silver;
border-top: 0;
}
</string>
/*======Coupon======*/
#FMCouponWidget
{
border: 0 solid white;
border-left: 5 solid rgb(255, 170, 37);
background-color: rgb(255, 255, 255);
}
#code_lab
{
max-height: 22;
min-height: 22;
color: rgb(127,127,127);
font: 15px &quot;Microsoft YaHei&quot;;
}
#amount_lab, #currency
{
color: rgb(229, 11, 72);
font: bold 36px &quot;Microsoft YaHei&quot;;
}
#desc_lab
{
max-height: 36;
min-height: 36;
color: rgb(252,255,255);
background-color: rgb(229, 11, 72);
font: bold 18px &quot;Microsoft YaHei&quot;;
margin-left: 4px;
padding: 0 16 0 16;
}
#coupon_separator
{
max-height: 1px;
background-image: url(:/coupon_separator.png);
background-repeat: none;
background-position: center;
margin-bottom: 5px;
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
......@@ -478,26 +520,31 @@
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="coupon_page">
<widget class="QListWidget" name="coupon_page">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="lineWidth">
<number>1</number>
<number>0</number>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="widgetResizable">
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="spacing">
<number>10</number>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="widgetResizable" stdset="0">
<bool>true</bool>
</property>
<widget class="QListWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>764</width>
<height>249</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
......
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