casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CanvasHolder.qo.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 #ifndef CANVASHOLDER_QO_H
26 #define CANVASHOLDER_QO_H
27 
28 #include <QWidget>
29 #include <qwt_legend.h>
30 #include <display/QtPlotter/CanvasHolder.ui.h>
32 
33 namespace casa {
34 
35 //Holds the QtCanvas where the spectral profile is drawn. When a legend
36 //external to the canvas is shown, this class handles the legend and the coordination
37 //between the legend and the pixel canvas.
38 
39  class CanvasHolder : public QWidget {
40  Q_OBJECT
41 
42  public:
43  CanvasHolder(QWidget *parent = 0);
44 
45  //Sets the visibility of the the legend.
46  void setShowLegend( bool showLegend );
47 
48  //Determines whether a color bar will be drawn along side the legend
49  //text. When a color bar is not used, the text will be colored to
50  //identify the curve.
51  void setColorBarVisibility( bool visible );
52 
53  //Returns a list of curve identifiers
54  QList<QString> getCurveLabels();
55 
56  //Sets the curve identifier
57  void setCurveLabels( const QList<QString>& curveNames );
58 
59  //Location of the legend
61  void setLegendPosition( int location );
63  ~CanvasHolder();
64 
65  private slots:
66  void changeLegendDisplay();
67 
68  private:
69  void refreshLegend();
70  void addLegend( QBoxLayout* innerLayout, QBoxLayout* outerLayout );
71  void addHorizontalLegend( QBoxLayout* verticalLayout );
72  void addVerticalLegend( QBoxLayout* verticalLayout );
73 
74  Ui::CanvasHolderClass ui;
75  bool showLegend;
79  QWidget* legend;
80  QWidget* centralWidget;
81  };
82 }
83 #endif // CANVASHOLDER_H
void setCurveLabels(const QList< QString > &curveNames)
Sets the curve identifier.
void changeLegendDisplay()
QtCanvas * getCanvas()
void addLegend(QBoxLayout *innerLayout, QBoxLayout *outerLayout)
LegendLocation legendLocation
Holds the QtCanvas where the spectral profile is drawn.
QList< QString > getCurveLabels()
Returns a list of curve identifiers.
void addHorizontalLegend(QBoxLayout *verticalLayout)
void setShowLegend(bool showLegend)
Sets the visibility of the the legend.
Ui::CanvasHolderClass ui
void setLegendPosition(int location)
void setColorBarVisibility(bool visible)
Determines whether a color bar will be drawn along side the legend text.
void addVerticalLegend(QBoxLayout *verticalLayout)
CanvasHolder(QWidget *parent=0)
LegendLocation
Location of the legend.