BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
importtextview.h
Go to the documentation of this file.
1
// ************************************************************************************************
2
//
3
// BornAgain: simulate and fit reflection and scattering
4
//
5
//! @file gui2/dataloader/importtextview.h
6
//! @brief Defines class CLASS?
7
//!
8
//! @homepage http://www.bornagainproject.org
9
//! @license GNU General Public License v3 or higher (see COPYING)
10
//! @copyright Forschungszentrum Jülich GmbH 2020
11
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12
//
13
// ************************************************************************************************
14
15
#ifndef BORNAGAIN_GUI2_DATALOADER_IMPORTTEXTVIEW_H
16
#define BORNAGAIN_GUI2_DATALOADER_IMPORTTEXTVIEW_H
17
18
#include "darefl_export.h"
19
20
//! Based on Qt example "codeeditor"
21
//! Copyright (C) 2016 The Qt Company Ltd.
22
23
#include <QPlainTextEdit>
24
25
class
QPaintEvent;
26
class
QResizeEvent;
27
class
QSize;
28
class
QWidget;
29
30
namespace
gui2
{
31
32
class
LineNumberArea;
33
34
//! Text view to show imported data.
35
36
class
DAREFLCORE_EXPORT
ImportTextView
:
public
QPlainTextEdit {
37
Q_OBJECT
38
39
public
:
40
ImportTextView
(QWidget* parent =
nullptr
);
41
42
void
lineNumberAreaPaintEvent(QPaintEvent* event);
43
int
lineNumberAreaWidth();
44
45
protected
:
46
void
resizeEvent(QResizeEvent* event)
override
;
47
48
private
slots:
49
void
updateLineNumberAreaWidth(
int
newBlockCount);
50
void
highlightCurrentLine();
51
void
updateLineNumberArea(
const
QRect& rect,
int
dy);
52
53
private
:
54
QWidget*
lineNumberArea
;
55
};
56
57
//! Area with line numbers.
58
59
class
DAREFLCORE_EXPORT
LineNumberArea
:
public
QWidget {
60
public
:
61
LineNumberArea
(
ImportTextView
* editor) : QWidget(editor), codeEditor(editor) {}
62
63
QSize
sizeHint
()
const override
{
return
QSize(codeEditor->lineNumberAreaWidth(), 0); }
64
65
protected
:
66
void
paintEvent
(QPaintEvent* event)
override
{ codeEditor->lineNumberAreaPaintEvent(event); }
67
68
private
:
69
ImportTextView
*
codeEditor
;
70
};
71
72
}
// namespace gui2
73
74
#endif
// BORNAGAIN_GUI2_DATALOADER_IMPORTTEXTVIEW_H
gui2::ImportTextView
Text view to show imported data.
Definition:
importtextview.h:36
gui2::ImportTextView::lineNumberArea
QWidget * lineNumberArea
Definition:
importtextview.h:54
gui2::LineNumberArea
Area with line numbers.
Definition:
importtextview.h:59
gui2::LineNumberArea::LineNumberArea
LineNumberArea(ImportTextView *editor)
Definition:
importtextview.h:61
gui2::LineNumberArea::sizeHint
QSize sizeHint() const override
Definition:
importtextview.h:63
gui2::LineNumberArea::codeEditor
ImportTextView * codeEditor
Definition:
importtextview.h:69
gui2::LineNumberArea::paintEvent
void paintEvent(QPaintEvent *event) override
Definition:
importtextview.h:66
gui2
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition:
app_constants.h:20
gui2
dataloader
importtextview.h
Generated by
1.9.1