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:
Tvangeste 2013-01-28 14:41:30 +01:00
parent a89299c2e3
commit 735a35523e
2 changed files with 14 additions and 3 deletions

View file

@ -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();

View file

@ -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());