Go to the documentation of this file.
37 #include <QMouseEvent>
39 #include <QApplication>
42 #include <QToolButton>
43 #include <QPushButton>
101 return this->DragState == dragState;
127 auto Button =
new QToolButton();
128 Button->setAutoRaise(
true);
133 return new QPushButton();
145 bool TabHasCloseButton = (ActiveTabHasCloseButton && active) | AllTabsHaveCloseButton;
146 CloseButton->setVisible(DockWidgetClosable && TabHasCloseButton);
162 template <
typename T>
228 TitleLabel->setObjectName(
"dockWidgetTabLabel");
230 _this->connect(
TitleLabel, SIGNAL(elidedChanged(
bool)), SIGNAL(elidedChanged(
bool)));
236 CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
242 int Spacing = qRound(fm.height() / 4.0);
245 QBoxLayout* Layout =
new QBoxLayout(QBoxLayout::LeftToRight);
246 Layout->setContentsMargins(2 *
Spacing,0,0,0);
247 Layout->setSpacing(0);
248 _this->setLayout(Layout);
252 Layout->addSpacing(qRound(
Spacing * 4.0 / 3.0));
253 Layout->setAlignment(Qt::AlignCenter);
265 TargetPos.rx() = qMax(TargetPos.x(), 0);
266 TargetPos.rx() = qMin(
_this->parentWidget()->rect().right() -
_this->width() + 1, TargetPos.rx());
267 _this->move(TargetPos);
276 ADS_PRINT(
"isFloating " << dockContainer->isFloating());
277 ADS_PRINT(
"areaCount " << dockContainer->dockAreaCount());
282 if (dockContainer->isFloating()
283 && (dockContainer->visibleDockAreaCount() == 1)
331 setAttribute(Qt::WA_NoMousePropagation,
true);
336 setFocusPolicy(Qt::ClickFocus);
351 if (ev->button() == Qt::LeftButton)
359 Super::mousePressEvent(ev);
367 if (ev->button() == Qt::LeftButton)
374 switch (CurrentDragState)
380 emit
moved(ev->globalPos());
392 Super::mouseReleaseEvent(ev);
402 Super::mouseMoveEvent(ev);
410 Super::mouseMoveEvent(ev);
422 auto MappedPos = mapToParent(ev->pos());
423 bool MouseOutsideBar = (MappedPos.x() < 0) || (MappedPos.x() > parentWidget()->rect().right());
450 parentWidget()->layout()->update();
469 Super::mouseMoveEvent(ev);
488 const bool isDetachable = isFloatable && isNotOnlyTabInContainer;
491 Action->setEnabled(isDetachable);
493 Action = Menu.addAction(tr(
"Close"),
this, SIGNAL(
closeRequested()));
496 Menu.exec(ev->globalPos());
515 bool UpdateFocusStyle =
false;
516 if (active && !hasFocus())
518 setFocus(Qt::OtherFocusReason);
519 UpdateFocusStyle =
true;
524 if (UpdateFocusStyle)
569 QBoxLayout* Layout = qobject_cast<QBoxLayout*>(layout());
579 d->
IconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
581 Layout->insertWidget(0,
d->
IconLabel, Qt::AlignVCenter);
582 Layout->insertSpacing(1, qRound(1.5 * Layout->contentsMargins().left() / 2.0));
584 else if (Icon.isNull())
588 Layout->removeItem(Layout->itemAt(0));
625 Super::mouseDoubleClickEvent(
event);
633 Super::setVisible(visible);
675 #ifndef QT_NO_TOOLTIP
676 if (e->type() == QEvent::ToolTipChange)
678 const auto text = toolTip();
682 return Super::event(e);
@ DraggingFloatingWidget
DraggingFloatingWidget.
@ DraggingTab
DraggingTab.
Declaration of CFloatingDockContainer class.
void setElideMode(Qt::TextElideMode mode)
void setButtonIcon(QAbstractButton *Button, QStyle::StandardPixmap StandarPixmap, ads::eIcon CustomIconId)
CDockOverlay * containerOverlay() const
@ OpaqueUndocking
If enabled, the widgets are immediately undocked into floating widgets, if disabled,...
static int startDragDistance()
@ TabCloseIcon
TabCloseIcon.
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
@ TabCloseButtonIsToolButton
void setText(const QString &text)
@ ActiveTabHasCloseButton
If this flag is set, the active tab in a tab area has a close button.
Declaration of CFloatingDragPreview.
void setToolTip(QObjectPtr obj, const QString &tip)
Declaration of CDockManager class.
@ RetainTabSizeWhenCloseButtonHidden
if this flag is set, the space for the close button is reserved even if the close button is not visib...
bool isRestoringState() const
Declaration of CIconProvider.
@ DraggingMousePressed
DraggingMousePressed.
@ FocusHighlighting
enables styling of focused dock widget tabs or floating widget titlebar
Declaration of CElidingLabel.
@ AllTabsHaveCloseButton
If enabled the tab close buttons will be QToolButtons instead of QPushButtons - disabled by default.
@ DraggingInactive
DraggingInactive.
void repolishStyle(QWidget *w, eRepolishChildOptions Options=RepolishIgnoreChildren)
static bool testConfigFlag(eConfigFlag Flag)
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:44