HAL
line_number_area.cpp
Go to the documentation of this file.
2 
4 
5 #include <QPainter>
6 #include <QStyleOption>
7 namespace hal
8 {
9  LineNumberArea::LineNumberArea(CodeEditor* editor) : QWidget(editor), mEditor(editor)
10  {
11  repolish();
12  }
13 
15  {
16  return mLeftOffset;
17  }
18 
20  {
21  return mRightOffset;
22  }
23 
24  void LineNumberArea::setLeftOffset(const int offset)
25  {
26  mLeftOffset = offset;
27  }
28 
29  void LineNumberArea::setRightOffset(const int offset)
30  {
31  mRightOffset = offset;
32  }
33 
35  {
36  QStyle* s = style();
37 
38  s->unpolish(this);
39  s->polish(this);
40  }
41 
43  {
44  QStyleOption opt;
45  opt.init(this);
46  QPainter p(this);
47  style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
49  }
50 
52  {
53  mEditor->handleWheelEvent(event);
54  }
55 }
A plain text edit widget that is intended for editing code.
Definition: code_editor.h:52
void lineNumberAreaPaintEvent(QPaintEvent *event)
Definition: code_editor.cpp:85
void handleWheelEvent(QWheelEvent *event)
void setLeftOffset(const int offset)
void wheelEvent(QWheelEvent *event) override
void paintEvent(QPaintEvent *event) override
void setRightOffset(const int offset)
LineNumberArea(CodeEditor *editor)
virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const const=0
virtual void polish(QWidget *widget)
virtual void unpolish(QWidget *widget)
void init(const QWidget *widget)
virtual bool event(QEvent *event) override
QStyle * style() const const