| 11 | |
| 12 | |
| 13 | WizNotifyBar::WizNotifyBar(QWidget *parent) |
| 14 | : QWidget(parent) |
| 15 | , m_type(NoNotify) |
| 16 | , m_childWgt(new QWidget(this)) |
| 17 | { |
| 18 | QVBoxLayout* layout = new QVBoxLayout(); |
| 19 | layout->setContentsMargins(0, 0, 0, 0); // On most platforms, the margin is 11 pixels in all directions. |
| 20 | layout->setSpacing(0); |
| 21 | setLayout(layout); |
| 22 | |
| 23 | m_spacer = new QLabel(this); |
| 24 | m_spacer->setFixedHeight(2); |
| 25 | m_spacer->setText(QString()); |
| 26 | layout->addWidget(m_spacer); |
| 27 | |
| 28 | //Q_OBJECT标志与stylesheet不能共存,创建一个子Widget来调整样式 |
| 29 | QHBoxLayout* childLayout = new QHBoxLayout(); |
| 30 | childLayout->setContentsMargins(12, 5, 12, 5); // On most platforms, the margin is 11 pixels in all directions. |
| 31 | childLayout->setSpacing(15); |
| 32 | m_childWgt->setLayout(childLayout); |
| 33 | layout->addWidget(m_childWgt); |
| 34 | |
| 35 | m_labelNotify = new QLabel(this); |
| 36 | m_labelNotify->setAttribute(Qt::WA_NoSystemBackground, true); |
| 37 | m_labelNotify->setAlignment(Qt::AlignVCenter); |
| 38 | m_buttonCloseRed = new WizImageButton(this); |
| 39 | m_buttonCloseRed->setMaximumSize(8, 8); |
| 40 | m_buttonCloseRed->setIcon(Utils::WizStyleHelper::loadIcon("closeNotifyBarRed")); |
| 41 | m_buttonCloseRed->setLockNormalStatus(true); |
| 42 | m_buttonCloseBlue = new WizImageButton(this); |
| 43 | m_buttonCloseBlue->setMaximumSize(8, 8); |
| 44 | m_buttonCloseBlue->setIcon(Utils::WizStyleHelper::loadIcon("closeNotifyBarBlue")); |
| 45 | m_buttonCloseBlue->setLockNormalStatus(true); |
| 46 | childLayout->addWidget(m_labelNotify); |
| 47 | childLayout->addStretch(); |
| 48 | childLayout->addWidget(m_buttonCloseRed); |
| 49 | childLayout->addWidget(m_buttonCloseBlue); |
| 50 | showCloseButton(false); |
| 51 | |
| 52 | connect(m_labelNotify, SIGNAL(linkActivated(QString)), SIGNAL(labelLink_clicked(QString))); |
| 53 | connect(m_buttonCloseRed, SIGNAL(clicked()), SLOT(on_closeButton_Clicked())); |
| 54 | connect(m_buttonCloseBlue, SIGNAL(clicked()), SLOT(on_closeButton_Clicked())); |
| 55 | |
| 56 | setMaximumHeight(0); |
| 57 | m_animation = new QPropertyAnimation(this, "maximumHeight", this); |
| 58 | |
| 59 | applyStyleSheet(false); |
| 60 | } |
| 61 | |
| 62 | void WizNotifyBar::showPermissionNotify(int type) |
| 63 | { |
nothing calls this directly
no test coverage detected