mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
scroll fix
This commit is contained in:
parent
db4c84a222
commit
b68cc66ede
|
@ -44,7 +44,6 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
|
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
|
||||||
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
||||||
connect(newChatForm, SIGNAL(onFileTranfertInterract(QString,QString)), this, SLOT(onFileTansBtnClicked(QString,QString)));
|
connect(newChatForm, SIGNAL(onFileTranfertInterract(QString,QString)), this, SLOT(onFileTansBtnClicked(QString,QString)));
|
||||||
connect(newChatForm->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatForm::~ChatForm()
|
ChatForm::~ChatForm()
|
||||||
|
|
|
@ -137,7 +137,6 @@ GenericChatForm::GenericChatForm(QObject *parent) :
|
||||||
|
|
||||||
connect(emoteButton, SIGNAL(clicked()), this, SLOT(onEmoteButtonClicked()));
|
connect(emoteButton, SIGNAL(clicked()), this, SLOT(onEmoteButtonClicked()));
|
||||||
connect(newChatForm, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint)));
|
connect(newChatForm, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint)));
|
||||||
connect(newChatForm->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericChatForm::setName(const QString &newName)
|
void GenericChatForm::setName(const QString &newName)
|
||||||
|
@ -163,13 +162,6 @@ void GenericChatForm::onChatContextMenuRequested(QPoint pos)
|
||||||
menu.exec(pos);
|
menu.exec(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericChatForm::onSliderRangeChanged()
|
|
||||||
{
|
|
||||||
QScrollBar* scroll = newChatForm->verticalScrollBar();
|
|
||||||
if (lockSliderToBottom)
|
|
||||||
scroll->setValue(scroll->maximum());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GenericChatForm::onSaveLogClicked()
|
void GenericChatForm::onSaveLogClicked()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getSaveFileName(0, tr("Save chat log"));
|
QString path = QFileDialog::getSaveFileName(0, tr("Save chat log"));
|
||||||
|
@ -250,4 +242,8 @@ void GenericChatForm::updateChatContent()
|
||||||
lockSliderToBottom = scroll && scroll->value() == scroll->maximum();
|
lockSliderToBottom = scroll && scroll->value() == scroll->maximum();
|
||||||
|
|
||||||
newChatForm->setHtml(getHtmledMessages());
|
newChatForm->setHtml(getHtmledMessages());
|
||||||
|
if (lockSliderToBottom)
|
||||||
|
sliderPosition = scroll->maximum();
|
||||||
|
|
||||||
|
scroll->setValue(sliderPosition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,6 @@ public slots:
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void onChatContextMenuRequested(QPoint pos);
|
void onChatContextMenuRequested(QPoint pos);
|
||||||
void onSliderRangeChanged();
|
|
||||||
void onSaveLogClicked();
|
void onSaveLogClicked();
|
||||||
void onEmoteButtonClicked();
|
void onEmoteButtonClicked();
|
||||||
void onEmoteInsertRequested(QString str);
|
void onEmoteInsertRequested(QString str);
|
||||||
|
@ -74,6 +73,7 @@ protected:
|
||||||
ChatAreaWidget *newChatForm;
|
ChatAreaWidget *newChatForm;
|
||||||
int curRow;
|
int curRow;
|
||||||
bool lockSliderToBottom;
|
bool lockSliderToBottom;
|
||||||
|
int sliderPosition;
|
||||||
|
|
||||||
QList<ChatAction*> messages;
|
QList<ChatAction*> messages;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user