forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.6'
Conflicts: dist/gdb/Makefile.osx src/libs/qmldebug/qmldebug.qbs src/plugins/android/androidsettingswidget.cpp Change-Id: I85627130b575f7d08f416dea52031fa72019b217
This commit is contained in:
@@ -252,6 +252,7 @@ public:
|
||||
QPointer<GenericProposalInfoFrame> m_infoFrame;
|
||||
QTimer m_infoTimer;
|
||||
CodeAssistant *m_assistant;
|
||||
bool m_autoWidth;
|
||||
|
||||
public slots:
|
||||
void handleActivation(const QModelIndex &modelIndex);
|
||||
@@ -266,6 +267,7 @@ GenericProposalWidgetPrivate::GenericProposalWidgetPrivate(QWidget *completionWi
|
||||
, m_explicitlySelected(false)
|
||||
, m_justInvoked(false)
|
||||
, m_assistant(0)
|
||||
, m_autoWidth(true)
|
||||
{
|
||||
connect(m_completionListView, SIGNAL(activated(QModelIndex)),
|
||||
this, SLOT(handleActivation(QModelIndex)));
|
||||
@@ -330,6 +332,10 @@ GenericProposalWidget::GenericProposalWidget()
|
||||
d->m_completionListView->setMinimumSize(1, 1);
|
||||
connect(d->m_completionListView->verticalScrollBar(), SIGNAL(valueChanged(int)),
|
||||
this, SLOT(updatePositionAndSize()));
|
||||
connect(d->m_completionListView->verticalScrollBar(), SIGNAL(sliderPressed()),
|
||||
this, SLOT(turnOffAutoWidth()));
|
||||
connect(d->m_completionListView->verticalScrollBar(), SIGNAL(sliderReleased()),
|
||||
this, SLOT(turnOnAutoWidth()));
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
@@ -494,6 +500,9 @@ bool GenericProposalWidget::updateAndCheck(const QString &prefix)
|
||||
|
||||
void GenericProposalWidget::updatePositionAndSize()
|
||||
{
|
||||
if (!d->m_autoWidth)
|
||||
return;
|
||||
|
||||
const QSize &shint = d->m_completionListView->calculateSize();
|
||||
const int fw = frameWidth();
|
||||
const int width = shint.width() + fw * 2 + 30;
|
||||
@@ -514,6 +523,17 @@ void GenericProposalWidget::updatePositionAndSize()
|
||||
setGeometry(pos.x(), pos.y(), width, height);
|
||||
}
|
||||
|
||||
void GenericProposalWidget::turnOffAutoWidth()
|
||||
{
|
||||
d->m_autoWidth = false;
|
||||
}
|
||||
|
||||
void GenericProposalWidget::turnOnAutoWidth()
|
||||
{
|
||||
d->m_autoWidth = true;
|
||||
updatePositionAndSize();
|
||||
}
|
||||
|
||||
bool GenericProposalWidget::eventFilter(QObject *o, QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::FocusOut) {
|
||||
|
||||
Reference in New Issue
Block a user