33 #include <QMouseEvent> 37 #include <QApplication> 126 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
127 setFrameStyle(QFrame::NoFrame);
128 setWidgetResizable(
true);
129 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
130 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
135 d->
TabsLayout =
new QBoxLayout(QBoxLayout::LeftToRight);
142 setFocusPolicy(Qt::NoFocus);
157 const int direction = Event->angleDelta().y();
160 horizontalScrollBar()->setValue(horizontalScrollBar()->
value() + 20);
164 horizontalScrollBar()->setValue(horizontalScrollBar()->
value() - 20);
177 if (index < -1 || index > (
count() - 1))
179 qWarning() << Q_FUNC_INFO <<
"Invalid index" << index;
203 connect(Tab, SIGNAL(clicked()),
this, SLOT(
onTabClicked()));
206 connect(Tab, SIGNAL(moved(
const QPoint&)),
this, SLOT(
onTabWidgetMoved(
const QPoint&)));
208 Tab->installEventFilter(
this);
210 if (Index <= d->CurrentIndex)
230 ADS_PRINT(
"CDockAreaTabBar::removeTab ");
235 NewCurrentIndex = -1;
237 if (NewCurrentIndex > RemoveIndex)
241 else if (NewCurrentIndex == RemoveIndex)
243 NewCurrentIndex = -1;
245 for (
int i = (RemoveIndex + 1); i <
count(); ++i)
247 if (
tab(i)->isVisibleTo(
this))
249 NewCurrentIndex = i - 1;
256 if (NewCurrentIndex < 0)
258 for (
int i = (RemoveIndex - 1); i >= 0; --i)
260 if (
tab(i)->isVisibleTo(
this))
271 Tab->disconnect(
this);
272 Tab->removeEventFilter(
this);
273 ADS_PRINT(
"NewCurrentIndex " << NewCurrentIndex);
340 for (
int i = 0; i <
count(); ++i)
343 if (Tab->isClosable() && !Tab->isHidden() && Tab != Sender)
348 int Offset = Tab->dockWidget()->features().testFlag(
355 if (Tab->dockWidget()->isClosed())
367 if (Index >=
count() || Index < 0)
385 auto MousePos = mapFromGlobal(GlobalPos);
386 MousePos.rx() = qMax(
d->
firstTab()->geometry().left(), MousePos.x());
387 MousePos.rx() = qMin(
d->
lastTab()->geometry().right(), MousePos.x());
390 for (
int i = 0; i <
count(); ++i)
393 if (DropTab == MovingTab || !DropTab->isVisibleTo(
this)
394 || !DropTab->geometry().contains(MousePos))
400 if (toIndex == fromIndex)
411 ADS_PRINT(
"tabMoved from " << fromIndex <<
" to " << toIndex);
425 if (Index < 0 || Index >=
count())
430 auto Tab =
tab(Index);
442 bool Result = Super::eventFilter(watched, event);
449 switch (event->type())
462 case QEvent::LayoutRequest:
477 if (Index < 0 || Index >=
count())
482 return !
tab(Index)->isHidden();
enum MQTTPropertyCodes value
void tabBarClicked(int index)
CDockWidgetTab * tab(int Index) const
void tabClosed(int index)
CDockWidgetTab * firstTab() const
virtual QSize minimumSizeHint() const override
virtual QSize sizeHint() const override
Declaration of CDockAreaTabBar class.
Declaration of CFloatingDockContainer class.
void insertTab(int Index, CDockWidgetTab *Tab)
void tabCloseRequested(int index)
CDockWidgetTab * currentTab() const
CDockWidgetTab * lastTab() const
void tabMoved(int from, int to)
void currentChanging(int Index)
void onCloseOtherTabsRequested()
Declaration of CFloatingDragPreview.
CDockAreaWidget * DockArea
void onTabCloseRequested()
bool isTabOpen(int Index) const
DockAreaTabBarPrivate(CDockAreaTabBar *_public)
void currentChanged(int Index)
DockAreaTabBarPrivate * d
private data (pimpl)
virtual void wheelEvent(QWheelEvent *Event) override
void removeTab(CDockWidgetTab *Tab)
void tabInserted(int index)
void setCurrentIndex(int Index)
void elidedChanged(bool elided)
virtual ~CDockAreaTabBar()
void onTabWidgetMoved(const QPoint &GlobalPos)
QWidget * TabsContainerWidget
Declaration of CDockManager class.
void removingTab(int index)
void tabOpened(int index)
virtual bool eventFilter(QObject *watched, QEvent *event) override
CDockAreaTabBar(CDockAreaWidget *parent)