mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #3182
PKEv (1): feat(emoticonswidget):Keep emoticon option open
This commit is contained in:
commit
ddca97a896
|
@ -126,9 +126,6 @@ EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
|
||||||
|
|
||||||
void EmoticonsWidget::onSmileyClicked()
|
void EmoticonsWidget::onSmileyClicked()
|
||||||
{
|
{
|
||||||
// hide the QMenu
|
|
||||||
hide();
|
|
||||||
|
|
||||||
// emit insert emoticon
|
// emit insert emoticon
|
||||||
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
|
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
|
||||||
if (sender)
|
if (sender)
|
||||||
|
@ -193,3 +190,10 @@ void EmoticonsWidget::PageButtonsUpdate()
|
||||||
t_pageButton->setChecked(false);
|
t_pageButton->setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmoticonsWidget::keyPressEvent(QKeyEvent *e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e)
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ protected:
|
||||||
void mouseReleaseEvent(QMouseEvent *ev) final override;
|
void mouseReleaseEvent(QMouseEvent *ev) final override;
|
||||||
void mousePressEvent(QMouseEvent *ev) final override;
|
void mousePressEvent(QMouseEvent *ev) final override;
|
||||||
void wheelEvent(QWheelEvent * event) final override;
|
void wheelEvent(QWheelEvent * event) final override;
|
||||||
|
void keyPressEvent(QKeyEvent *e) final override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStackedWidget stack;
|
QStackedWidget stack;
|
||||||
|
|
|
@ -368,6 +368,7 @@ void GenericChatForm::onEmoteButtonClicked()
|
||||||
|
|
||||||
EmoticonsWidget widget;
|
EmoticonsWidget widget;
|
||||||
connect(&widget, SIGNAL(insertEmoticon(QString)), this, SLOT(onEmoteInsertRequested(QString)));
|
connect(&widget, SIGNAL(insertEmoticon(QString)), this, SLOT(onEmoteInsertRequested(QString)));
|
||||||
|
widget.installEventFilter(this);
|
||||||
|
|
||||||
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
|
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
|
||||||
if (sender)
|
if (sender)
|
||||||
|
@ -500,6 +501,15 @@ void GenericChatForm::resizeEvent(QResizeEvent* event)
|
||||||
|
|
||||||
bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
|
bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
|
||||||
{
|
{
|
||||||
|
EmoticonsWidget * ev = qobject_cast<EmoticonsWidget *>(object);
|
||||||
|
if (( ev) && (event->type() == QEvent::KeyPress) )
|
||||||
|
{
|
||||||
|
QKeyEvent* key = static_cast<QKeyEvent*>(event);
|
||||||
|
msgEdit->sendKeyEvent(key);
|
||||||
|
msgEdit->setFocus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (object != this->fileButton && object != this->fileFlyout)
|
if (object != this->fileButton && object != this->fileFlyout)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,10 @@ void ChatTextEdit::keyPressEvent(QKeyEvent * event)
|
||||||
if (event->modifiers())
|
if (event->modifiers())
|
||||||
event->ignore();
|
event->ignore();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
emit tabPressed();
|
emit tabPressed();
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (key == Qt::Key_Up && this->toPlainText().isEmpty())
|
else if (key == Qt::Key_Up && this->toPlainText().isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -69,3 +72,8 @@ void ChatTextEdit::retranslateUi()
|
||||||
{
|
{
|
||||||
setPlaceholderText(tr("Type your message here..."));
|
setPlaceholderText(tr("Type your message here..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatTextEdit::sendKeyEvent(QKeyEvent * event)
|
||||||
|
{
|
||||||
|
emit keyPressEvent(event);
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ public:
|
||||||
explicit ChatTextEdit(QWidget *parent = 0);
|
explicit ChatTextEdit(QWidget *parent = 0);
|
||||||
~ChatTextEdit();
|
~ChatTextEdit();
|
||||||
void setLastMessage(QString lm);
|
void setLastMessage(QString lm);
|
||||||
|
void sendKeyEvent(QKeyEvent * event);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void enterPressed();
|
void enterPressed();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user