Commit 03fb4b49 authored by Janet Blackquill's avatar Janet Blackquill 🌈
Browse files

[kstyle]: Don't attempt to adjust contentsMargins on QMainWindows

For most applications, this isn't necessary as they rarely draw in the top pixel,
and implementing this safely is problematic.

BUG: 432246
parent 471839bc
......@@ -58,20 +58,12 @@ namespace Breeze {
Q_ASSERT(window);
int itemHeight = window->menuWidget() ? window->menuWidget()->height() : 0;
for (auto item : _windows[const_cast<QMainWindow*>(window)]) {
for (auto item : _windows[window]) {
if (!item.isNull() && item->isVisible() && window->toolBarArea(item) == Qt::TopToolBarArea) {
itemHeight = qMax(item->mapTo(window, item->rect().bottomLeft()).y(), itemHeight);
}
}
if (itemHeight == 0 && !(window->property(PropertyNames::noSeparator).toBool()) && !window->isFullScreen()) {
auto win = const_cast<QMainWindow*>(window);
win->setContentsMargins(0, 1, 0, 0);
} else {
auto win = const_cast<QMainWindow*>(window);
win->setContentsMargins(0, 0, 0, 0);
}
return QRect(0, 0, window->width(), itemHeight);
}
......
......@@ -31,7 +31,7 @@ namespace Breeze {
private:
Helper* _helper;
QHash<QMainWindow*,QVector<QPointer<QToolBar>>> _windows;
QHash<const QMainWindow*,QVector<QPointer<QToolBar>>> _windows;
KSharedConfigPtr _config;
KConfigWatcher::Ptr _watcher;
QPalette _palette = QPalette();
......
Supports Markdown
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