mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Make the suggestion list to be internal instead of top-level window, on *nix.
This should solve the conflict between the Qt::Popup-styled Scan window and the suggestion list. Tested on Windows 7, Lubuntu (XFCE) and Mint (KDE).
This commit is contained in:
parent
a89299c2e3
commit
735a35523e
|
@ -20,7 +20,13 @@ namespace
|
|||
CompletionList::CompletionList(TranslateBox * parent) : WordList(parent),
|
||||
translateBox(parent)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
setWindowFlags(Qt::ToolTip);
|
||||
#else
|
||||
setParent( parent->window() );
|
||||
setAutoFillBackground( true );
|
||||
#endif
|
||||
|
||||
setMaximumWidth(1000);
|
||||
|
||||
connect(this, SIGNAL( activated( QModelIndex ) ),
|
||||
|
@ -250,9 +256,14 @@ void TranslateBox::showPopup()
|
|||
return;
|
||||
}
|
||||
|
||||
const QSize size(width(), word_list->preferredHeight());
|
||||
QPoint origin( 0, translate_line->y() + translate_line->height() );
|
||||
if ( word_list->isWindow() )
|
||||
origin = mapToGlobal( origin );
|
||||
else
|
||||
origin = mapToParent( origin );
|
||||
|
||||
const QRect rect(mapToGlobal( QPoint( 0, translate_line->y() + translate_line->height() ) ), size );
|
||||
const QSize size(width(), word_list->preferredHeight());
|
||||
const QRect rect( origin, size );
|
||||
|
||||
word_list->setGeometry(rect);
|
||||
word_list->show();
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
explicit WordList(QWidget * parent = 0);
|
||||
void attachFinder(WordFinder * finder);
|
||||
void setTranslateLine(QLineEdit * line)
|
||||
{ translateLine = line; }
|
||||
{ translateLine = line; setFocusProxy( translateLine ); }
|
||||
|
||||
signals:
|
||||
void statusBarMessage(QString const & message, int timeout = 0, QPixmap const & pixmap = QPixmap());
|
||||
|
|
Loading…
Reference in a new issue