mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Рефакт
This commit is contained in:
@@ -38,9 +38,9 @@ MessangerWidget *MessangerController::newWidget(QWidget *parent, User* user, QVB
|
||||
for(MessageOfMessanger msg : *list)
|
||||
{
|
||||
if(msg.flLocal)
|
||||
msgWdgt->showSendedMessage(ClientMessage(GUIclientId, QString::number(id_user), msg.text, msg.time.toString()));
|
||||
msgWdgt->showSendedMessage(ClientMessage(GUIclientId, QString::number(id_user), msg.text, msg.time.toString("hh:mm")));
|
||||
else
|
||||
msgWdgt->showReceivedMessage(ClientMessage(QString::number(id_user), GUIclientId, msg.text, msg.time.toString()));
|
||||
msgWdgt->showReceivedMessage(ClientMessage(QString::number(id_user), GUIclientId, msg.text, msg.time.toString("hh:mm")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ void MessangerController::slot_sendMessage(ClientMessage clientMessage)
|
||||
msg.time = QTime::currentTime();
|
||||
list->append(msg);
|
||||
|
||||
clientMessage.timeStr = msg.time.toString();
|
||||
clientMessage.timeStr = msg.time.toString("hh:mm");
|
||||
|
||||
for(MessangerWidget* widget : listWidgets)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ void MessangerController::slot_receiveMessage(ClientMessage clientMessage)
|
||||
msg.time = QTime::currentTime();
|
||||
list->append(msg);
|
||||
|
||||
clientMessage.timeStr = msg.time.toString();
|
||||
clientMessage.timeStr = msg.time.toString("hh:mm");
|
||||
|
||||
for(MessangerWidget* widget : listWidgets)
|
||||
{
|
||||
|
||||
@@ -90,9 +90,27 @@ void MsgWidget::on_textEdit_textChanged()
|
||||
|
||||
if(textRect.width() > widthEdit)
|
||||
{//Не помещается в одну строку
|
||||
textRect = metricsFont.boundingRect(QRect(0, 0, widthEdit, 10), Qt::TextWordWrap, text);
|
||||
ui->textEdit->setFixedHeight(textRect.height() + X);
|
||||
this->setFixedHeight(textRect.height() + X + 20 + 30);
|
||||
textRect = metricsFont.boundingRect(QRect(0, 0, widthEdit, 1000), 0, text);
|
||||
|
||||
|
||||
if(textRect.width() > widthEdit)
|
||||
{
|
||||
QRect textRect1str = metricsFont.boundingRect(QRect(0, 0, widthEdit, 1000), 0, "string");
|
||||
int ost = textRect.width() % widthEdit;
|
||||
int cnt = textRect.width() / widthEdit;
|
||||
if(ost > 0)
|
||||
cnt += 1;
|
||||
|
||||
this->setFixedHeight(textRect1str.height() * cnt + (ost? textRect1str.height() : 0) + X + 20 + 30);
|
||||
ui->textEdit->setFixedHeight(textRect1str.height() * cnt + (ost? textRect1str.height() : 0) + X);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setFixedHeight(textRect.height() + X + 20 + 30);
|
||||
ui->textEdit->setFixedHeight(textRect.height() + X);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{//В одну строку
|
||||
|
||||
Reference in New Issue
Block a user