Commit 67205f7f authored by Dominik Haumann's avatar Dominik Haumann Committed by Kåre Särs
Browse files

Avoid static QScrollBar instance

parent ad0dabe5
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
#include <QFontMetrics> #include <QFontMetrics>
#include <QMouseEvent> #include <QMouseEvent>
#include <QScreen> #include <QScreen>
#include <QScrollBar>
#include <QString> #include <QString>
#include <QTextBrowser> #include <QTextBrowser>
#include <QTimer> #include <QTimer>
#include <QScrollBar>
#include <KTextEditor/ConfigInterface> #include <KTextEditor/ConfigInterface>
#include <KTextEditor/Editor> #include <KTextEditor/Editor>
...@@ -260,11 +260,11 @@ public: ...@@ -260,11 +260,11 @@ public:
if (!m_view) { if (!m_view) {
return; return;
} }
static QScrollBar scrollBar(Qt::Horizontal); const int scrollBarHeight = horizontalScrollBar()->height();
QFontMetrics fm(font()); QFontMetrics fm(font());
QSize size = fm.size(Qt::TextSingleLine, QStringLiteral("m")); QSize size = fm.size(Qt::TextSingleLine, QStringLiteral("m"));
int fontHeight = size.height(); int fontHeight = size.height();
size.setHeight(m_view->height() - fontHeight * 2 - scrollBar.sizeHint().height()); size.setHeight(m_view->height() - fontHeight * 2 - scrollBarHeight);
size.setWidth(qRound(m_view->width() * 0.7)); size.setWidth(qRound(m_view->width() * 0.7));
resize(size); resize(size);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment