⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog.cpp

📁 Qt4 程序集合
💻 CPP
字号:
#include <QtGui>#include <QtNetwork>#include "dialog.h"#include "timeserver.h"Dialog::Dialog(QWidget *parent)    : QDialog(parent),count(0){    server = new TimeServer(this);		statusLabel = new QLabel;		reqStatusLable = new QLabel;    quitButton = new QPushButton(tr("退出"));    quitButton->setAutoDefault(false);    if (!server->listen()) {        QMessageBox::critical(this, tr("多线程时间服务器"),                              tr("无法启动服务器: %1.")                              .arg(server->errorString()));        close();        return;    }    statusLabel->setText(tr("时间服务器运行在端口: %1.\n")                         .arg(server->serverPort()));    connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));    QHBoxLayout *buttonLayout = new QHBoxLayout;    buttonLayout->addStretch(1);    buttonLayout->addWidget(quitButton);    buttonLayout->addStretch(1);    QVBoxLayout *mainLayout = new QVBoxLayout;    mainLayout->addWidget(statusLabel);		mainLayout->addWidget(reqStatusLable);    mainLayout->addLayout(buttonLayout);    setLayout(mainLayout);    setWindowTitle(tr("多线程时间服务器"));}void Dialog::showResult(){	  reqStatusLable->setText(tr("第%1次请求完毕.\n").arg(++count));}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -