VTK
vtkQtChartTitle.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtChartTitle.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
20 
23 
24 #ifndef _vtkQtChartTitle_h
25 #define _vtkQtChartTitle_h
26 
27 
28 #include "vtkQtChartExport.h"
29 #include <QWidget>
30 #include <QString> // Needed for return type
31 
32 class QPainter;
33 
34 
41 class VTKQTCHART_EXPORT vtkQtChartTitle : public QWidget
42 {
43  Q_OBJECT
44 
45 public:
50  vtkQtChartTitle(Qt::Orientation orient=Qt::Horizontal, QWidget *parent=0);
51  virtual ~vtkQtChartTitle() {}
52 
57  Qt::Orientation getOrientation() const {return this->Orient;}
58 
62  void setOrientation(Qt::Orientation orient);
63 
68  QString getText() const {return this->Text;}
69 
73  void setText(const QString &text);
74 
79  int getTextAlignment() const {return this->Align;}
80 
84  void setTextAlignment(int flags) {this->Align = flags;}
85 
90  virtual QSize sizeHint() const {return this->Bounds;}
91 
95  void drawTitle(QPainter &painter);
96 
97 signals:
99  void orientationChanged();
100 
101 protected:
107  virtual bool event(QEvent *e);
108 
112  virtual void paintEvent(QPaintEvent *e);
113 
114 private:
116  void calculateSize();
117 
118 private:
119  QString Text;
120  QSize Bounds;
121  Qt::Orientation Orient;
122  int Align;
123 };
124 
125 #endif
The vtkQtChartTitle class is used to draw a chart title.
Qt::Orientation getOrientation() const
Gets the orientation of the chart title.
virtual ~vtkQtChartTitle()
QString getText() const
Gets the chart title text.
void setTextAlignment(int flags)
Sets the text alignment flags for the title.
virtual QSize sizeHint() const
Gets the preferred size of the chart title.
int getTextAlignment() const
Gets the text alignment flags for the title.