13 : QFrame(parent), leftWidget_(leftWidget), rightWidget_(rightWidget),
14 themeManager_(themeManager ? themeManager : &
ThemeManager::instance())
16 setFrameShape(QFrame::VLine);
19 if (leftWidget_ || rightWidget_)
20 setCursor(Qt::SplitHCursor);
21 setMouseTracking(
true);
35void ToolbarDragHandle::updateStyle()
42 else if (hovered_ && (leftWidget_ || rightWidget_))
43 color = c.
accent.lighter(130).name();
47 setStyleSheet(QString(
"QFrame { background-color: %1; border: none; }").arg(color));
52 if (event->button() == Qt::LeftButton && (leftWidget_ || rightWidget_))
55 dragStartX_ =
event->globalPosition().toPoint().x();
58 originalWidth_ = leftWidget_->width();
59 else if (rightWidget_)
60 originalWidth_ = rightWidget_->width();
66 QFrame::mousePressEvent(event);
74 int delta =
event->globalPosition().toPoint().x() - dragStartX_;
79 int newWidth = qBound(minWidth_, originalWidth_ + delta, maxWidth_);
80 leftWidget_->setMinimumWidth(newWidth);
81 leftWidget_->setMaximumWidth(newWidth);
84 else if (rightWidget_)
87 int newWidth = qBound(minWidth_, originalWidth_ - delta, maxWidth_);
88 rightWidget_->setMinimumWidth(newWidth);
89 rightWidget_->setMaximumWidth(newWidth);
96 QFrame::mouseMoveEvent(event);
102 if (event->button() == Qt::LeftButton)
110 QFrame::mouseReleaseEvent(event);
118 QFrame::enterEvent(event);
125 QFrame::leaveEvent(event);
void themeChanged()
Emitted when theme or accent color changes.
const ThemeColors & colors() const
Get effective colors (with accent customization applied).