HAL  v4.5.0-133-g64838ea8d
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
line_number_area.cpp
Go to the documentation of this file.
2 
5 
6 #include <QPainter>
7 #include <QStyleOption>
8 namespace hal
9 {
10  LineNumberArea::LineNumberArea(CodeEditor* editor) : QWidget(editor), mEditor(editor)
11  {
12  repolish();
13  }
14 
16  {
17  return mLeftOffset;
18  }
19 
21  {
22  return mRightOffset;
23  }
24 
25  void LineNumberArea::setLeftOffset(const int offset)
26  {
27  mLeftOffset = offset;
28  }
29 
30  void LineNumberArea::setRightOffset(const int offset)
31  {
32  mRightOffset = offset;
33  }
34 
36  {
37  QStyle* s = style();
38 
39  s->unpolish(this);
40  s->polish(this);
41  }
42 
44  {
45  QStyleOption opt;
46  QtCompat::styleOptionInit(opt,this);
47  QPainter p(this);
48  style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
50  }
51 
53  {
54  mEditor->handleWheelEvent(event);
55  }
56 }
A plain text edit widget that is intended for editing code.
Definition: code_editor.h:52
void lineNumberAreaPaintEvent(QPaintEvent *event)
Definition: code_editor.cpp:83
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)
void styleOptionInit(QStyleOption &opt, QWidget *widget)
Definition: defines.h:45
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)
virtual bool event(QEvent *event) override
QStyle * style() const const