Skip to content

Commit

Permalink
Specify the correct the parent to KeyBindingEditor
Browse files Browse the repository at this point in the history
Seems that we have specified a wrong parent to KeyBindingEditor, which
had not been obvious until we switched to Qt 5, where OK/Cancel buttons
do not work because of this.

Fix #399.

BUG=#399
TEST=Manually on Qt 4.8.7 (Win), Qt 5.6.2 (Win), Qt 5.2.1 (Ubuntu 14.04)
REF_BUG=33256462
REF_CL=140696390
REF_TIME=2016-11-30T23:15:33-08:00
REF_TIME_RAW=1480576533 -0800
  • Loading branch information
yukawa committed Dec 1, 2016
1 parent 22e5d09 commit 0b7d7b3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/data/version/mozc_version_template.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

MAJOR=2
MINOR=19
BUILD=2664
BUILD=2665
REVISION=102
# This version represents the version of Mozc IME engine (converter, predictor,
# etc.). This version info is included both in the Mozc server and in the Mozc
Expand Down
10 changes: 4 additions & 6 deletions src/gui/config_dialog/keybinding_editor_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ namespace gui {

class KeyBindingEditorTriggerButton : public QPushButton {
public:
KeyBindingEditorTriggerButton(QWidget *parent,
QWidget *modal_parent) :
KeyBindingEditorTriggerButton(QWidget *parent) :
QPushButton(parent),
editor_(new KeyBindingEditor(modal_parent, this)) {
editor_(new KeyBindingEditor(parent, this)) {
editor_->setModal(true); // create a modal dialog
setFocusProxy(editor_.get());
connect(this, SIGNAL(clicked()),
Expand All @@ -65,8 +64,7 @@ class KeyBindingEditorTriggerButton : public QPushButton {
};

KeyBindingEditorDelegate::KeyBindingEditorDelegate(QObject *parent)
: QItemDelegate(parent),
modal_parent_(static_cast<QWidget *>(parent)) {}
: QItemDelegate(parent) {}

KeyBindingEditorDelegate::~KeyBindingEditorDelegate() {}

Expand All @@ -75,7 +73,7 @@ QWidget *KeyBindingEditorDelegate::createEditor(
const QStyleOptionViewItem &option,
const QModelIndex &index) const {
KeyBindingEditorTriggerButton *button
= new KeyBindingEditorTriggerButton(parent, modal_parent_);
= new KeyBindingEditorTriggerButton(parent);
CHECK(button);
connect(button->mutable_editor(), SIGNAL(accepted()),
this, SLOT(CommitAndCloseEditor()));
Expand Down
3 changes: 0 additions & 3 deletions src/gui/config_dialog/keybinding_editor_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ class KeyBindingEditorDelegate : public QItemDelegate {
private slots:
void CommitAndCloseEditor();
void CloseEditor();

private:
QWidget *modal_parent_;
};
} // gui
} // mozc
Expand Down

0 comments on commit 0b7d7b3

Please sign in to comment.