Commit 5179eaa9 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Make quickopen sizing like other hud dialogs

parent cade655d
......@@ -93,9 +93,6 @@ void QuickDialog::updateViewGeometry()
if (!m_mainWindow)
return;
m_treeView.resizeColumnToContents(0);
m_treeView.resizeColumnToContents(1);
const QSize centralSize = m_mainWindow->size();
// width: 2.4 of editor, height: 1/2 of editor
......
......@@ -396,19 +396,11 @@ void KateQuickOpen::updateViewGeometry()
// width: 2.4 of editor, height: 1/2 of editor
const QSize viewMaxSize(centralSize.width() / 2.4, centralSize.height() / 2);
const int rowHeight = m_listView->sizeHintForRow(0) == -1 ? 0 : m_listView->sizeHintForRow(0);
const int width = viewMaxSize.width();
const QSize viewSize(std::max(300, width), // never go below this
std::min(std::max(rowHeight * m_base_model->rowCount() + 2, rowHeight * 6), viewMaxSize.height()));
// Position should be central over window
const int xPos = std::max(0, (centralSize.width() - viewSize.width()) / 2);
const int yPos = std::max(0, (centralSize.height() - viewSize.height()) * 1 / 4);
// fix position and size
const int xPos = std::max(0, (centralSize.width() - viewMaxSize.width()) / 2);
const int yPos = std::max(0, (centralSize.height() - viewMaxSize.height()) * 1 / 4);
const QPoint p(xPos, yPos);
move(p + m_mainWindow->pos());
setFixedSize(viewSize);
setFixedSize(viewMaxSize);
}
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