Skip to content

Commit

Permalink
Fix #455 TimeSpinBox context menu deselects.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Oct 26, 2017
1 parent d1700a4 commit 16be5a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/widgets/timespinbox.cpp
Expand Up @@ -86,6 +86,14 @@ void TimeSpinBoxLineEdit::focusInEvent(QFocusEvent *event)
m_selectOnMousePress = true;
}

void TimeSpinBoxLineEdit::focusOutEvent(QFocusEvent* event)
{
// QLineEdit::focusOutEvent() calls deselect() on OtherFocusReason,
// which prevents using the clipboard actions with the text.
if (event->reason() != Qt::OtherFocusReason)
QLineEdit::focusOutEvent(event);
}

void TimeSpinBoxLineEdit::mousePressEvent(QMouseEvent *event)
{
QLineEdit::mousePressEvent(event);
Expand Down
3 changes: 2 additions & 1 deletion src/widgets/timespinbox.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Meltytech, LLC
* Copyright (c) 2012-2017 Meltytech, LLC
* Author: Dan Dennedy <dan@dennedy.org>
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -50,6 +50,7 @@ class TimeSpinBoxLineEdit : public QLineEdit

protected:
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
void mousePressEvent(QMouseEvent *event);

private:
Expand Down

0 comments on commit 16be5a7

Please sign in to comment.