| 340 | }; |
| 341 | |
| 342 | IdealButtonBarWidget::IdealButtonBarWidget(Qt::DockWidgetArea area, const IdealDockWidget* const& dockWidgetToGroupWith, |
| 343 | QWidget* parent) |
| 344 | : QWidget(parent) |
| 345 | , m_dockWidgetToGroupWith(dockWidgetToGroupWith) |
| 346 | , m_area(area) |
| 347 | , m_corner(nullptr) |
| 348 | , m_buttonsLayout(nullptr) |
| 349 | , m_lastCheckedActionsTracker(new LastCheckedActionsTracker) |
| 350 | { |
| 351 | setContextMenuPolicy(Qt::CustomContextMenu); |
| 352 | setToolTip(i18nc("@info:tooltip", "Right click to add new tool views.")); |
| 353 | |
| 354 | m_buttonsLayout = new IdealButtonBarLayout(orientation(), this); |
| 355 | if (area == Qt::BottomDockWidgetArea) |
| 356 | { |
| 357 | auto *statusLayout = new QBoxLayout(QBoxLayout::LeftToRight, this); |
| 358 | statusLayout->setContentsMargins(0, 0, 0, 0); |
| 359 | |
| 360 | statusLayout->addLayout(m_buttonsLayout); |
| 361 | |
| 362 | m_corner = new QWidget(this); |
| 363 | auto *cornerLayout = new QBoxLayout(QBoxLayout::LeftToRight, m_corner); |
| 364 | cornerLayout->setContentsMargins(0, 0, 0, 0); |
| 365 | cornerLayout->setSpacing(0); |
| 366 | statusLayout->addWidget(m_corner); |
| 367 | } else { |
| 368 | auto *superLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); |
| 369 | superLayout->setContentsMargins(0, 0, 0, 0); |
| 370 | |
| 371 | superLayout->addLayout(m_buttonsLayout); |
| 372 | superLayout->addStretch(1); |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | QAction* IdealButtonBarWidget::addWidget(IdealDockWidget* dock, bool initiallyVisible) |
| 377 | { |