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