更新防区按钮控件

master
feiyangqingyun 2020-07-04 10:01:37 +08:00
parent 0b3bdf7733
commit 79452c6423
22 changed files with 72 additions and 10 deletions

View File

@ -180,7 +180,7 @@ void ButtonDefence::setButtonStyle(const ButtonDefence::ButtonStyle &buttonStyle
} else if (buttonStyle == ButtonStyle_Msg2) {
type = "msg2";
} else {
type = "circle";
type = "custom";
}
setButtonStatus(buttonStatus);

View File

@ -3,12 +3,12 @@
/**
* :feiyangqingyun(QQ:517216493) 2018-7-2
* 1: 22
* 2:
* 3:
* 4:
* 5:
* 6:
* 1. 22
* 2.
* 3.
* 4.
* 5.
* 6.
*/
#include <QWidget>
@ -37,14 +37,16 @@ class ButtonDefence : public QWidget
Q_PROPERTY(ButtonStatus buttonStatus READ getButtonStatus WRITE setButtonStatus)
public:
//防区样式 圆形、警察、气泡、气泡2、消息、消息2
//防区样式 圆形、警察、气泡、气泡2、消息、消息2、自定义
//如果设置的自定义的,则图片拓展名 btn_defence_alarm_custom
enum ButtonStyle {
ButtonStyle_Circle = 0,
ButtonStyle_Police = 1,
ButtonStyle_Bubble = 2,
ButtonStyle_Bubble2 = 3,
ButtonStyle_Msg = 4,
ButtonStyle_Msg2 = 5
ButtonStyle_Msg2 = 5,
ButtonStyle_Custom = 6
};
//防区状态 布防、撤防、报警、旁路、故障

View File

@ -31,7 +31,7 @@ void frmButtonDefence::initForm()
btn3->setText("#3");
btn3->setGeometry(85, 5, 35, 35);
btnStyle << ui->btnCircle << ui->btnPolice << ui->btnBubble << ui->btnBubble2 << ui->btnMsg << ui->btnMsg2;
btnStyle << ui->btnCircle << ui->btnPolice << ui->btnBubble << ui->btnBubble2 << ui->btnMsg << ui->btnMsg2 << ui->btnCustom;
foreach (QPushButton *btn, btnStyle) {
connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeStyle()));
}
@ -50,6 +50,16 @@ void frmButtonDefence::changeStyle()
btn1->setButtonStyle(style);
btn2->setButtonStyle(style);
btn3->setButtonStyle(style);
if (index == 6) {
btn1->setText("");
btn2->setText("");
btn3->setText("");
} else {
btn1->setText("#1");
btn2->setText("#2");
btn3->setText("#3");
}
}
void frmButtonDefence::changeStatus()
@ -69,3 +79,10 @@ void frmButtonDefence::on_ckCanMove_stateChanged(int arg1)
btn2->setCanMove(canMove);
btn3->setCanMove(canMove);
}
void frmButtonDefence::on_btnPoint_clicked()
{
qDebug() << "btn1" << "x" << btn1->geometry().x() << "y" << btn1->geometry().y();
qDebug() << "btn2" << "x" << btn2->geometry().x() << "y" << btn2->geometry().y();
qDebug() << "btn3" << "x" << btn3->geometry().x() << "y" << btn3->geometry().y();
}

View File

@ -25,6 +25,8 @@ private slots:
void changeStatus();
void on_ckCanMove_stateChanged(int arg1);
void on_btnPoint_clicked();
private:
Ui::frmButtonDefence *ui;
ButtonDefence *btn1;

View File

@ -87,6 +87,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCustom">
<property name="text">
<string>自定义</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
@ -129,6 +136,13 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ckCanMove">
<property name="text">
@ -136,6 +150,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnPoint">
<property name="text">
<string>坐标</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -155,6 +176,21 @@
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>btnCircle</tabstop>
<tabstop>btnPolice</tabstop>
<tabstop>btnBubble</tabstop>
<tabstop>btnBubble2</tabstop>
<tabstop>btnMsg</tabstop>
<tabstop>btnMsg2</tabstop>
<tabstop>btnCustom</tabstop>
<tabstop>btnArming</tabstop>
<tabstop>btnDisarming</tabstop>
<tabstop>btnAlarm</tabstop>
<tabstop>btnBypass</tabstop>
<tabstop>btnError</tabstop>
<tabstop>ckCanMove</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 B

View File

@ -31,5 +31,10 @@
<file>image/btn_defence_error_msg2.png</file>
<file>image/btn_defence_error_police.png</file>
<file>image/bg_call.jpg</file>
<file>image/btn_defence_alarm_custom.png</file>
<file>image/btn_defence_arming_custom.png</file>
<file>image/btn_defence_bypass_custom.png</file>
<file>image/btn_defence_disarming_custom.png</file>
<file>image/btn_defence_error_custom.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB