diff --git a/InstructorsAndTrainees/messanger/messangerwidget.ui b/InstructorsAndTrainees/messanger/messangerwidget.ui index ee2f81b..98d8420 100644 --- a/InstructorsAndTrainees/messanger/messangerwidget.ui +++ b/InstructorsAndTrainees/messanger/messangerwidget.ui @@ -23,7 +23,7 @@ - + QLayout::SetDefaultConstraint @@ -42,7 +42,7 @@ - 1 + 0 @@ -59,7 +59,7 @@ - + QLayout::SetDefaultConstraint @@ -86,46 +86,42 @@ - - - - - - 0 - 0 - - - - - 65 - 54 - - - - - 1000 - 1000 - - - - Send - - - - :/resources/icons/sendMsg.png:/resources/icons/sendMsg.png - - - - 32 - 32 - - - - Qt::ToolButtonTextUnderIcon - - - - + + + + 0 + 0 + + + + + 65 + 54 + + + + + 1000 + 1000 + + + + Send + + + + :/resources/icons/sendMsg.png:/resources/icons/sendMsg.png + + + + 32 + 32 + + + + Qt::ToolButtonTextUnderIcon + + diff --git a/InstructorsAndTrainees/messanger/msgwidget.cpp b/InstructorsAndTrainees/messanger/msgwidget.cpp index c465b72..70b387c 100644 --- a/InstructorsAndTrainees/messanger/msgwidget.cpp +++ b/InstructorsAndTrainees/messanger/msgwidget.cpp @@ -90,8 +90,8 @@ void MsgWidget::on_editText_textChanged() if(textRect.width() > widthEdit) {//Не помещается в одну строку - textRect = metricsFont.boundingRect(QRect(0, 0, widthEdit, 1000), 0, text); + textRect = metricsFont.boundingRect(QRect(0, 0, widthEdit, 1000), 0, text); if(textRect.width() > widthEdit) { @@ -109,13 +109,12 @@ void MsgWidget::on_editText_textChanged() { this->setFixedHeight(textRect.height() + X + 20 + 30); ui->editText->setFixedHeight(textRect.height() + X); - } } else {//В одну строку + this->setFixedHeight(textRect.height() + X + 20 + 30); ui->editText->setFixedWidth(textRect.width() + X); ui->editText->setFixedHeight(textRect.height() + X); - this->setFixedHeight(textRect.height() + X + 20 + 30); } } diff --git a/InstructorsAndTrainees/messanger/msgwidget.h b/InstructorsAndTrainees/messanger/msgwidget.h index c746a94..08b27d4 100644 --- a/InstructorsAndTrainees/messanger/msgwidget.h +++ b/InstructorsAndTrainees/messanger/msgwidget.h @@ -23,14 +23,15 @@ public: explicit MsgWidget(QString avatar, AligneAvatar aligneAvatar, int width, QWidget *parent = nullptr); ~MsgWidget(); - void setAligneAvatarLeft(); - void setAligneAvatarRight(); - void setAvatar(QString avatar); - void setWidth(int width); - void setText(QString text); void setTime(QString timeStr); +private: + void setAligneAvatarLeft(); + void setAligneAvatarRight(); + void setAvatar(QString avatar); + void setWidth(int width); + private slots: void on_editText_textChanged();