From b43c7d45a3209c7d6132915b9185bea3f622742a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Feb 2011 12:47:24 -0700 Subject: [PATCH] Proper fix for complete popup too high on windows 7 issue --- src/calibre/gui2/complete.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/calibre/gui2/complete.py b/src/calibre/gui2/complete.py index a3912f6ad1..c56882ac31 100644 --- a/src/calibre/gui2/complete.py +++ b/src/calibre/gui2/complete.py @@ -7,12 +7,11 @@ __docformat__ = 'restructuredtext en' from PyQt4.Qt import QLineEdit, QAbstractListModel, Qt, \ - QApplication, QCompleter, QPoint + QApplication, QCompleter from calibre.utils.icu import sort_key, lower from calibre.gui2 import NONE from calibre.gui2.widgets import EnComboBox, LineEditECM -from calibre.constants import iswindows class CompleteModel(QAbstractListModel): @@ -94,17 +93,7 @@ class MultiCompleteLineEdit(QLineEdit, LineEditECM): def text_edited(self, *args): self.update_completions() - # Calculating a manual rect is necessary as in windows 7 - # in the edit metadata dialog, the completion window is - # too high and covers the bottom of the text in the edit field - rect = self.geometry() - ld = self.layoutDirection() - pos = QPoint(0, self.height() + (3 if iswindows else 0)) - if ld == Qt.RightToLeft: - rect.moveBottomRight(pos) - else: - rect.moveBottomLeft(pos) - self._completer.complete(rect) + self._completer.complete() def update_completions(self): ' Update the list of completions ' @@ -171,6 +160,7 @@ class MultiCompleteComboBox(EnComboBox): c.setCaseSensitivity(Qt.CaseSensitive) self.dummy_model = CompleteModel(self) c.setModel(self.dummy_model) + self.lineEdit()._completer.setWidget(self) def update_items_cache(self, complete_items): self.lineEdit().update_items_cache(complete_items)