命名规范
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#include "scroll.h"
|
||||
namespace Psc {
|
||||
void V_Scroll_Bar::draw(QPainter* painter) {
|
||||
auto device = painter->device();
|
||||
double ww = device->width();
|
||||
double hh = device->height();
|
||||
painter->save();
|
||||
auto bar_rect = get_bar_rect(ww, hh);
|
||||
painter->setClipRect(bar_rect);
|
||||
painter->fillRect(bar_rect, background_color);
|
||||
painter->fillRect(get_slider_rect(ww, hh), slider_color);
|
||||
painter->restore();
|
||||
}
|
||||
QRect V_Scroll_Bar::get_slider_rect(int ww, int hh) {
|
||||
double x = ww - w;
|
||||
QRect slider(x, pos() + start, w, slider_len());
|
||||
return slider;
|
||||
}
|
||||
QRect V_Scroll_Bar::get_bar_rect(int ww, int hh) {
|
||||
double x = ww - w;
|
||||
QRect bar_rect(x, 0 + start, w, bar_len());
|
||||
return bar_rect;
|
||||
}
|
||||
void H_Scroll_Bar::draw(QPainter* painter) {
|
||||
auto device = painter->device();
|
||||
double ww = device->width();
|
||||
double hh = device->height();
|
||||
painter->save();
|
||||
auto bar_rect = get_bar_rect(ww, hh);
|
||||
painter->setClipRect(bar_rect);
|
||||
painter->fillRect(bar_rect, background_color);
|
||||
painter->fillRect(get_slider_rect(ww, hh), slider_color);
|
||||
painter->restore();
|
||||
}
|
||||
QRect H_Scroll_Bar::get_slider_rect(int ww, int hh) {
|
||||
double y = hh - h;
|
||||
QRect slider_rect(pos() + start, y, slider_len(), h);
|
||||
return slider_rect;
|
||||
}
|
||||
QRect H_Scroll_Bar::get_bar_rect(int ww, int hh) {
|
||||
double y = hh - h;
|
||||
QRect bar_rect(0 + start, y, bar_len(), h);
|
||||
return bar_rect;
|
||||
}
|
||||
} // namespace Psc
|
||||
Reference in New Issue
Block a user