Commit e2aad1ef by Carwyn

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

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