1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Fix addressbar dropdown is compressed

BUG: 478748
This commit is contained in:
Daozhong Ma 2023-12-31 06:35:37 +00:00
parent 827018950e
commit 435962a9ae
2 changed files with 2 additions and 31 deletions

View File

@ -119,35 +119,10 @@ void LocationCompleterView::adjustSize()
const int maxItemsCount = 12;
const int newHeight = m_view->sizeHintForRow(0) * qMin(maxItemsCount, model()->rowCount()) + 2 * m_view->frameWidth();
if (!m_resizeTimer) {
m_resizeTimer = new QTimer(this);
m_resizeTimer->setInterval(200);
connect(m_resizeTimer, &QTimer::timeout, this, [this]() {
if (m_resizeHeight > 0) {
m_view->setFixedHeight(m_resizeHeight);
setFixedHeight(sizeHint().height());
}
m_resizeHeight = -1;
});
}
if (!m_forceResize) {
if (newHeight == m_resizeHeight) {
return;
} else if (newHeight == m_view->height()) {
m_resizeHeight = -1;
return;
} else if (newHeight < m_view->height()) {
m_resizeHeight = newHeight;
m_resizeTimer->start();
return;
}
}
m_resizeHeight = -1;
m_forceResize = false;
m_view->setFixedHeight(newHeight);
setMaximumHeight(sizeHint().height());
setFixedHeight(sizeHint().height());
resize(width(), sizeHint().height());
}
bool LocationCompleterView::eventFilter(QObject* object, QEvent* event)
@ -370,7 +345,6 @@ void LocationCompleterView::close()
hide();
m_view->verticalScrollBar()->setValue(0);
m_delegate->setForceVisitItem(false);
m_forceResize = true;
Q_EMIT closed();
}

View File

@ -66,9 +66,6 @@ private:
QListView *m_view;
LocationCompleterDelegate *m_delegate;
QHBoxLayout *m_searchEnginesLayout;
int m_resizeHeight = -1;
QTimer *m_resizeTimer = nullptr;
bool m_forceResize = true;
};
#endif // LOCATIONCOMPLETERVIEW_H