casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtCanvasManager.qo.h
Go to the documentation of this file.
1 //# Copyright (C) 2005,2013
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 
26 #ifndef QTCanvasManager_H
27 #define QTCanvasManager_H
28 
29 #include <casa/aips.h>
32 #include <display/QtViewer/QtCanvasManager.ui.h>
33 #include <display/QtViewer/CursorLink.ui.h>
34 #include <casa/Containers/Record.h>
35 
36 #include <graphics/X11/X_enter.h>
37 /* # include <QDir> */
38 /* # include <QColor> */
39 /* # include <QHash> */
40 #include <QFrame>
41 #include <QSpacerItem>
42 #include <graphics/X11/X_exit.h>
43 
44 
45 namespace casa {
46 
47  class QtViewer;
48  class QtCanvasManager;
49 
50 // <summary>
51 // Options widget for single DisplayPanel.
52 // </summary>
53 
54 // <synopsis>
55 // </synopsis>
56 
58  Q_OBJECT
59  public:
60  QtCanvasManagerOptions( QtDisplayPanel* qdp, QWidget *parent ) : QtAutoGui(parent) {
61  loadRecord(qdp->getOptions());
62  connect( this, SIGNAL(setOptions(casacore::Record)), qdp, SLOT(setOptions(casacore::Record)) );
63  connect( qdp, SIGNAL(optionsChanged(casacore::Record)), SLOT(changeOptions(casacore::Record)) );
64  }
66  };
67 
68  class CursorLink : public QFrame, protected Ui::CursorLink {
69  Q_OBJECT
70  public:
71  CursorLink( const std::string &name, QtCanvasManager *mgr, QWidget *parent=0 );
72  std::string name( ) const {
73  return name_;
74  }
75  bool isChecked( ) const {
76  return link->checkState( ) == Qt::Unchecked ? false : true;
77  }
78  void setChecked( bool val ) {
79  link->setCheckState( val ? Qt::Checked : Qt::Unchecked );
80  }
81  void setText( const std::string &txt ) {
82  link->setText(QString::fromStdString(txt));
83  }
85  dpg = g;
86  }
88  return dpg;
89  }
90  void setColor( QColor c );
91 
92  private slots:
93  void setColor( );
94  void linkChange(int);
95 
96  private:
99  std::string name_;
101  };
102 
103  class QtCanvasManager : public QDialog, protected Ui::QtCanvasManager {
104  Q_OBJECT
105  public:
106 
110  return dpg_;
111  }
112 
113  protected:
114 
115  void showEvent( QShowEvent* );
118  private:
119  QVBoxLayout *layout;
120  QSpacerItem *spacer;
121  std::list<CursorLink*> link_widgets;
122 
123  };
124 
125 }
126 
127 #endif
128 
void loadRecord(casacore::Record rec)
call once only during initialization, to populate the gui, if you used the QtAutoGui(QWidget=0) const...
QtDisplayPanelGui * dpg_
void setOptions(casacore::Record options)
General-purpose Qt options widget created from Record.
Definition: QtAutoGui.qo.h:66
virtual casacore::Record getOptions()
Return Options record (of margins and no.
virtual void changeOptions(casacore::Record changedOptions)
QtCanvasManagerOptions(QtDisplayPanel *qdp, QWidget *parent)
The main display window for the Qt version of the viewer.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
QtCanvasManagerOptions * options
const Double c
Fundamental physical constants (SI units):
QtDisplayPanelGui * dpg()
QtCanvasManager(QtDisplayPanelGui *dpg)
Options widget for single DisplayPanel.
std::list< CursorLink * > link_widgets
void showEvent(QShowEvent *)