add orientation prop to SideTabBar.

This commit is contained in:
Nick D'Ademo 2022-09-14 14:25:11 +08:00
parent 48163d2679
commit 5df2467592
2 changed files with 17 additions and 1 deletions

View File

@ -102,6 +102,7 @@ void CSideTabBar::removeSideTab(CDockWidgetSideTab* SideTab)
d->TabsLayout->removeWidget(SideTab); d->TabsLayout->removeWidget(SideTab);
} }
//============================================================================ //============================================================================
void CSideTabBar::paintEvent(QPaintEvent* event) void CSideTabBar::paintEvent(QPaintEvent* event)
{ {
@ -110,4 +111,11 @@ void CSideTabBar::paintEvent(QPaintEvent* event)
QPainter painter(this); QPainter painter(this);
style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this); style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
} }
//============================================================================
Qt::Orientation CSideTabBar::orientation() const
{
return d->Orientation;
}
} }

View File

@ -45,6 +45,9 @@ class CDockWidgetTab;
class ADS_EXPORT CSideTabBar : public QWidget class ADS_EXPORT CSideTabBar : public QWidget
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(Qt::Orientation orientation READ orientation)
private: private:
SideTabBarPrivate* d; ///< private data (pimpl) SideTabBarPrivate* d; ///< private data (pimpl)
friend struct SideTabBarPrivate; friend struct SideTabBarPrivate;
@ -52,7 +55,7 @@ private:
protected: protected:
void paintEvent(QPaintEvent* event) override; void paintEvent(QPaintEvent* event) override;
public: public:
using Super = QWidget; using Super = QWidget;
@ -76,6 +79,11 @@ public:
*/ */
void removeSideTab(CDockWidgetSideTab* SideTab); void removeSideTab(CDockWidgetSideTab* SideTab);
/**
* Returns orientation of side tab.
*/
Qt::Orientation orientation() const;
Q_SIGNALS: Q_SIGNALS:
void sideTabAutoHideToggleRequested(); void sideTabAutoHideToggleRequested();
}; };