Commit d60a4b65 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

keep old size computation

parent 480a1042
......@@ -31,7 +31,6 @@
#include <QLabel>
#include <QPainter>
#include <QPointer>
#include <QPropertyAnimation>
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QStyledItemDelegate>
......@@ -369,17 +368,24 @@ void KateQuickOpen::slotListModeChanged(KateQuickOpenModel::List mode)
void KateQuickOpen::updateViewGeometry()
{
const QSize centralSize = parentWidget()->size();
const QSize centralSize = m_mainWindow->size();
// 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() - viewMaxSize.width()) / 2);
const int yPos = std::max(0, (centralSize.height() - viewMaxSize.height()) * 1 / 4);
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 QPoint p(xPos, yPos);
move(p + parentWidget()->pos());
setFixedSize(viewMaxSize);
move(p + m_mainWindow->pos());
setFixedSize(viewSize);
}
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