Set additional margin to the input field without style sheet

This commit is contained in:
Ilya Fedin 2022-04-30 05:34:41 +04:00 committed by John Preston
parent 283cb25dfd
commit eb82d31c55

View file

@ -1494,10 +1494,9 @@ void InputField::setTagMimeProcessor(
} }
void InputField::setAdditionalMargin(int margin) { void InputField::setAdditionalMargin(int margin) {
_inner->setStyleSheet(
QString::fromLatin1("QTextEdit { margin: %1px; }").arg(margin));
_additionalMargin = margin; _additionalMargin = margin;
checkContentHeight(); QResizeEvent e(size(), size());
QCoreApplication::sendEvent(this, &e);
} }
void InputField::setMaxLength(int length) { void InputField::setMaxLength(int length) {
@ -3673,7 +3672,7 @@ void InputField::insertFromMimeDataInner(const QMimeData *source) {
void InputField::resizeEvent(QResizeEvent *e) { void InputField::resizeEvent(QResizeEvent *e) {
refreshPlaceholder(_placeholderFull.current()); refreshPlaceholder(_placeholderFull.current());
_inner->setGeometry(rect().marginsRemoved(_st.textMargins)); _inner->setGeometry(rect().marginsRemoved(_st.textMargins + _additionalMargin));
_borderAnimationStart = width() / 2; _borderAnimationStart = width() / 2;
RpWidget::resizeEvent(e); RpWidget::resizeEvent(e);
checkContentHeight(); checkContentHeight();