#include "dialog.h"
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(QString::fromLocal8Bit("设置网络参数对话框"));
setFixedSize(280, 180);
m_ipButton = new QPushButton(tr("IP"), this);
m_ipButton->setFixedSize(80, 30);
m_ipButton->move(30, 30);
m_ipLineEdit = new QLineEdit(this);
m_ipLineEdit->setReadOnly(true);
m_ipLineEdit->setAlignment(Qt::AlignHCenter);
m_ipLineEdit->setFixedSize(140, 30);
m_ipLineEdit->move(130, 30);
connect(m_ipButton, SIGNAL(clicked()), this, SLOT(slotEnterIPAddress()));
m_portButton = new QPushButton(tr("Port"), this);
m_portButton->setFixedSize(80, 30);
m_portButton->move(30, 70);
connect(m_portButton, SIGNAL(clicked()), this, SLOT(slotEnterPort()));
m_portLineEdit = new QLineEdit(this);
m_portLineEdit->setReadOnly(true);
m_portLineEdit->setAlignment(Qt::AlignHCenter);
m_portLineEdit->setFixedSize(140, 30);
m_portLineEdit->move(130, 70);
#ifdef QT_ARM_PLATFORM
/*在 Qt4 中,QDialogButtonBox 构造函数需要三个参数,其中第二个参数为布局方式,即横向或纵向排列。由于 Qt5 中已经移除了该参数,
因此在 Qt4 中需要手动指定。该语句的含义为创建一个包含确定和取消按钮的 QDialogButtonBox 控件,并将其作为子控件添加到当前窗口中。*/
m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
#else
m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
#endif
m_buttonBox->setFixedSize(180, 40);
m_buttonBox->move(30, 120);
connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
m_keypadDialog = new KeypadDialog(this);
}
QString Dialog::ip()
{
return m_ipLineEdit->text();
}
int Dialog::port()
{
return m_portLineEdit->text().toInt();
}
void Dialog::slotEnterIPAddress()
{
m_keypadDialog->setTitle("输入IP地址");
if (m_keypadDialog->exec() == QDialog::Accepted) {
m_ipLineEdit->setText(m_keypadDialog->text());
}
}
void Dialog::slotEnterPort()
{
m_keypadDialog->setTitle("输入端口号");
if (m_keypadDialog->exec() == QDialog::Accepted) {
m_portLineEdit->setText(m_keypadDialog->text());
}
}

robin861109
- 粉丝: 19
最新资源
- 人工智能系统在小学音乐歌唱教学中的应用.docx
- NOIP2016普及组复赛试题讲解c++版本ppt课件(1).ppt
- 软件公司办公室设计方案.doc
- 浅析自动化技术在机械工程中的应用问题及优化建议.docx
- 数电半导体存储器和可编程器件.pptx
- 2015年计算机二级C语言考试技巧指南.pdf
- 基于遗传算法的软件测试用例优化技术研究的开题报告.docx
- 单片机部分内功能部件介绍.pptx
- 机械CADCAM 课后习题答案.doc
- 德国孩子跟着软件学刷牙.doc
- 中小学教育信息化建设中的问题与对策.docx
- 串口调试软件实验__山东建筑大学应用软件综合实验.doc
- 大一大学计算机基础教程期末考试题.doc
- 图书管理系统软件参数.doc
- 兰州大学2021年9月《计算机组成原理》作业考核试题及答案参考9.docx
- 软件工程知识点汇总.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


