32 #include <QPushButton>
33 #include <QToolButton>
37 #include <QScrollArea>
38 #include <QMouseEvent>
118 return this->DragState == dragState;
144 QSizePolicy ButtonSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
153 #ifndef QT_NO_TOOLTIP
156 _this->connect(
TabsMenu, SIGNAL(aboutToShow()), SLOT(onTabsMenuAboutToShow()));
162 SLOT(onTabsMenuActionTriggered(QAction*)));
190 _this->connect(
CloseButton, SIGNAL(clicked()), SLOT(onCloseButtonClicked()));
198 TabBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
200 _this->connect(
TabBar, SIGNAL(tabClosed(
int)), SLOT(markTabsMenuOutdated()));
201 _this->connect(
TabBar, SIGNAL(tabOpened(
int)), SLOT(markTabsMenuOutdated()));
202 _this->connect(
TabBar, SIGNAL(tabInserted(
int)), SLOT(markTabsMenuOutdated()));
203 _this->connect(
TabBar, SIGNAL(removingTab(
int)), SLOT(markTabsMenuOutdated()));
204 _this->connect(
TabBar, SIGNAL(tabMoved(
int,
int)), SLOT(markTabsMenuOutdated()));
205 _this->connect(
TabBar, SIGNAL(currentChanged(
int)), SLOT(onCurrentTabChanged(
int)));
206 _this->connect(
TabBar, SIGNAL(tabBarClicked(
int)), SIGNAL(tabBarClicked(
int)));
207 _this->connect(
TabBar, SIGNAL(elidedChanged(
bool)), SLOT(markTabsMenuOutdated()));
235 if (FloatingDockContainer)
238 if (TopLevelDockWidget)
262 setObjectName(
"dockAreaTitleBar");
263 d->
Layout =
new QBoxLayout(QBoxLayout::LeftToRight);
264 d->
Layout->setContentsMargins(0, 0, 0, 0);
267 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
273 setFocusPolicy(Qt::NoFocus);
309 bool hasElidedTabTitle =
false;
319 hasElidedTabTitle =
true;
323 bool visible = (hasElidedTabTitle && (
d->
TabBar->
count() > 1));
324 QMetaObject::invokeMethod(
d->
TabsMenuButton,
"setVisible", Qt::QueuedConnection, Q_ARG(
bool, visible));
346 QAction* Action = menu->addAction(Tab->icon(), Tab->text());
358 ADS_PRINT(
"CDockAreaTitleBar::onCloseButtonClicked");
383 int Index = Action->data().toInt();
397 d->
Layout->removeWidget(Button);
404 if (Actions.isEmpty())
410 for (
auto Action : Actions)
413 Button->setDefaultAction(Action);
414 Button->setAutoRaise(
true);
415 Button->setPopupMode(QToolButton::InstantPopup);
416 Button->setObjectName(Action->objectName());
417 d->
Layout->insertWidget(InsertIndex++, Button, 0);
458 Super::setVisible(Visible);
466 if (ev->button() == Qt::LeftButton)
478 Super::mousePressEvent(ev);
485 if (ev->button() == Qt::LeftButton)
487 ADS_PRINT(
"CDockAreaTitleBar::mouseReleaseEvent");
499 Super::mouseReleaseEvent(ev);
506 Super::mouseMoveEvent(ev);
543 ADS_PRINT(
"CDockAreaTitlBar::startFloating");
587 Menu.addAction(tr(
"Close Other Groups"),
d->
DockArea, SLOT(closeOtherAreas()));
588 Menu.exec(ev->globalPos());
595 d->
Layout->insertWidget(index, widget);
602 return d->
Layout->indexOf(widget);
611 setFocusPolicy(Qt::NoFocus);
618 visible = visible && this->
Visible;
623 visible = isEnabled();
626 Super::setVisible(visible);
636 QMetaObject::invokeMethod(
this,
"setVisible", Qt::QueuedConnection, Q_ARG(
bool, isEnabled()));
639 return Super::event(ev);
645 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
646 setStyleSheet(
"border: none; background: none;");