|
@@ -4,6 +4,7 @@
|
|
#include "CAppInfo.h"
|
|
#include "CAppInfo.h"
|
|
|
|
|
|
#include <QDesktopWidget>
|
|
#include <QDesktopWidget>
|
|
|
|
+#include <QGraphicsDropShadowEffect>
|
|
|
|
|
|
popMsgBox::popMsgBox(QWidget *parent) :
|
|
popMsgBox::popMsgBox(QWidget *parent) :
|
|
QDialog(parent),
|
|
QDialog(parent),
|
|
@@ -12,9 +13,17 @@ popMsgBox::popMsgBox(QWidget *parent) :
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
|
|
|
|
setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
|
|
setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
|
|
- setAttribute(Qt::WA_TranslucentBackground); //小部件应该具有半透明的背景
|
|
|
|
|
|
+ setAttribute(Qt::WA_TranslucentBackground);
|
|
|
|
+
|
|
|
|
|
|
setStyleSheet(g_appInfoPtr->m_sQssStr);
|
|
setStyleSheet(g_appInfoPtr->m_sQssStr);
|
|
|
|
+
|
|
|
|
+ QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect(this);
|
|
|
|
+ effect->setColor(QColor(0, 0, 0, 0.08*255));
|
|
|
|
+ effect->setOffset(g_appInfoPtr->m_fRate*2, g_appInfoPtr->m_fRate*2);
|
|
|
|
+ effect->setBlurRadius(g_appInfoPtr->m_fRate*12);
|
|
|
|
+
|
|
|
|
+ setGraphicsEffect(effect);
|
|
}
|
|
}
|
|
|
|
|
|
popMsgBox::~popMsgBox()
|
|
popMsgBox::~popMsgBox()
|
|
@@ -22,6 +31,12 @@ popMsgBox::~popMsgBox()
|
|
delete ui;
|
|
delete ui;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void popMsgBox::setBtnText(QString sBtnYesText, QString sBtnNoText)
|
|
|
|
+{
|
|
|
|
+ ui->btn_yes->setText(sBtnYesText);
|
|
|
|
+ ui->btn_no->setText(sBtnNoText);
|
|
|
|
+}
|
|
|
|
+
|
|
void popMsgBox::setMsg(QString sMsg, QString sTitle)
|
|
void popMsgBox::setMsg(QString sMsg, QString sTitle)
|
|
{
|
|
{
|
|
ui->label_pmb_content->setText(sMsg);
|
|
ui->label_pmb_content->setText(sMsg);
|
|
@@ -30,16 +45,16 @@ void popMsgBox::setMsg(QString sMsg, QString sTitle)
|
|
|
|
|
|
void popMsgBox::initUI(POP_MSG_BTN btn)
|
|
void popMsgBox::initUI(POP_MSG_BTN btn)
|
|
{
|
|
{
|
|
- int nCW = g_appInfoPtr->m_fRate*340;
|
|
|
|
|
|
+ int nCW = g_appInfoPtr->m_fRate*352;
|
|
QDesktopWidget *dekwiget = QApplication::desktop();
|
|
QDesktopWidget *dekwiget = QApplication::desktop();
|
|
- setGeometry((dekwiget->width() - nCW)/2, (dekwiget->height() - g_appInfoPtr->m_fRate*253)/2, nCW, g_appInfoPtr->m_fRate*253);
|
|
|
|
- ui->widget_pmb_bg->setGeometry(0, 0 , nCW, g_appInfoPtr->m_fRate*253);
|
|
|
|
|
|
+ setGeometry((dekwiget->width() - nCW)/2, (dekwiget->height() - g_appInfoPtr->m_fRate*265)/2, nCW, g_appInfoPtr->m_fRate*265);
|
|
|
|
+ ui->widget_pmb_bg->setGeometry(g_appInfoPtr->m_fRate*6, g_appInfoPtr->m_fRate*6 , nCW - g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*253);
|
|
ui->label_pmb_icon->setGeometry(g_appInfoPtr->m_fRate*30, g_appInfoPtr->m_fRate*30,
|
|
ui->label_pmb_icon->setGeometry(g_appInfoPtr->m_fRate*30, g_appInfoPtr->m_fRate*30,
|
|
g_appInfoPtr->m_fRate*40, g_appInfoPtr->m_fRate*40);
|
|
g_appInfoPtr->m_fRate*40, g_appInfoPtr->m_fRate*40);
|
|
ui->label_pmb_title->adjustSize();
|
|
ui->label_pmb_title->adjustSize();
|
|
ui->label_pmb_title->setGeometry(ui->label_pmb_icon->x() + ui->label_pmb_icon->width() + g_appInfoPtr->m_fRate*16, g_appInfoPtr->m_fRate*30,
|
|
ui->label_pmb_title->setGeometry(ui->label_pmb_icon->x() + ui->label_pmb_icon->width() + g_appInfoPtr->m_fRate*16, g_appInfoPtr->m_fRate*30,
|
|
ui->label_pmb_title->width(), ui->label_pmb_title->height());
|
|
ui->label_pmb_title->width(), ui->label_pmb_title->height());
|
|
- ui->label_pmb_content->setFixedWidth(nCW - ui->label_pmb_icon->x() - ui->label_pmb_icon->width() - g_appInfoPtr->m_fRate*16*2);\
|
|
|
|
|
|
+ ui->label_pmb_content->setFixedWidth(nCW - ui->label_pmb_icon->x() - ui->label_pmb_icon->width() - g_appInfoPtr->m_fRate*16*2 - g_appInfoPtr->m_fRate*12);
|
|
ui->label_pmb_content->adjustSize();
|
|
ui->label_pmb_content->adjustSize();
|
|
ui->label_pmb_content->setGeometry(ui->label_pmb_icon->x() + ui->label_pmb_icon->width() + g_appInfoPtr->m_fRate*16,
|
|
ui->label_pmb_content->setGeometry(ui->label_pmb_icon->x() + ui->label_pmb_icon->width() + g_appInfoPtr->m_fRate*16,
|
|
ui->label_pmb_title->y() + ui->label_pmb_title->height() + g_appInfoPtr->m_fRate*8,
|
|
ui->label_pmb_title->y() + ui->label_pmb_title->height() + g_appInfoPtr->m_fRate*8,
|
|
@@ -55,6 +70,17 @@ void popMsgBox::initUI(POP_MSG_BTN btn)
|
|
ui->btn_yes->y(), ui->btn_yes->width(), ui->btn_yes->height());
|
|
ui->btn_yes->y(), ui->btn_yes->width(), ui->btn_yes->height());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int popMsg(QString sMsg, QString sTitle, QWidget *parent, QString sBtnYesText, QString sBtnNoText)
|
|
|
|
+{
|
|
|
|
+ popMsgBox msgDlg(parent);
|
|
|
|
+
|
|
|
|
+ msgDlg.setMsg(sMsg, sTitle);
|
|
|
|
+ msgDlg.initUI(POP_MSG_BTN::pmb_yse_no);
|
|
|
|
+ msgDlg.setBtnText(sBtnYesText, sBtnNoText);
|
|
|
|
+
|
|
|
|
+ return msgDlg.exec();
|
|
|
|
+}
|
|
|
|
+
|
|
int popMsg(QString sMsg, QString sTitle, QWidget *parent, POP_MSG_BTN btn, int nStayTime)
|
|
int popMsg(QString sMsg, QString sTitle, QWidget *parent, POP_MSG_BTN btn, int nStayTime)
|
|
{
|
|
{
|
|
popMsgBox msgDlg(parent);
|
|
popMsgBox msgDlg(parent);
|