forked from yydcaib/TCPClient
修改了一些bug
This commit is contained in:
parent
bcd54b6d7a
commit
c3eb7638da
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 6.0.2, 2023-01-09T16:16:43. -->
|
||||
<!-- Written by QtCreator 6.0.2, 2023-01-09T18:43:00. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
|
|
@ -8,6 +8,7 @@ Login::Login(QWidget *parent) :
|
|||
/**********ui_init**********/
|
||||
ui->setupUi(this);
|
||||
this->setWindowIcon(QIcon(":/icon.png"));
|
||||
this->setTabOrder(ui->lineEdit_username,ui->lineEdit_password);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint); //无边框
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
new_closebutton(ui->close_btn,":/close.png", QSize(30, 30));
|
||||
|
|
|
@ -87,6 +87,7 @@ void MainWidget::on_save_btn_clicked()
|
|||
stream << str;
|
||||
//关闭文件
|
||||
file.close();
|
||||
QMessageBox::information(this,"保存聊天记录","保存成功!");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -100,6 +101,7 @@ void MainWidget::on_save_btn_clicked()
|
|||
stream << str;
|
||||
//关闭文件
|
||||
file.close();
|
||||
QMessageBox::information(this,"保存聊天记录","保存成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,9 +132,19 @@ void MainWidget::on_send_btn_clicked()
|
|||
QString data_text = insert + text.mid(n,-1);
|
||||
QString text_self = QString("私发给%1:%2").arg(to_user).arg(text.mid(n));
|
||||
qDebug() << text_self;
|
||||
if(to_user == username)
|
||||
int index = 0;
|
||||
for (index = 0; index < ui->name_list->count(); index++)
|
||||
{
|
||||
QMessageBox::critical(this,"错误","不能自己给自己发送消息!");
|
||||
if(username ==ui->name_list->item(index)->text())
|
||||
{
|
||||
QMessageBox::critical(this,"错误","不能自己给自己发送消息!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(index >= ui->name_list->count())
|
||||
{
|
||||
QMessageBox::critical(this,"错误","未找到指定用户!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue