-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 增加dock栏鼠标悬停item背景加深 #874
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -23,6 +23,7 @@ QPointer<DockPopupWindow> DockItem::PopupWindow(nullptr); | |||||||
DockItem::DockItem(QWidget *parent) | ||||||||
: QWidget(parent) | ||||||||
, m_hover(false) | ||||||||
, m_pressed(false) | ||||||||
, m_popupShown(false) | ||||||||
, m_tapAndHold(false) | ||||||||
, m_draging(false) | ||||||||
|
@@ -134,12 +135,28 @@ void DockItem::updatePopupPosition() | |||||||
|
||||||||
void DockItem::paintEvent(QPaintEvent *e) | ||||||||
{ | ||||||||
if(m_hover && !m_pressed) | ||||||||
{ | ||||||||
QPainter painter(this); | ||||||||
painter.setBrush(QBrush(QColor(248, 248, 255))); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个颜色无论亮色与暗色主题均保持同一个颜色吗? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 是的,这个颜色是固定的,无论主题是否变化 |
||||||||
painter.setPen(Qt::NoPen); | ||||||||
QRect tempRect = rect(); | ||||||||
painter.drawRect(tempRect.x(), tempRect.y(), tempRect.width(), tempRect.height()); | ||||||||
}else if(m_hover && m_pressed) | ||||||||
{ | ||||||||
Comment on lines
+145
to
+146
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
QPainter painter(this); | ||||||||
painter.setBrush(Qt::gray); | ||||||||
painter.setPen(Qt::NoPen); | ||||||||
QRect tempRect = rect(); | ||||||||
painter.drawRect(tempRect.x(), tempRect.y(), tempRect.width(), tempRect.height()); | ||||||||
} | ||||||||
QWidget::paintEvent(e); | ||||||||
} | ||||||||
|
||||||||
void DockItem::mousePressEvent(QMouseEvent *e) | ||||||||
{ | ||||||||
m_popupTipsDelayTimer->stop(); | ||||||||
m_pressed = true; | ||||||||
hideNonModel(); | ||||||||
|
||||||||
if (e->button() == Qt::RightButton) { | ||||||||
|
@@ -178,6 +195,7 @@ void DockItem::leaveEvent(QEvent *e) | |||||||
QWidget::leaveEvent(e); | ||||||||
|
||||||||
m_hover = false; | ||||||||
m_pressed = false; | ||||||||
//FIXME: 可能是qt的bug,概率性导致崩溃,待修复 | ||||||||
// m_hoverEffect->setHighlighting(false); | ||||||||
m_popupTipsDelayTimer->stop(); | ||||||||
|
@@ -189,6 +207,13 @@ void DockItem::leaveEvent(QEvent *e) | |||||||
update(); | ||||||||
} | ||||||||
|
||||||||
void DockItem::mouseReleaseEvent(QMouseEvent *event) | ||||||||
{ | ||||||||
m_pressed = false; | ||||||||
QWidget::mouseReleaseEvent(event); | ||||||||
update(); | ||||||||
} | ||||||||
|
||||||||
const QRect DockItem::perfectIconRect() const | ||||||||
{ | ||||||||
const QRect itemRect = rect(); | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.