1
0
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:
sudden6 2016-04-25 19:36:09 +02:00
commit ddca97a896
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
5 changed files with 27 additions and 3 deletions

View File

@ -126,9 +126,6 @@ EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
void EmoticonsWidget::onSmileyClicked()
{
// hide the QMenu
hide();
// emit insert emoticon
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
if (sender)
@ -193,3 +190,10 @@ void EmoticonsWidget::PageButtonsUpdate()
t_pageButton->setChecked(false);
}
}
void EmoticonsWidget::keyPressEvent(QKeyEvent *e)
{
Q_UNUSED(e)
hide();
}

View File

@ -42,6 +42,7 @@ protected:
void mouseReleaseEvent(QMouseEvent *ev) final override;
void mousePressEvent(QMouseEvent *ev) final override;
void wheelEvent(QWheelEvent * event) final override;
void keyPressEvent(QKeyEvent *e) final override;
private:
QStackedWidget stack;

View File

@ -368,6 +368,7 @@ void GenericChatForm::onEmoteButtonClicked()
EmoticonsWidget widget;
connect(&widget, SIGNAL(insertEmoticon(QString)), this, SLOT(onEmoteInsertRequested(QString)));
widget.installEventFilter(this);
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
if (sender)
@ -500,6 +501,15 @@ void GenericChatForm::resizeEvent(QResizeEvent* 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)
return false;

View File

@ -45,7 +45,10 @@ void ChatTextEdit::keyPressEvent(QKeyEvent * event)
if (event->modifiers())
event->ignore();
else
{
emit tabPressed();
event->ignore();
}
}
else if (key == Qt::Key_Up && this->toPlainText().isEmpty())
{
@ -69,3 +72,8 @@ void ChatTextEdit::retranslateUi()
{
setPlaceholderText(tr("Type your message here..."));
}
void ChatTextEdit::sendKeyEvent(QKeyEvent * event)
{
emit keyPressEvent(event);
}

View File

@ -29,6 +29,7 @@ public:
explicit ChatTextEdit(QWidget *parent = 0);
~ChatTextEdit();
void setLastMessage(QString lm);
void sendKeyEvent(QKeyEvent * event);
signals:
void enterPressed();