| 52 | d->setScrollPosition(d->_scrollBar->value() + d->_dragScrollDirection * 12, false); |
| 53 | d->updateDropPosition(d->_dropPosition); |
| 54 | } |
| 55 | }); |
| 56 | } |
| 57 | |
| 58 | ElaTabBar::~ElaTabBar() = default; |
| 59 | |
| 60 | void ElaTabBar::setTabSize(QSize tabSize) |
| 61 | { |
| 62 | Q_D(ElaTabBar); |
| 63 | d->_style->setTabSize(tabSize); |
| 64 | setMinimumHeight(minimumSizeHint().height()); |
| 65 | updateGeometry(); |
| 66 | // 字体变化事件让 Qt 按新的标签尺寸重新布局 |
| 67 | QEvent event(QEvent::FontChange); |
| 68 | QTabBar::changeEvent(&event); |
| 69 | Q_EMIT pTabSizeChanged(); |
| 70 | } |
| 71 | |
| 72 | QSize ElaTabBar::getTabSize() const |
| 73 | { |
| 74 | Q_D(const ElaTabBar); |
| 75 | return d->_style->getTabSize(); |
| 76 | } |
| 77 | |
| 78 | void ElaTabBar::setIsTabWidthAdaptive(bool isAdaptive) |
| 79 | { |
| 80 | Q_D(ElaTabBar); |
| 81 | if (getIsTabWidthAdaptive() == isAdaptive) |
| 82 | { |
| 83 | return; |
| 84 | } |
| 85 | d->_style->setIsTabWidthAdaptive(isAdaptive); |
| 86 | QEvent event(QEvent::FontChange); |
| 87 | QTabBar::changeEvent(&event); |
| 88 | updateGeometry(); |
| 89 | Q_EMIT pIsTabWidthAdaptiveChanged(); |
| 90 | } |
| 91 | |
| 92 | bool ElaTabBar::getIsTabWidthAdaptive() const |
| 93 | { |
| 94 | Q_D(const ElaTabBar); |
| 95 | return d->_style->getIsTabWidthAdaptive(); |
| 96 | } |
| 97 | |
| 98 | void ElaTabBar::setTabText(int index, const QString& text) |
| 99 | { |
| 100 | QTabBar::setTabText(index, text); |
| 101 | Q_EMIT tabBarTextChanged(index, text); |
| 102 | } |
| 103 | |
| 104 | void ElaTabBar::setIsActive(bool isActive) |
| 105 | { |
| 106 | Q_D(ElaTabBar); |
| 107 | d->_style->setIsActive(isActive); |
| 108 | update(); |
| 109 | } |
| 110 | |
| 111 | void ElaTabBar::setIsPinned(bool isPinned) |
nothing calls this directly
no test coverage detected