Skip to content

Commit

Permalink
修复offset中y弄成x的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
iwxyi committed Apr 30, 2020
1 parent 4e62369 commit f32e28a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions slimscrollbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ SlimScrollBar::SlimScrollBar(QWidget *parent)
}");

event_timer = new QTimer(this);
event_timer->setInterval(30);
event_timer->setInterval(16);
connect(event_timer, SIGNAL(timeout()), this, SLOT(eventTimer()));
}

Expand Down Expand Up @@ -289,6 +289,7 @@ void SlimScrollBar::paintPixmap()
painter.setPen(QPen(bg_normal_color, pen_w));
painter.drawPath(bg_path);

// 绘制前景
int range = maximum() - minimum();
int step = this->pageStep();
int height = qMax(this->height() * step / range - 10, 16);
Expand Down Expand Up @@ -520,8 +521,8 @@ void SlimScrollBar::calcPixmapSize()
int leftest = qMin(qMin(anchor_pos.x(), 0), effect_pos.x());
int rightest = qMax(qMax(anchor_pos.x(), width()), effect_pos.x()+width());
int wi = rightest - leftest;
int topest = qMin(qMin(anchor_pos.y(), 0), effect_pos.x());
int bottomest = qMax(qMax(anchor_pos.y(), height()), effect_pos.x()+height());
int topest = qMin(qMin(anchor_pos.y(), 0), effect_pos.y());
int bottomest = qMax(qMax(anchor_pos.y(), height()), effect_pos.y()+height());
int he = bottomest - topest;
pixmap = QPixmap(QSize(wi, he));
popup_offset.setX(0-leftest);
Expand Down

0 comments on commit f32e28a

Please sign in to comment.