some minor popup tuning

This commit is contained in:
mae
2010-04-09 14:15:21 +02:00
parent 0c7312e05d
commit 1a772c1b31
2 changed files with 6 additions and 9 deletions

View File

@@ -43,6 +43,7 @@
#include <QtGui/QLabel>
#include <QtGui/QStylePainter>
#include <QtGui/QToolTip>
#include <QtCore/QTimer>
#include <limits.h>
@@ -300,30 +301,24 @@ void CompletionListView::maybeShowInfoTip()
QRect r = rectForIndex(current);
m_infoFrame->move(
(parentWidget()->mapToGlobal(
parentWidget()->rect().topRight() + QPoint(2, 0))).x(),
parentWidget()->rect().topRight() + QPoint(0, 0))).x(),
mapToGlobal(r.topRight()).y() - verticalOffset()
);
m_infoFrame->setText(infoTip);
m_infoFrame->adjustSize();
m_infoFrame->show();
m_infoFrame->raise();
}
void CompletionListView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{
QListView::currentChanged(current, previous);
if (isVisible())
maybeShowInfoTip();
QTimer::singleShot(0, this, SLOT(maybeShowInfoTip()));
}
bool CompletionListView::event(QEvent *e)
{
if (e->type() == QEvent::Show) {
bool b = QListView::event(e);
maybeShowInfoTip();
return b;
}
if (m_blockFocusOut)
return QListView::event(e);

View File

@@ -101,7 +101,9 @@ private:
void setCompletionItems(const QList<TextEditor::CompletionItem> &completionitems);
void keyboardSearch(const QString &search);
void closeList(const QModelIndex &index);
private slots:
void maybeShowInfoTip();
private:
bool m_blockFocusOut;
bool m_quickFix;