Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmp_vip
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
xiaojing.zhang
fmp_vip
Commits
d964b52f
Commit
d964b52f
authored
Feb 02, 2018
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 修改消息框类,实现问题框。
parent
86b307be
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
33 deletions
+56
-33
fmvip/res/img.qrc
+1
-0
fmvip/res/img/tip_question.png
+0
-0
fmvip/windows/fmmsgwnd.cpp
+33
-8
fmvip/windows/fmmsgwnd.h
+4
-5
fmvip/windows/forms/fmmsgwnd.ui
+10
-20
tests/testplugin/tst_testplugin.cpp
+8
-0
No files found.
fmvip/res/img.qrc
View file @
d964b52f
...
@@ -15,5 +15,6 @@
...
@@ -15,5 +15,6 @@
<file>img/tip_ok.png</file>
<file>img/tip_ok.png</file>
<file>img/tip_warning.png</file>
<file>img/tip_warning.png</file>
<file>img/num_del.png</file>
<file>img/num_del.png</file>
<file>img/tip_question.png</file>
</qresource>
</qresource>
</RCC>
</RCC>
fmvip/res/img/tip_question.png
0 → 100644
View file @
d964b52f
3.04 KB
fmvip/windows/fmmsgwnd.cpp
View file @
d964b52f
#
include
"fmmsgwnd.h"
#
include
"fmmsgwnd.h"
#include "ui_fmmsgwnd.h"
#include "ui_fmmsgwnd.h"
#include <QPushButton>
#include <QDebug>
#include <QDebug>
FMMsgWnd
::
FMMsgWnd
(
QDialog
*
parent
)
:
FMMsgWnd
::
FMMsgWnd
(
QDialog
*
parent
)
:
...
@@ -10,6 +11,8 @@ FMMsgWnd::FMMsgWnd(QDialog *parent) :
...
@@ -10,6 +11,8 @@ FMMsgWnd::FMMsgWnd(QDialog *parent) :
setAttribute
(
Qt
::
WA_TranslucentBackground
);
setAttribute
(
Qt
::
WA_TranslucentBackground
);
setAttribute
(
Qt
::
WA_QuitOnClose
,
false
);
setAttribute
(
Qt
::
WA_QuitOnClose
,
false
);
this
->
setWindowFlags
(
windowFlags
()
|
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
);
this
->
setWindowFlags
(
windowFlags
()
|
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
);
connect
(
ui
->
buttonBox
,
&
QDialogButtonBox
::
accepted
,
this
,
&
FMMsgWnd
::
accept
);
connect
(
ui
->
buttonBox
,
&
QDialogButtonBox
::
rejected
,
this
,
&
FMMsgWnd
::
reject
);
}
}
FMMsgWnd
::~
FMMsgWnd
()
FMMsgWnd
::~
FMMsgWnd
()
...
@@ -17,8 +20,9 @@ FMMsgWnd::~FMMsgWnd()
...
@@ -17,8 +20,9 @@ FMMsgWnd::~FMMsgWnd()
delete
ui
;
delete
ui
;
}
}
void
FMMsgWnd
::
show
(
InfoType
type
,
const
QString
&
info
)
int
FMMsgWnd
::
_exec
(
InfoType
type
,
const
QString
&
info
)
{
{
ui
->
buttonBox
->
addButton
(
QString
::
fromLocal8Bit
(
"确认"
),
QDialogButtonBox
::
AcceptRole
);
QString
iconUrl
;
QString
iconUrl
;
switch
(
type
)
{
switch
(
type
)
{
case
T_Normal
:
case
T_Normal
:
...
@@ -37,17 +41,34 @@ void FMMsgWnd::show(InfoType type, const QString &info)
...
@@ -37,17 +41,34 @@ void FMMsgWnd::show(InfoType type, const QString &info)
ui
->
label_msg
->
setText
(
QString
::
fromLocal8Bit
(
"会员认证成功"
));
ui
->
label_msg
->
setText
(
QString
::
fromLocal8Bit
(
"会员认证成功"
));
iconUrl
=
":/img/tip_ok.png"
;
iconUrl
=
":/img/tip_ok.png"
;
break
;
break
;
case
T_Question
:
{
ui
->
buttonBox
->
addButton
(
QString
::
fromLocal8Bit
(
"取消"
),
QDialogButtonBox
::
RejectRole
);
iconUrl
=
":/img/tip_question.png"
;
break
;
}
default
:
default
:
iconUrl
=
""
;
iconUrl
=
""
;
break
;
break
;
}
}
int
btnWidth
=
ui
->
widget
->
width
()
/
ui
->
buttonBox
->
buttons
().
size
();
foreach
(
auto
btn
,
ui
->
buttonBox
->
buttons
())
{
QString
styleSheet
=
QString
(
"min-width: %1; min-height: 60;"
).
arg
(
btnWidth
);
if
(
ui
->
buttonBox
->
buttonRole
(
btn
)
==
QDialogButtonBox
::
RejectRole
)
{
styleSheet
.
append
(
"background-color: rgb(134, 134, 134);"
);
}
qDebug
()
<<
styleSheet
;
btn
->
setStyleSheet
(
styleSheet
);
}
if
(
iconUrl
!=
""
){
if
(
iconUrl
!=
""
){
ui
->
label_logo
->
setStyleSheet
(
QString
(
"border-image: url(%1);"
).
arg
(
iconUrl
));
ui
->
label_logo
->
setStyleSheet
(
QString
(
"border-image: url(%1);"
).
arg
(
iconUrl
));
}
}
ui
->
label_msg
->
setText
(
info
);
ui
->
label_msg
->
setText
(
info
);
QDialog
::
exec
();
return
QDialog
::
exec
();
}
}
void
FMMsgWnd
::
FailureWnd
(
const
QString
&
info
,
QDialog
*
parent
)
void
FMMsgWnd
::
FailureWnd
(
const
QString
&
info
,
QDialog
*
parent
)
...
@@ -56,7 +77,7 @@ void FMMsgWnd::FailureWnd(const QString &info, QDialog *parent)
...
@@ -56,7 +77,7 @@ void FMMsgWnd::FailureWnd(const QString &info, QDialog *parent)
if
(
parent
!=
nullptr
)
{
if
(
parent
!=
nullptr
)
{
window
.
setGeometry
(
parent
->
geometry
());
window
.
setGeometry
(
parent
->
geometry
());
}
}
window
.
show
(
FMMsgWnd
::
T_Failure
,
info
);
window
.
_exec
(
FMMsgWnd
::
T_Failure
,
info
);
}
}
void
FMMsgWnd
::
WarningWnd
(
const
QString
&
info
,
QDialog
*
parent
)
void
FMMsgWnd
::
WarningWnd
(
const
QString
&
info
,
QDialog
*
parent
)
{
{
...
@@ -64,7 +85,7 @@ void FMMsgWnd::WarningWnd(const QString &info, QDialog *parent)
...
@@ -64,7 +85,7 @@ void FMMsgWnd::WarningWnd(const QString &info, QDialog *parent)
if
(
parent
!=
nullptr
)
{
if
(
parent
!=
nullptr
)
{
window
.
setGeometry
(
parent
->
geometry
());
window
.
setGeometry
(
parent
->
geometry
());
}
}
window
.
show
(
FMMsgWnd
::
T_Warning
,
info
);
window
.
_exec
(
FMMsgWnd
::
T_Warning
,
info
);
}
}
void
FMMsgWnd
::
SuccessWnd
(
const
QString
&
info
,
QDialog
*
parent
)
void
FMMsgWnd
::
SuccessWnd
(
const
QString
&
info
,
QDialog
*
parent
)
{
{
...
@@ -72,7 +93,7 @@ void FMMsgWnd::SuccessWnd(const QString &info, QDialog *parent)
...
@@ -72,7 +93,7 @@ void FMMsgWnd::SuccessWnd(const QString &info, QDialog *parent)
if
(
parent
!=
nullptr
)
{
if
(
parent
!=
nullptr
)
{
window
.
setGeometry
(
parent
->
geometry
());
window
.
setGeometry
(
parent
->
geometry
());
}
}
window
.
show
(
FMMsgWnd
::
T_Success
,
info
);
window
.
_exec
(
FMMsgWnd
::
T_Success
,
info
);
}
}
void
FMMsgWnd
::
LoginSuccess
(
const
QString
&
account
,
const
QString
&
name
,
const
QString
&
birthday
,
QDialog
*
parent
)
void
FMMsgWnd
::
LoginSuccess
(
const
QString
&
account
,
const
QString
&
name
,
const
QString
&
birthday
,
QDialog
*
parent
)
...
@@ -82,10 +103,14 @@ void FMMsgWnd::LoginSuccess(const QString &account, const QString &name, const Q
...
@@ -82,10 +103,14 @@ void FMMsgWnd::LoginSuccess(const QString &account, const QString &name, const Q
window
.
setGeometry
(
parent
->
geometry
());
window
.
setGeometry
(
parent
->
geometry
());
}
}
QString
info
=
QString
::
fromLocal8Bit
(
"账号:%1
\n
姓名:%2
\n
生日:%3"
).
arg
(
account
).
arg
(
name
).
arg
(
birthday
);
QString
info
=
QString
::
fromLocal8Bit
(
"账号:%1
\n
姓名:%2
\n
生日:%3"
).
arg
(
account
).
arg
(
name
).
arg
(
birthday
);
window
.
show
(
FMMsgWnd
::
T_LoginSuccess
,
info
);
window
.
_exec
(
FMMsgWnd
::
T_LoginSuccess
,
info
);
}
}
void
FMMsgWnd
::
on_btn_confirm_clicked
(
)
int
FMMsgWnd
::
Question
(
const
QString
&
info
,
QDialog
*
parent
)
{
{
this
->
accept
();
FMMsgWnd
window
(
parent
);
if
(
parent
!=
nullptr
)
{
window
.
setGeometry
(
parent
->
geometry
());
}
return
window
.
_exec
(
FMMsgWnd
::
T_Question
,
info
);
}
}
fmvip/windows/fmmsgwnd.h
View file @
d964b52f
...
@@ -21,17 +21,16 @@ public:
...
@@ -21,17 +21,16 @@ public:
T_Success
,
T_Success
,
T_Failure
,
T_Failure
,
T_Warning
,
T_Warning
,
T_LoginSuccess
T_LoginSuccess
,
T_Question
};
};
void
show
(
InfoType
type
=
T_Normal
,
const
QString
&
info
=
""
);
int
_exec
(
InfoType
type
=
T_Normal
,
const
QString
&
info
=
""
);
static
void
FailureWnd
(
const
QString
&
info
,
QDialog
*
parent
=
0
);
static
void
FailureWnd
(
const
QString
&
info
,
QDialog
*
parent
=
0
);
static
void
WarningWnd
(
const
QString
&
info
,
QDialog
*
parent
=
0
);
static
void
WarningWnd
(
const
QString
&
info
,
QDialog
*
parent
=
0
);
static
void
SuccessWnd
(
const
QString
&
info
,
QDialog
*
parent
=
0
);
static
void
SuccessWnd
(
const
QString
&
info
,
QDialog
*
parent
=
0
);
static
void
LoginSuccess
(
const
QString
&
account
,
const
QString
&
name
,
const
QString
&
birthday
,
QDialog
*
parent
=
0
);
static
void
LoginSuccess
(
const
QString
&
account
,
const
QString
&
name
,
const
QString
&
birthday
,
QDialog
*
parent
=
0
);
static
int
Question
(
const
QString
&
info
,
QDialog
*
parent
=
0
);
private
slots
:
void
on_btn_confirm_clicked
();
private
:
private
:
Ui
::
FMMsgWnd
*
ui
;
Ui
::
FMMsgWnd
*
ui
;
...
...
fmvip/windows/forms/fmmsgwnd.ui
View file @
d964b52f
...
@@ -98,7 +98,7 @@
...
@@ -98,7 +98,7 @@
<property
name=
"styleSheet"
>
<property
name=
"styleSheet"
>
<string
notr=
"true"
>
#widget
<string
notr=
"true"
>
#widget
{
{
background-color: rgb(2
55, 255, 25
5);
background-color: rgb(2
45, 245, 24
5);
border-radius:8px;
border-radius:8px;
opacity:0;
opacity:0;
}
</string>
}
</string>
...
@@ -258,38 +258,28 @@
...
@@ -258,38 +258,28 @@
</spacer>
</spacer>
</item>
</item>
<item>
<item>
<widget
class=
"QPushButton"
name=
"btn_confirm"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"minimumSize"
>
<size>
<width>
121
</width>
<height>
62
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
16777215
</width>
<height>
62
</height>
</size>
</property>
<property
name=
"styleSheet"
>
<property
name=
"styleSheet"
>
<string
notr=
"true"
>
#btn_confirm
<string
notr=
"true"
>
QPushButton
{
{
font: 75 16pt
"
微软雅黑
"
;
font: 75 16pt
"
微软雅黑
"
;
border-bottom-right-radius: 8px;
border-radius: 8px;
border-bottom-left-radius: 8px;
background-color: rgb(93, 144, 236);
background-color: rgb(93, 144, 236);
color: rgb(255, 255, 255);
color: rgb(255, 255, 255);
}
</string>
}
</string>
</property>
</property>
<property
name=
"text"
>
<property
name=
"standardButtons"
>
<string>
确认
</string>
<set>
QDialogButtonBox::NoButton
</set>
</property>
<property
name=
"centerButtons"
>
<bool>
true
</bool>
</property>
</property>
</widget>
</widget>
</item>
</item>
</layout>
</layout>
<zorder>
verticalSpacer
</zorder>
<zorder>
verticalSpacer
</zorder>
<zorder>
verticalSpacer_2
</zorder>
<zorder>
verticalSpacer_2
</zorder>
<zorder>
b
tn_confirm
</zorder>
<zorder>
b
uttonBox
</zorder>
</widget>
</widget>
</item>
</item>
<item>
<item>
...
...
tests/testplugin/tst_testplugin.cpp
View file @
d964b52f
...
@@ -31,6 +31,8 @@ private:
...
@@ -31,6 +31,8 @@ private:
private
slots
:
private
slots
:
void
test_dotask_data
();
void
test_dotask_data
();
void
test_dotask
();
void
test_dotask
();
void
test_msgWnd
();
};
};
TestPlugin
::
TestPlugin
()
TestPlugin
::
TestPlugin
()
...
@@ -151,6 +153,12 @@ void TestPlugin::test_Sign()
...
@@ -151,6 +153,12 @@ void TestPlugin::test_Sign()
QCOMPARE
(
FMTask
::
Sign
(
jsonObj1
),
SignStr
);
QCOMPARE
(
FMTask
::
Sign
(
jsonObj1
),
SignStr
);
}
}
void
TestPlugin
::
test_msgWnd
()
{
FMMsgWnd
::
SuccessWnd
(
"Success!"
);
FMMsgWnd
::
Question
(
"确认吗?"
);
}
QTEST_MAIN
(
TestPlugin
)
QTEST_MAIN
(
TestPlugin
)
#include "tst_testplugin.moc"
#include "tst_testplugin.moc"
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