14#include "kddockwidgets/core/DockWidget.h"
15#include "kddockwidgets/core/SideBar.h"
16#include "kddockwidgets/core/MainWindow.h"
17#include "core/DockWidget_p.h"
22#include <QAbstractButton>
24#include <QStyleOptionToolButton>
30class SideBarButton::Private
43 std::vector<KDBindings::ScopedConnection> m_connections;
49 , SideBarViewInterface(controller)
55 if (m_sideBar->isVertical())
60 m_layout->setSpacing(1);
61 m_layout->setContentsMargins(0, 0, 0, 0);
62 m_layout->addStretch();
67 auto button = createButton(dw,
this);
68 button->setText(dw->
title());
70 button->d->m_connections.push_back(dw->
d->titleChanged.connect(&SideBarButton::setText, button));
71 button->d->m_connections.push_back(dw->
d->isOverlayedChanged.connect([button] { button->update(); }));
75 connect(button, &SideBarButton::clicked,
this, [
this, dw] { m_sideBar->onButtonClicked(dw); });
77 const int count = m_layout->count();
78 m_layout->insertWidget(count - 1, button);
87 SideBar *parent)
const
94 , d(new Private(dw, parent->sideBar()))
105 return d->m_sideBar->isVertical();
110 if (!d->m_dockWidget) {
148 p.drawPixmap(
rect(), pixmap);
void connect(T &&future, QObjectSubclass *context, Callback func)
void destroyed(QObject *obj)
qreal devicePixelRatioF() const const
void fill(const QColor &color)
void setDevicePixelRatio(qreal scaleFactor)
QRect adjusted(int dx1, int dy1, int dx2, int dy2) const const
QRect transposed() const const
QSize transposed() const const