Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
inputQmcdcode
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuai.liu
inputQmcdcode
Commits
017058fc
Commit
017058fc
authored
Apr 09, 2018
by
刘帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改提示方式,提交测试
parent
da4f6f7e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
23 deletions
+57
-23
qMcdCode/errcodedialog.cpp
+7
-5
qMcdCode/errcodedialog.h
+1
-1
qMcdCode/errcodedialog.ui
+7
-1
qMcdCode/golbal.cpp
+4
-3
qMcdCode/qMcdCode.pro
+8
-0
qMcdCode/widget/lcmylabel.cpp
+8
-3
qMcdCode/workwidget.cpp
+22
-10
No files found.
qMcdCode/errcodedialog.cpp
View file @
017058fc
...
@@ -18,7 +18,7 @@ ErrCodeDialog::~ErrCodeDialog()
...
@@ -18,7 +18,7 @@ ErrCodeDialog::~ErrCodeDialog()
delete
ui
;
delete
ui
;
}
}
void
ErrCodeDialog
::
showForInvalid
(
const
QString
&
coupon
,
QWidget
*
parent
)
void
ErrCodeDialog
::
showForInvalid
(
const
QString
&
coupon
,
const
QString
msg
,
QWidget
*
parent
)
{
{
ErrCodeDialog
v
(
parent
);
ErrCodeDialog
v
(
parent
);
v
.
setGeometry
(
0
,
0
,
350
,
470
);
v
.
setGeometry
(
0
,
0
,
350
,
470
);
...
@@ -27,7 +27,9 @@ void ErrCodeDialog::showForInvalid(const QString &coupon, QWidget *parent)
...
@@ -27,7 +27,9 @@ void ErrCodeDialog::showForInvalid(const QString &coupon, QWidget *parent)
v
.
ui
->
labTime
->
setVisible
(
false
);
v
.
ui
->
labTime
->
setVisible
(
false
);
v
.
ui
->
labActName
->
setVisible
(
false
);
v
.
ui
->
labActName
->
setVisible
(
false
);
v
.
ui
->
labCodeName
->
setVisible
(
false
);
v
.
ui
->
labCodeName
->
setVisible
(
true
);
v
.
ui
->
labCodeName
->
setText
(
msg
);
v
.
ui
->
labFolat
->
setVisible
(
false
);
v
.
ui
->
labFolat
->
setVisible
(
false
);
v
.
ui
->
labCode
->
setText
(
coupon
);
v
.
ui
->
labCode
->
setText
(
coupon
);
...
@@ -47,13 +49,13 @@ void ErrCodeDialog::showForExpird(const QString &act_name,
...
@@ -47,13 +49,13 @@ void ErrCodeDialog::showForExpird(const QString &act_name,
v
.
ui
->
topInvalidWidget
->
setStyleSheet
(
v
.
ui
->
topInvalidWidget
->
styleSheet
());
v
.
ui
->
topInvalidWidget
->
setStyleSheet
(
v
.
ui
->
topInvalidWidget
->
styleSheet
());
v
.
ui
->
labTime
->
setVisible
(
true
);
v
.
ui
->
labTime
->
setVisible
(
true
);
v
.
ui
->
labActName
->
setVisible
(
tru
e
);
v
.
ui
->
labActName
->
setVisible
(
fals
e
);
v
.
ui
->
labCodeName
->
setVisible
(
true
);
v
.
ui
->
labCodeName
->
setVisible
(
true
);
v
.
ui
->
labCode
->
setText
(
coupon
);
v
.
ui
->
labCode
->
setText
(
coupon
);
v
.
ui
->
labTime
->
setText
(
time_name
);
v
.
ui
->
labTime
->
setText
(
time_name
);
v
.
ui
->
labActName
->
setText
(
act_name
);
//
v.ui->labActName->setText( act_name);
v
.
ui
->
labCodeName
->
setText
(
code
_name
);
v
.
ui
->
labCodeName
->
setText
(
act
_name
);
v
.
exec
();
v
.
exec
();
}
}
...
...
qMcdCode/errcodedialog.h
View file @
017058fc
...
@@ -22,7 +22,7 @@ public:
...
@@ -22,7 +22,7 @@ public:
explicit
ErrCodeDialog
(
QWidget
*
parent
=
0
);
explicit
ErrCodeDialog
(
QWidget
*
parent
=
0
);
~
ErrCodeDialog
();
~
ErrCodeDialog
();
static
void
showForInvalid
(
const
QString
&
coupon
,
QWidget
*
parent
=
0
);
static
void
showForInvalid
(
const
QString
&
coupon
,
const
QString
msg
,
QWidget
*
parent
=
0
);
static
void
showForExpird
(
const
QString
&
act_name
,
const
QString
code_name
,
static
void
showForExpird
(
const
QString
&
act_name
,
const
QString
code_name
,
const
QString
time_name
,
const
QString
coupon
,
const
QString
time_name
,
const
QString
coupon
,
...
...
qMcdCode/errcodedialog.ui
View file @
017058fc
...
@@ -224,7 +224,7 @@
...
@@ -224,7 +224,7 @@
<property
name=
"geometry"
>
<property
name=
"geometry"
>
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
19
0
</y>
<y>
21
0
</y>
<width>
330
</width>
<width>
330
</width>
<height>
37
</height>
<height>
37
</height>
</rect>
</rect>
...
@@ -250,6 +250,12 @@
...
@@ -250,6 +250,12 @@
<property
name=
"alignment"
>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
<set>
Qt::AlignCenter
</set>
</property>
</property>
<property
name=
"margin"
>
<number>
0
</number>
</property>
<property
name=
"indent"
>
<number>
-1
</number>
</property>
</widget>
</widget>
<widget
class=
"QLabel"
name=
"labFolat"
>
<widget
class=
"QLabel"
name=
"labFolat"
>
<property
name=
"geometry"
>
<property
name=
"geometry"
>
...
...
qMcdCode/golbal.cpp
View file @
017058fc
#include "golbal.h"
#
include
"golbal.h"
#include <QFile>
#include <QFile>
#include <QMessageBox>
#include <QMessageBox>
#include <QXmlStreamReader>
#include <QXmlStreamReader>
...
@@ -22,8 +22,9 @@ bool readStorid(QString &storid)
...
@@ -22,8 +22,9 @@ bool readStorid(QString &storid)
if
(
!
file
.
open
(
QFile
::
ReadOnly
|
QFile
::
Text
))
if
(
!
file
.
open
(
QFile
::
ReadOnly
|
QFile
::
Text
))
{
{
QMessageBox
::
information
(
NULL
,
QString
(
"err"
),
"E:
\\
NewPos61
\\
PosData
\\
store-db.xml打开失败,请联系it人员!"
);
QString
str
=
"E:
\\
NewPos61
\\
PosData
\\
store-db.xml打开失败,请联系it人员!"
;
return
false
;
QMessageBox
::
information
(
NULL
,
QString
(
"err"
),
str
);
return
false
;
}
}
QXmlStreamReader
xml
(
&
file
);
QXmlStreamReader
xml
(
&
file
);
int
flag
=
0
;
int
flag
=
0
;
...
...
qMcdCode/qMcdCode.pro
View file @
017058fc
...
@@ -14,6 +14,14 @@ TEMPLATE = app
...
@@ -14,6 +14,14 @@ TEMPLATE = app
INCLUDEPATH
+=
$$
PWD
/../
qMcdCode
/
widget
INCLUDEPATH
+=
$$
PWD
/../
qMcdCode
/
widget
CONFIG
(
debug
,
debug
|
release
){
DESTDIR
=
$$
PWD
/
bin
/
debug
}
else
{
DESTDIR
=
$$
PWD
/
bin
/
release
}
SOURCES
+=
main
.
cpp
\
SOURCES
+=
main
.
cpp
\
widget
/
lc_my_dialog
.
cpp
\
widget
/
lc_my_dialog
.
cpp
\
errcodedialog
.
cpp
\
errcodedialog
.
cpp
\
...
...
qMcdCode/widget/lcmylabel.cpp
View file @
017058fc
...
@@ -111,7 +111,8 @@ void LcMyLabel::paintEvent(QPaintEvent *event)
...
@@ -111,7 +111,8 @@ void LcMyLabel::paintEvent(QPaintEvent *event)
int
maxSize
=
getMaxSize
(
allStr
,
this
->
width
());
int
maxSize
=
getMaxSize
(
allStr
,
this
->
width
());
if
(
allStr
.
length
()
<=
maxSize
){
if
(
allStr
.
length
()
<=
maxSize
)
{
QFont
_font
(
bigFontName
);
QFont
_font
(
bigFontName
);
...
@@ -133,14 +134,14 @@ void LcMyLabel::paintEvent(QPaintEvent *event)
...
@@ -133,14 +134,14 @@ void LcMyLabel::paintEvent(QPaintEvent *event)
font
.
setPointSize
(
fontSize
);
font
.
setPointSize
(
fontSize
);
font
.
setBold
(
true
);
font
.
setBold
(
true
);
QString
str1
=
allStr
.
left
(
11
);
QString
str1
=
allStr
.
left
(
allStr
.
length
()
/
2
);
QFontMetrics
fm1
(
font
);
QFontMetrics
fm1
(
font
);
QRect
fRect1
=
fm1
.
boundingRect
(
str1
);
QRect
fRect1
=
fm1
.
boundingRect
(
str1
);
textWidth
=
fRect1
.
width
();
textWidth
=
fRect1
.
width
();
textY
=
fRect1
.
y
()
-
2
;
textY
=
fRect1
.
y
()
-
2
;
pp
.
addText
(
rect
().
center
().
x
()
-
textWidth
/
2.0
,
0
-
textY
,
font
,
str1
);
pp
.
addText
(
rect
().
center
().
x
()
-
textWidth
/
2.0
,
0
-
textY
,
font
,
str1
);
QString
str2
=
allStr
.
right
(
allStr
.
length
()
-
11
);
QString
str2
=
allStr
.
right
(
allStr
.
length
()
-
str1
.
length
()
);
QFontMetrics
fm2
(
font
);
QFontMetrics
fm2
(
font
);
QRect
fRect2
=
fm2
.
boundingRect
(
str2
);
QRect
fRect2
=
fm2
.
boundingRect
(
str2
);
textWidth
=
fRect2
.
width
();
textWidth
=
fRect2
.
width
();
...
@@ -173,6 +174,10 @@ void LcMyLabel::paintEvent(QPaintEvent *event)
...
@@ -173,6 +174,10 @@ void LcMyLabel::paintEvent(QPaintEvent *event)
int
fontSize
=
22
;
int
fontSize
=
22
;
do
{
do
{
fontSize
=
fontSize
-
2
;
fontSize
=
fontSize
-
2
;
if
(
fontSize
<
1
)
{
break
;
}
QFont
_font
(
bigFontName
);
QFont
_font
(
bigFontName
);
font
=
_font
;
font
=
_font
;
font
.
setPointSize
(
fontSize
);
font
.
setPointSize
(
fontSize
);
...
...
qMcdCode/workwidget.cpp
View file @
017058fc
...
@@ -303,21 +303,29 @@ void WorkWidget::error(int socketError, const QString message)
...
@@ -303,21 +303,29 @@ void WorkWidget::error(int socketError, const QString message)
void
WorkWidget
::
queryCode11
(
const
QJsonObject
&
json
)
void
WorkWidget
::
queryCode11
(
const
QJsonObject
&
json
)
{
{
ErrCodeDialog
::
showForInvalid
(
coupon
,
this
);
QString
statusMsg
;
if
(
json
.
contains
(
"msg"
))
statusMsg
=
json
[
"msg"
].
toString
();
else
statusMsg
=
QString
::
number
(
json
[
"statusCode"
].
toInt
());
ErrCodeDialog
::
showForInvalid
(
coupon
,
statusMsg
,
this
);
exit
(
0
);
exit
(
0
);
}
}
void
WorkWidget
::
queryCode12
(
const
QJsonObject
&
json
)
void
WorkWidget
::
queryCode12
(
const
QJsonObject
&
json
)
{
{
QJsonObject
_codeInfo
=
json
[
"codeInfo"
].
toObject
();
QJsonObject
_codeInfo
=
json
[
"codeInfo"
].
toObject
();
QString
_act_name
=
_codeInfo
[
"act_name"
].
toString
();
//QString _act_name = _codeInfo["act_name"].toString();
QString
statusMsg
=
json
[
"msg"
].
toString
();
QString
_code_name
=
_codeInfo
[
"promotion_type"
].
toString
();
QString
_code_name
=
_codeInfo
[
"promotion_type"
].
toString
();
QString
_coupon
=
_codeInfo
[
"code"
].
toString
();
QString
_coupon
=
_codeInfo
[
"code"
].
toString
();
QString
vdata
=
_codeInfo
[
"vdata"
].
toString
();
QString
vdata
=
_codeInfo
[
"vdata"
].
toString
();
QString
_time_name
;
QString
_time_name
;
_time_name
.
append
(
"有效期: "
).
append
(
vdata
);
_time_name
.
append
(
"有效期: "
).
append
(
vdata
);
ErrCodeDialog
::
showForExpird
(
_act_name
,
_code_name
,
_time_name
,
_coupon
,
this
);
ErrCodeDialog
::
showForExpird
(
statusMsg
,
_code_name
,
_time_name
,
_coupon
,
this
);
exit
(
0
);
exit
(
0
);
}
}
//{"redeemInfo":{"redeem_date":"2016-02-02 17:32","station_id":"403056","store_id":"99992","store_name":"麦当劳测试门店2"},"statusCode":14}
//{"redeemInfo":{"redeem_date":"2016-02-02 17:32","station_id":"403056","store_id":"99992","store_name":"麦当劳测试门店2"},"statusCode":14}
...
@@ -332,11 +340,14 @@ void WorkWidget::queryCode14(const QJsonObject &json)
...
@@ -332,11 +340,14 @@ void WorkWidget::queryCode14(const QJsonObject &json)
_time_name
.
append
(
_store_id
).
append
(
"("
).
append
(
_station_id
).
append
(
")"
).
append
(
" "
).
append
(
_time
);
_time_name
.
append
(
_store_id
).
append
(
"("
).
append
(
_station_id
).
append
(
")"
).
append
(
" "
).
append
(
_time
);
QJsonObject
_codeInfo
=
json
[
"codeInfo"
].
toObject
();
QJsonObject
_codeInfo
=
json
[
"codeInfo"
].
toObject
();
QString
_act_name
=
_codeInfo
[
"act_name"
].
toString
();
//QString _act_name = _codeInfo["act_name"].toString();
QString
statusMsg
=
json
[
"msg"
].
toString
();
QString
_code_name
=
_codeInfo
[
"promotion_type"
].
toString
();
QString
_code_name
=
_codeInfo
[
"promotion_type"
].
toString
();
QString
_coupon
=
coupon
;
QString
_coupon
=
coupon
;
ConsumptionDialog
::
ShowForHasConsum
(
_act_name
,
_code_name
,
_time_name
,
_coupon
,
this
);
ConsumptionDialog
::
ShowForHasConsum
(
statusMsg
,
_code_name
,
_time_name
,
_coupon
,
this
);
exit
(
0
);
exit
(
0
);
}
}
...
@@ -365,12 +376,13 @@ void WorkWidget::queryCode100(const QJsonObject &json)
...
@@ -365,12 +376,13 @@ void WorkWidget::queryCode100(const QJsonObject &json)
void
WorkWidget
::
queryCodeErr
(
const
QJsonObject
&
json
)
void
WorkWidget
::
queryCodeErr
(
const
QJsonObject
&
json
)
{
{
int
statusCode
=
json
[
"statusCode"
].
toInt
();
QString
statusMsg
;
if
(
json
.
contains
(
"msg"
))
QString
_act_name
=
"err:"
;
statusMsg
=
json
[
"msg"
].
toString
();
_act_name
.
append
(
QString
::
number
(
statusCode
));
else
statusMsg
=
QString
::
number
(
json
[
"statusCode"
].
toInt
());
ErrCodeDialog
::
showForErr
(
coupon
,
_act_name
,
this
);
ErrCodeDialog
::
showForErr
(
coupon
,
statusMsg
,
this
);
exit
(
0
);
exit
(
0
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment