OpenMS
Loading...
Searching...
No Matches
PainterBase.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Chris Bielow $
6// $Authors: Chris Bielow $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11#include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13
14#include <string_view>
15
16#include <QPainterPath>
17#include <QRgb>
18
19class QColor;
20class QPainter;
21class QPenStyle;
22class QPoint;
23
24namespace OpenMS
25{
26 enum class ShapeIcon
27 {
28 DIAMOND,
29 SQUARE,
30 CIRCLE,
32 };
33
37 class OPENMS_GUI_DLLAPI PainterBase
38 {
39 public:
42 static ShapeIcon toShapeIcon(const std::string& icon);
43
45 static void drawDashedLine(const QPoint& from, const QPoint& to, QPainter* painter, const QColor& color);
46
48 static void drawCross(const QPoint& position, QPainter* painter, const int size = 8);
49
51 static void drawCaret(const QPoint& position, QPainter* painter, const int size = 8);
52
54 static void drawDiamond(const QPoint& position, QPainter* painter, const int size = 8);
55
57 static void drawIcon(const QPoint& pos, const QRgb& color, const ShapeIcon icon, Size s, QPainter& p);
58
60 static QPainterPath getOpenArrow(int arrow_width);
62 static QPainterPath getClosedArrow(int arrow_width);
63
74 static QRectF drawLineWithArrows(QPainter* painter, const QPen& pen, const QPoint& start, const QPoint& end,
75 const QPainterPath& arrow_start = QPainterPath(),
76 const QPainterPath& arrow_end = QPainterPath());
77 };
78
79} // namespace OpenMS
An empty base class with some static convenience functions.
Definition PainterBase.h:38
static void drawCross(const QPoint &position, QPainter *painter, const int size=8)
draw a cross at position, using a certain size (= width = height) of the cross
static QPainterPath getOpenArrow(int arrow_width)
An arrow head which is open, i.e. '>'.
static void drawDiamond(const QPoint &position, QPainter *painter, const int size=8)
draw an unfilled diamond at position, using a certain size (= width = height) of the diamond
static QRectF drawLineWithArrows(QPainter *painter, const QPen &pen, const QPoint &start, const QPoint &end, const QPainterPath &arrow_start=QPainterPath(), const QPainterPath &arrow_end=QPainterPath())
static void drawIcon(const QPoint &pos, const QRgb &color, const ShapeIcon icon, Size s, QPainter &p)
draws squares, circles etc
static ShapeIcon toShapeIcon(const std::string &icon)
static void drawCaret(const QPoint &position, QPainter *painter, const int size=8)
draw a caret '^' at position, using a certain size (= width) of the caret
static QPainterPath getClosedArrow(int arrow_width)
An arrow head which is closed, i.e. a triangle.
static void drawDashedLine(const QPoint &from, const QPoint &to, QPainter *painter, const QColor &color)
static method to draw a dashed line
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
ShapeIcon
Definition PainterBase.h:27