diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp index 6cbdd9f35..02e96ca92 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.cpp +++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp @@ -1168,6 +1168,7 @@ _saveTitleRequestId(0), _saveDescriptionRequestId(0) { _title.setMaxLength(MaxGroupChannelTitle); _description.setMaxLength(MaxChannelDescription); _description.resize(width() - st::boxPadding.left() - st::newGroupInfoPadding.left() - st::boxPadding.right(), _description.height()); + myEnsureResized(&_description); updateMaxHeight(); connect(&_description, SIGNAL(resized()), this, SLOT(onDescriptionResized())); diff --git a/Telegram/SourceFiles/gui/flatinput.cpp b/Telegram/SourceFiles/gui/flatinput.cpp index b736cfaf1..5f8037b05 100644 --- a/Telegram/SourceFiles/gui/flatinput.cpp +++ b/Telegram/SourceFiles/gui/flatinput.cpp @@ -532,7 +532,7 @@ void PhonePartInput::onChooseCode(const QString &code) { InputArea::InputArea(QWidget *parent, const style::InputArea &st, const QString &ph, const QString &val) : TWidget(parent), _maxLength(-1), -_inner(this, val), +_inner(this), _oldtext(val), _undoAvailable(false), @@ -589,6 +589,8 @@ _correcting(false) { _touchTimer.setSingleShot(true); connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer())); + connect(_inner.document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(onDocumentContentsChange(int,int,int))); + connect(_inner.document(), SIGNAL(contentsChanged()), this, SLOT(onDocumentContentsChanged())); connect(&_inner, SIGNAL(undoAvailable(bool)), this, SLOT(onUndoAvailable(bool))); connect(&_inner, SIGNAL(redoAvailable(bool)), this, SLOT(onRedoAvailable(bool))); if (App::wnd()) connect(&_inner, SIGNAL(selectionChanged()), App::wnd(), SLOT(updateGlobalMenu())); @@ -596,6 +598,9 @@ _correcting(false) { setCursor(style::cur_text); heightAutoupdated(); + if (!val.isEmpty()) { + _inner.setPlainText(val); + } _inner.document()->clearUndoRedoStacks(); } @@ -630,12 +635,7 @@ void InputArea::checkContentHeight() { } } -InputArea::InputAreaInner::InputAreaInner(InputArea *parent, const QString &val) : QTextEdit(parent) { - connect(document(), SIGNAL(contentsChange(int, int, int)), parent, SLOT(onDocumentContentsChange(int, int, int))); - connect(document(), SIGNAL(contentsChanged()), parent, SLOT(onDocumentContentsChanged())); - if (!val.isEmpty()) { - setPlainText(val); - } +InputArea::InputAreaInner::InputAreaInner(InputArea *parent) : QTextEdit(parent) { } bool InputArea::InputAreaInner::viewportEvent(QEvent *e) { @@ -1201,7 +1201,7 @@ void InputArea::showError() { InputField::InputField(QWidget *parent, const style::InputField &st, const QString &ph, const QString &val) : TWidget(parent), _maxLength(-1), -_inner(this, val), +_inner(this), _oldtext(val), _undoAvailable(false), @@ -1260,11 +1260,16 @@ _correcting(false) { _touchTimer.setSingleShot(true); connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer())); + connect(_inner.document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(onDocumentContentsChange(int,int,int))); + connect(_inner.document(), SIGNAL(contentsChanged()), this, SLOT(onDocumentContentsChanged())); connect(&_inner, SIGNAL(undoAvailable(bool)), this, SLOT(onUndoAvailable(bool))); connect(&_inner, SIGNAL(redoAvailable(bool)), this, SLOT(onRedoAvailable(bool))); if (App::wnd()) connect(&_inner, SIGNAL(selectionChanged()), App::wnd(), SLOT(updateGlobalMenu())); setCursor(style::cur_text); + if (!val.isEmpty()) { + _inner.setPlainText(val); + } _inner.document()->clearUndoRedoStacks(); } @@ -1272,12 +1277,7 @@ void InputField::onTouchTimer() { _touchRightButton = true; } -InputField::InputFieldInner::InputFieldInner(InputField *parent, const QString &val) : QTextEdit(parent) { - connect(document(), SIGNAL(contentsChange(int, int, int)), parent, SLOT(onDocumentContentsChange(int, int, int))); - connect(document(), SIGNAL(contentsChanged()), parent, SLOT(onDocumentContentsChanged())); - if (!val.isEmpty()) { - setPlainText(val); - } +InputField::InputFieldInner::InputFieldInner(InputField *parent) : QTextEdit(parent) { } bool InputField::InputFieldInner::viewportEvent(QEvent *e) { diff --git a/Telegram/SourceFiles/gui/flatinput.h b/Telegram/SourceFiles/gui/flatinput.h index 6c48c3169..0171bcc06 100644 --- a/Telegram/SourceFiles/gui/flatinput.h +++ b/Telegram/SourceFiles/gui/flatinput.h @@ -263,7 +263,7 @@ private: friend class InputAreaInner; class InputAreaInner : public QTextEdit { public: - InputAreaInner(InputArea *parent, const QString &val = QString()); + InputAreaInner(InputArea *parent); bool viewportEvent(QEvent *e); void focusInEvent(QFocusEvent *e); @@ -431,7 +431,7 @@ private: friend class InputFieldInner; class InputFieldInner : public QTextEdit { public: - InputFieldInner(InputField *parent, const QString &val = QString()); + InputFieldInner(InputField *parent); bool viewportEvent(QEvent *e); void focusInEvent(QFocusEvent *e);