From 84c66727bff954fd0820fc9f33833848496e9531 Mon Sep 17 00:00:00 2001 From: Tannin Date: Mon, 14 Jul 2014 21:22:44 +0200 Subject: - when highlighting a mod the overwritten and overwriting mods are now highlighted in the list - when starting an external application MO now wraps the process in a job and waits on that instead. This way MO is not unlocked early when skyrim is started through skse - mod info dialog no longer offers the esp tab for foreign mods because that caused confusion - updated translation files - download directory and mod directory are now created if necessary - bugfix: staging script created unnecessary copies of translation files - bugfix: potential invalid array access when trying to determine best mod order - bugfix: deleter file wasn't removed after esp hiding was disabled - bugfix: potential access to to un-initialized login reply - bugfix: changed the initialization order to allow more ui controls to be localized --- src/viewmarkingscrollbar.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/viewmarkingscrollbar.cpp (limited to 'src/viewmarkingscrollbar.cpp') diff --git a/src/viewmarkingscrollbar.cpp b/src/viewmarkingscrollbar.cpp new file mode 100644 index 00000000..eca37562 --- /dev/null +++ b/src/viewmarkingscrollbar.cpp @@ -0,0 +1,39 @@ +#include "viewmarkingscrollbar.h" +#include +#include +#include + +ViewMarkingScrollBar::ViewMarkingScrollBar(QAbstractItemModel *model, QWidget *parent, int role) + : QScrollBar(parent) + , m_Model(model) + , m_Role(role) +{ + // not implemented for horizontal sliders + Q_ASSERT(this->orientation() == Qt::Vertical); +} + +void ViewMarkingScrollBar::paintEvent(QPaintEvent *event) +{ + QScrollBar::paintEvent(event); + + QStyleOptionSlider styleOption; + initStyleOption(&styleOption); + + QPainter painter(this); + + QRect handleRect = style()->subControlRect(QStyle::CC_ScrollBar, &styleOption, QStyle::SC_ScrollBarSlider, this); + QRect innerRect = style()->subControlRect(QStyle::CC_ScrollBar, &styleOption, QStyle::SC_ScrollBarGroove, this); + + painter.translate(innerRect.topLeft() + QPoint(0, 3)); + qreal scale = static_cast(innerRect.height() - 3) / static_cast(m_Model->rowCount()); + + for (int i = 0; i < m_Model->rowCount(); ++i) { + QVariant data = m_Model->data(m_Model->index(i, 0), m_Role); + if (data.isValid()) { + QColor col = data.value(); + painter.setPen(col); + painter.setBrush(col); + painter.drawRect(QRect(2, i * scale - 2, handleRect.width() - 5, 3)); + } + } +} -- cgit v1.3.1