RDKit
Open-source cheminformatics and machine learning.
DrawTextQt.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2020 Greg Landrum and T5 Informatics GmbH
3 // @@ All Rights Reserved @@
4 // This file is part of the RDKit.
5 // The contents are covered by the terms of the BSD license
6 // which is included in the file license.txt, found at the root
7 // of the RDKit source tree.
8 //
9 
10 #ifndef RDKIT_DRAWTEXTQT_H
11 #define RDKIT_DRAWTEXTQT_H
12 
14 
15 class QPainter;
16 
17 namespace RDKit {
18 
19 // ****************************************************************************
20 class DrawTextQt : public DrawText {
21  public:
22  DrawTextQt(double max_fnt_sz, double min_fnt_sz, QPainter *qp);
23 
24 #if 0
25  void getStringSize(const std::string &label, double &label_width,
26  double &label_height) const override;
27 #endif
28  void drawChar(char c, const Point2D &cds) override;
29 
30  private:
31  QPainter *d_qp;
32 
33  // return a vector of StringRects, one for each char in text, with
34  // super- and subscripts taken into account. Sizes in pixel coords,
35  // i.e. scaled by fontScale().
36  void getStringRects(const std::string &text,
37  std::vector<std::shared_ptr<StringRect>> &rects,
38  std::vector<TextDrawType> &draw_modes,
39  std::vector<char> &draw_chars) const override;
40 };
41 
42 } // namespace RDKit
43 
44 #endif // RDKIT_DRAWTEXTQT_H
DrawTextQt(double max_fnt_sz, double min_fnt_sz, QPainter *qp)
void drawChar(char c, const Point2D &cds) override
virtual void getStringSize(const std::string &label, double &label_width, double &label_height) const
using the current scale, work out the size of the label
Std stuff.
Definition: Abbreviations.h:18