Commit 6b146066 authored by Michal Srb's avatar Michal Srb Committed by Sven Brauch

Fix VariableToolTip auto resizing.

Summary:
The VariableToolTip is supposed to resize vertically as much as can fit
in the window whenever the content changes. It was not working because
the m_itemHeight was 0 which was because the QTreeView::indexRowSizeHint
was called with index from m_model instead of m_proxy.

Same for the initial selection below.

Test Plan:
Debug some program, stop execution and hover over some variable. Expand
some subitems - the tooltip should be resizing.

Reviewers: #kdevelop, kfunk

Reviewed By: #kdevelop, kfunk

Subscribers: kfunk, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D14879
parent 4fb46558
......@@ -121,16 +121,16 @@ VariableToolTip::VariableToolTip(QWidget* parent, const QPoint& position,
m_view->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
l->addWidget(m_view);
m_itemHeight = m_view->indexRowSizeHint(m_model->indexForItem(m_var, 0));
QModelIndex varIndex = m_proxy->mapFromSource(m_model->indexForItem(m_var, 0));
m_itemHeight = m_view->indexRowSizeHint(varIndex);
connect(m_view->verticalScrollBar(),
&QScrollBar::rangeChanged,
this,
&VariableToolTip::slotRangeChanged);
m_selection = m_view->selectionModel();
m_selection->select(m_model->indexForItem(m_var, 0),
QItemSelectionModel::Rows
| QItemSelectionModel::ClearAndSelect);
m_selection->select(varIndex,
QItemSelectionModel::Rows | QItemSelectionModel::ClearAndSelect);
QHBoxLayout* buttonBox = new QHBoxLayout();
buttonBox->setContentsMargins(11, 0, 11, 6);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment