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 154 TabsMenu->setToolTipsVisible(
true);
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()));
234 FloatingWidget->
startFloating(Offset, Size, DragState,
nullptr);
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;");
static bool testConfigFlag(eConfigFlag Flag)
bool isDraggingState(eDragState dragState) const
CDockWidget * topLevelDockWidget() const
void setToolTip(QObjectPtr obj, const QString &tip)
If the flag is set each dock area has a tabs menu button.
CDockWidgetTab * tab(int Index) const
IFloatingWidget * FloatingWidget
void setButtonIcon(QAbstractButton *Button, QStyle::StandardPixmap StandarPixmap, ads::eIcon CustomIconId)
QPointer< tTitleBarButton > TabsMenuButton
DockAreaTitleBarPrivate * d
private data (pimpl)
void onUndockButtonClicked()
If the flag is set, the tabs menu button will be shown only when it is required - that means...
Declaration of DockComponentsFactory.
enables styling of focused dock widget tabs or floating widget titlebar
Declaration of classes CTitleBarButton and CSpacerWidget.
void onCloseButtonClicked()
Declaration of CDockAreaTabBar class.
Declaration of CFloatingDockContainer class.
const CDockComponentsFactory * componentsFactory()
void insertWidget(int index, QWidget *widget)
CDockManager * dockManager() const
IFloatingWidget * makeAreaFloating(const QPoint &Offset, eDragState DragState)
CDockWidgetTab * currentTab() const
QToolButton tTitleBarButton
CDockAreaTabBar * tabBar() const
virtual CDockAreaTabBar * createDockAreaTabBar(CDockAreaWidget *DockArea) const
If the flag is set each dock area has a close button.
QPointer< tTitleBarButton > UndockButton
QList< tTitleBarButton * > DockWidgetActionsButtons
virtual void mouseReleaseEvent(QMouseEvent *ev) override
Declaration of CFloatingDragPreview.
CDockAreaTitleBar(CDockAreaWidget *parent)
bool isTabOpen(int Index) const
void onTabsMenuAboutToShow()
virtual void mousePressEvent(QMouseEvent *ev) override
virtual ~CDockAreaTitleBar()
void onTabsMenuActionTriggered(QAction *Action)
void updateDockWidgetActionsButtons()
Declaration of CIconProvider.
virtual void mouseMoveEvent(QMouseEvent *ev) override
If the flag is set, the dock area close button closes the active tab, if not set, it closes the compl...
CDockAreaWidget * DockArea
void setCurrentIndex(int Index)
virtual void setVisible(bool Visible) override
If enabled, the widgets are immediately undocked into floating widgets, if disabled, only a draw preview is undocked and the real undocking is deferred until the mouse is released.
QAbstractButton * button(TitleBarButton which) const
virtual void contextMenuEvent(QContextMenuEvent *event) override
CDockOverlay * containerOverlay() const
void tabBarClicked(int index)
static int startDragDistance()
void startFloating(const QPoint &Offset)
virtual void mouseDoubleClickEvent(QMouseEvent *event) override
CDockAreaTitleBar * _this
DockAreaTitleBarPrivate(CDockAreaTitleBar *_public)
If the flag is set each dock area has an undock button.
Declaration of CDockManager class.
int indexOf(QWidget *widget) const
QPointer< tTitleBarButton > CloseButton
static bool testConfigFlag(CDockManager::eConfigFlag Flag)
void markTabsMenuOutdated()
void onCurrentTabChanged(int Index)
Declaration of CDockAreaTitleBar class.