30 #include <QApplication>
31 #include <QChildEvent>
32 #include <QHBoxLayout>
34 #include <QToolButton>
35 #include <QCloseEvent>
42 : QDockWidget(name), collapsed_(false), forced_hidden_(false)
44 QWidget* title_bar =
new QWidget(
this);
46 QPalette pal(palette());
47 pal.setColor(QPalette::Window, QApplication::palette().color(QPalette::Mid));
48 title_bar->setAutoFillBackground(
true);
49 title_bar->setPalette(pal);
50 title_bar->setContentsMargins(0, 0, 0, 0);
52 QToolButton* close_button =
new QToolButton();
53 close_button->setIcon(QIcon::fromTheme(
"window-close"));
54 close_button->setIconSize(QSize(10, 10));
56 connect(close_button, &QToolButton::clicked,
this, &PanelDockWidget::close);
64 QHBoxLayout* title_layout =
new QHBoxLayout();
65 title_layout->setContentsMargins(2, 2, 2, 2);
68 title_layout->addWidget(close_button, 0);
69 title_bar->setLayout(title_layout);
70 setTitleBarWidget(title_bar);
75 QDockWidget::setWindowTitle(title);
129 QToolButton* button =
new QToolButton();
130 button->setIcon(QIcon::fromTheme(
"view-fullscreen"));
131 button->setIconSize(QSize(10, 10));
132 button->setToolTip(
"Toggle maximize");
134 dynamic_cast<QHBoxLayout*
>(titleBarWidget()->layout())->insertWidget(2, button);
139 if (windowState() & Qt::WindowMaximized)