forked from qt-creator/qt-creator
some minor popup tuning
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QStylePainter>
|
#include <QtGui/QStylePainter>
|
||||||
#include <QtGui/QToolTip>
|
#include <QtGui/QToolTip>
|
||||||
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
@@ -300,30 +301,24 @@ void CompletionListView::maybeShowInfoTip()
|
|||||||
QRect r = rectForIndex(current);
|
QRect r = rectForIndex(current);
|
||||||
m_infoFrame->move(
|
m_infoFrame->move(
|
||||||
(parentWidget()->mapToGlobal(
|
(parentWidget()->mapToGlobal(
|
||||||
parentWidget()->rect().topRight() + QPoint(2, 0))).x(),
|
parentWidget()->rect().topRight() + QPoint(0, 0))).x(),
|
||||||
mapToGlobal(r.topRight()).y() - verticalOffset()
|
mapToGlobal(r.topRight()).y() - verticalOffset()
|
||||||
);
|
);
|
||||||
m_infoFrame->setText(infoTip);
|
m_infoFrame->setText(infoTip);
|
||||||
m_infoFrame->adjustSize();
|
m_infoFrame->adjustSize();
|
||||||
m_infoFrame->show();
|
m_infoFrame->show();
|
||||||
|
m_infoFrame->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompletionListView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
void CompletionListView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||||
{
|
{
|
||||||
QListView::currentChanged(current, previous);
|
QListView::currentChanged(current, previous);
|
||||||
if (isVisible())
|
QTimer::singleShot(0, this, SLOT(maybeShowInfoTip()));
|
||||||
maybeShowInfoTip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CompletionListView::event(QEvent *e)
|
bool CompletionListView::event(QEvent *e)
|
||||||
{
|
{
|
||||||
if (e->type() == QEvent::Show) {
|
|
||||||
bool b = QListView::event(e);
|
|
||||||
maybeShowInfoTip();
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_blockFocusOut)
|
if (m_blockFocusOut)
|
||||||
return QListView::event(e);
|
return QListView::event(e);
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,9 @@ private:
|
|||||||
void setCompletionItems(const QList<TextEditor::CompletionItem> &completionitems);
|
void setCompletionItems(const QList<TextEditor::CompletionItem> &completionitems);
|
||||||
void keyboardSearch(const QString &search);
|
void keyboardSearch(const QString &search);
|
||||||
void closeList(const QModelIndex &index);
|
void closeList(const QModelIndex &index);
|
||||||
|
private slots:
|
||||||
void maybeShowInfoTip();
|
void maybeShowInfoTip();
|
||||||
|
private:
|
||||||
|
|
||||||
bool m_blockFocusOut;
|
bool m_blockFocusOut;
|
||||||
bool m_quickFix;
|
bool m_quickFix;
|
||||||
|
|||||||
Reference in New Issue
Block a user