OpenMS
PainterBase.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- 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>
12 #include <OpenMS/CONCEPT/Types.h>
13 
14 #include <string_view>
15 
16 #include <QPainterPath>
17 #include <QRgb>
18 
19 class QColor;
20 class QPainter;
21 class QPenStyle;
22 class QPoint;
23 
24 namespace OpenMS
25 {
26  class String;
27  enum class ShapeIcon
28  {
29  DIAMOND,
30  SQUARE,
31  CIRCLE,
32  TRIANGLE
33  };
34 
38  class OPENMS_GUI_DLLAPI PainterBase
39  {
40  public:
43  static ShapeIcon toShapeIcon(const String& icon);
44 
46  static void drawDashedLine(const QPoint& from, const QPoint& to, QPainter* painter, const QColor& color);
47 
49  static void drawCross(const QPoint& position, QPainter* painter, const int size = 8);
50 
52  static void drawCaret(const QPoint& position, QPainter* painter, const int size = 8);
53 
55  static void drawDiamond(const QPoint& position, QPainter* painter, const int size = 8);
56 
58  static void drawIcon(const QPoint& pos, const QRgb& color, const ShapeIcon icon, Size s, QPainter& p);
59 
61  static QPainterPath getOpenArrow(int arrow_width);
63  static QPainterPath getClosedArrow(int arrow_width);
64 
75  static QRectF drawLineWithArrows(QPainter* painter, const QPen& pen, const QPoint& start, const QPoint& end,
76  const QPainterPath& arrow_start = QPainterPath(),
77  const QPainterPath& arrow_end = QPainterPath());
78  };
79 
80 } // namespace OpenMS
An empty base class with some static convenience functions.
Definition: PainterBase.h:39
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 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
A more convenient string class.
Definition: String.h:34
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:28