summaryrefslogtreecommitdiff
path: root/src/viewmarkingscrollbar.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-07-14 21:22:44 +0200
committerTannin <devnull@localhost>2014-07-14 21:22:44 +0200
commit84c66727bff954fd0820fc9f33833848496e9531 (patch)
treeca3497150eb9f124d7a124cc48c8d6d1330b7243 /src/viewmarkingscrollbar.cpp
parentaf8973312188c3d90b8e3f8e2f8036d35e3f21ea (diff)
- 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
Diffstat (limited to 'src/viewmarkingscrollbar.cpp')
-rw-r--r--src/viewmarkingscrollbar.cpp39
1 files changed, 39 insertions, 0 deletions
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 <QStyle>
+#include <QStyleOptionSlider>
+#include <QPainter>
+
+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<qreal>(innerRect.height() - 3) / static_cast<qreal>(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<QColor>();
+ painter.setPen(col);
+ painter.setBrush(col);
+ painter.drawRect(QRect(2, i * scale - 2, handleRect.width() - 5, 3));
+ }
+ }
+}