Commit a610b630 authored by Christoph Cullmann's avatar Christoph Cullmann

Merge branch 'persistent-tool-size' into 'master'

kate: make size of persistent toolview also persistent

See merge request !31
parents 9b151a96 914a828d
......@@ -44,6 +44,7 @@
#include <QStyle>
#include <QDomDocument>
#include <QVBoxLayout>
#include <QTimer>
namespace KateMDI
{
......@@ -396,11 +397,21 @@ bool Sidebar::showWidget(ToolView *widget)
// hide other non-persistent views
QMapIterator<int, ToolView *> it(m_idToWidget);
bool unfixSize = false;
while (it.hasNext()) {
it.next();
if ((it.value() != widget) && !it.value()->persistent) {
hideWidget(it.value());
}
// lock persistents' size while show/hide reshuffle happens
// (could also make this behavior per-widget configurable)
if (it.value()->persistent) {
auto w = it.value();
auto s = w->size();
w->setMinimumSize(s);
w->setMaximumSize(s);
unfixSize = true;
}
}
setTab(m_widgetToId[widget], true);
......@@ -423,6 +434,20 @@ bool Sidebar::showWidget(ToolView *widget)
m_ownSplit->show();
widget->show();
// release persistent size again
// (later on, when all event processing has happened)
auto func = [this]() {
auto wsizes = m_ownSplit->sizes();
for (auto w : m_idToWidget) {
w->setMinimumSize(QSize(0, 0));
w->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
}
m_ownSplit->setSizes(wsizes);
};
if (unfixSize) {
QTimer::singleShot(0, this, func);
}
/**
* we are visible again!
*/
......
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