mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Рефакт Message Item
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_Main">
|
<layout class="QVBoxLayout" name="verticalLayout_Main">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_1" stretch="0">
|
<layout class="QVBoxLayout" name="verticalLayout_Dialog" stretch="0">
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_1">
|
<widget class="QWidget" name="tab_1">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout_Input">
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -85,12 +85,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="btnSend">
|
<widget class="QToolButton" name="btnSend">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -130,8 +128,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../resources.qrc"/>
|
<include location="../resources.qrc"/>
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ void MsgWidget::on_editText_textChanged()
|
|||||||
|
|
||||||
if(textRect.width() > widthEdit)
|
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)
|
if(textRect.width() > widthEdit)
|
||||||
{
|
{
|
||||||
@@ -109,13 +109,12 @@ void MsgWidget::on_editText_textChanged()
|
|||||||
{
|
{
|
||||||
this->setFixedHeight(textRect.height() + X + 20 + 30);
|
this->setFixedHeight(textRect.height() + X + 20 + 30);
|
||||||
ui->editText->setFixedHeight(textRect.height() + X);
|
ui->editText->setFixedHeight(textRect.height() + X);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//В одну строку
|
{//В одну строку
|
||||||
|
this->setFixedHeight(textRect.height() + X + 20 + 30);
|
||||||
ui->editText->setFixedWidth(textRect.width() + X);
|
ui->editText->setFixedWidth(textRect.width() + X);
|
||||||
ui->editText->setFixedHeight(textRect.height() + X);
|
ui->editText->setFixedHeight(textRect.height() + X);
|
||||||
this->setFixedHeight(textRect.height() + X + 20 + 30);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,14 +23,15 @@ public:
|
|||||||
explicit MsgWidget(QString avatar, AligneAvatar aligneAvatar, int width, QWidget *parent = nullptr);
|
explicit MsgWidget(QString avatar, AligneAvatar aligneAvatar, int width, QWidget *parent = nullptr);
|
||||||
~MsgWidget();
|
~MsgWidget();
|
||||||
|
|
||||||
|
void setText(QString text);
|
||||||
|
void setTime(QString timeStr);
|
||||||
|
|
||||||
|
private:
|
||||||
void setAligneAvatarLeft();
|
void setAligneAvatarLeft();
|
||||||
void setAligneAvatarRight();
|
void setAligneAvatarRight();
|
||||||
void setAvatar(QString avatar);
|
void setAvatar(QString avatar);
|
||||||
void setWidth(int width);
|
void setWidth(int width);
|
||||||
|
|
||||||
void setText(QString text);
|
|
||||||
void setTime(QString timeStr);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_editText_textChanged();
|
void on_editText_textChanged();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user