g4tools  5.4.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tools::Qt::sg_viewer Class Reference
Inheritance diagram for tools::Qt::sg_viewer:
Inheritance graph
[legend]
Collaboration diagram for tools::Qt::sg_viewer:
Collaboration graph
[legend]

Public Member Functions

 sg_viewer (session &a_session, int a_x=0, int a_y=0, unsigned int a_width=500, unsigned int a_height=500, const std::string &a_win_title="")
 
virtual ~sg_viewer ()
 
bool has_window () const
 
bool show ()
 
void win_render ()
 
QWidget * shell ()
 
void set_own_shell (bool a_value)
 
Qt::glareaglarea ()
 
void set_device_interactor (tools::sg::device_interactor *a_interactor)
 
void enable_keyboard_focus ()
 
- Public Member Functions inherited from tools::sg::GL_viewer
void render ()
 
 GL_viewer (std::ostream &a_out, unsigned int a_width, unsigned int a_height)
 
virtual ~GL_viewer ()
 
 GL_viewer (const GL_viewer &a_from)
 
GL_vieweroperator= (const GL_viewer &a_from)
 
- Public Member Functions inherited from tools::sg::viewer
virtual void * cast (const std::string &a_class) const
 
virtual void set_size (unsigned int a_w, unsigned int a_h)
 
virtual bool set_cursor_shape (cursor_shape)
 
 viewer (std::ostream &a_out, unsigned int a_width, unsigned int a_height)
 
virtual ~viewer ()
 
 viewer (const viewer &a_from)
 
vieweroperator= (const viewer &a_from)
 
bool set_default_cursor_shape ()
 
groupsg ()
 
const groupsg () const
 
unsigned int width () const
 
unsigned int height () const
 
bool screen2aspect (int a_x, int a_y, float &a_wx, float &a_wy) const
 
void set_clear_color (float a_r, float a_g, float a_b, float a_a=1)
 
void set_clear_color (const colorf &a_color)
 
void get_clear_color (float &a_r, float &a_g, float &a_b, float &a_a)
 
const colorfbackground () const
 
std::ostream & out () const
 
const std::string & out_dir () const
 
void set_produce_out_jpeg (bool a_value)
 
bool produce_out_jpeg () const
 
void set_produce_out_png (bool a_value)
 
bool produce_out_png () const
 
void set_produce_out_file (const std::string &a_file)
 
const std::string & produce_out_file () const
 
void set_produce_out_bpp (unsigned int a_bpp)
 
unsigned int produce_out_bpp () const
 

Protected Member Functions

 sg_viewer (const sg_viewer &a_from)
 
sg_vieweroperator= (const sg_viewer &a_from)
 

Protected Attributes

sessionm_session
 
QWidget * m_shell
 
bool m_own_shell
 
Qt::glaream_glarea
 
- Protected Attributes inherited from tools::sg::GL_viewer
GL_manager m_gl_mgr
 
- Protected Attributes inherited from tools::sg::viewer
std::ostream & m_out
 
colorf m_clear_color
 
unsigned int m_ww
 
unsigned int m_wh
 
group m_sg
 
std::string m_out_dir
 
bool m_use_gsto
 
bool m_produce_out_jpeg
 
bool m_produce_out_png
 
std::string m_produce_out_file
 
unsigned int m_produce_out_bpp
 

Detailed Description

Definition at line 24 of file sg_viewer.

Constructor & Destructor Documentation

◆ sg_viewer() [1/2]

tools::Qt::sg_viewer::sg_viewer ( session a_session,
int  a_x = 0,
int  a_y = 0,
unsigned int  a_width = 500,
unsigned int  a_height = 500,
const std::string &  a_win_title = "" 
)
inline

Definition at line 27 of file sg_viewer.

31  :parent(a_session.out(),a_width,a_height)
32  ,m_session(a_session)
33  ,m_shell(0)
34  ,m_own_shell(false)
35  ,m_glarea(0)
36  {
37  if(!m_session.is_valid()) return; //throw
38  m_shell = m_session.create_window(a_win_title.c_str(),a_x,a_y,a_width,a_height);
39  if(!m_shell) return; //throw
40  m_own_shell = true;
41 
42  m_glarea = new Qt::glarea(0,*this);
43 
44  QVBoxLayout* layout = new QVBoxLayout;
45  layout->setContentsMargins(0,0,0,0);
46  layout->addWidget(m_glarea);
47  m_shell->setLayout(layout);
48  }

◆ ~sg_viewer()

virtual tools::Qt::sg_viewer::~sg_viewer ( )
inlinevirtual

Definition at line 49 of file sg_viewer.

49  {
50  if(m_shell && m_own_shell) {
52  //m_session.sync();
53  }
54  }

◆ sg_viewer() [2/2]

tools::Qt::sg_viewer::sg_viewer ( const sg_viewer a_from)
inlineprotected

Definition at line 56 of file sg_viewer.

57  :parent(a_from)
58  ,m_session(a_from.m_session)
59  ,m_shell(0)
60  ,m_own_shell(false)
61  ,m_glarea(0)
62  {}

Member Function Documentation

◆ enable_keyboard_focus()

void tools::Qt::sg_viewer::enable_keyboard_focus ( )
inline

Definition at line 88 of file sg_viewer.

88  {
89  if(!m_glarea) return;
90  m_glarea->setFocusPolicy(::Qt::StrongFocus);
91  }

◆ glarea()

Qt::glarea* tools::Qt::sg_viewer::glarea ( )
inline

Definition at line 83 of file sg_viewer.

83 {return m_glarea;}

◆ has_window()

bool tools::Qt::sg_viewer::has_window ( ) const
inline

Definition at line 68 of file sg_viewer.

68 {return m_shell?true:false;} //for SWIG

◆ operator=()

sg_viewer& tools::Qt::sg_viewer::operator= ( const sg_viewer a_from)
inlineprotected

Definition at line 63 of file sg_viewer.

63  {
64  parent::operator=(a_from);
65  return *this;
66  }

◆ set_device_interactor()

void tools::Qt::sg_viewer::set_device_interactor ( tools::sg::device_interactor a_interactor)
inline

Definition at line 84 of file sg_viewer.

84  { //we do not have ownership.
85  if(!m_glarea) return;
86  m_glarea->set_device_interactor(a_interactor);
87  }

◆ set_own_shell()

void tools::Qt::sg_viewer::set_own_shell ( bool  a_value)
inline

Definition at line 82 of file sg_viewer.

82 {m_own_shell = a_value;}

◆ shell()

QWidget* tools::Qt::sg_viewer::shell ( )
inline

Definition at line 81 of file sg_viewer.

81 {return m_shell;}

◆ show()

bool tools::Qt::sg_viewer::show ( )
inline

Definition at line 70 of file sg_viewer.

70  {
71  if(!m_shell) return false;
72  m_shell->show();
73  return true;
74  }

◆ win_render()

void tools::Qt::sg_viewer::win_render ( )
inline

Definition at line 76 of file sg_viewer.

76  {
77  if(!m_glarea) return;
78  m_glarea->update();
79  }

Member Data Documentation

◆ m_glarea

Qt::glarea* tools::Qt::sg_viewer::m_glarea
protected

Definition at line 96 of file sg_viewer.

◆ m_own_shell

bool tools::Qt::sg_viewer::m_own_shell
protected

Definition at line 95 of file sg_viewer.

◆ m_session

session& tools::Qt::sg_viewer::m_session
protected

Definition at line 93 of file sg_viewer.

◆ m_shell

QWidget* tools::Qt::sg_viewer::m_shell
protected

Definition at line 94 of file sg_viewer.


The documentation for this class was generated from the following file:
tools::Qt::sg_viewer::m_session
session & m_session
Definition: sg_viewer:93
tools::Qt::glarea::set_device_interactor
void set_device_interactor(tools::sg::device_interactor *a_interactor)
Definition: glarea:81
tools::sg::GL_viewer::operator=
GL_viewer & operator=(const GL_viewer &a_from)
Definition: GL_viewer:58
tools::Qt::session::delete_window
void delete_window(QWidget *a_window) const
Definition: session:88
tools::Qt::sg_viewer::m_shell
QWidget * m_shell
Definition: sg_viewer:94
tools::Qt::sg_viewer::m_glarea
Qt::glarea * m_glarea
Definition: sg_viewer:96
tools::Qt::session::is_valid
bool is_valid() const
Definition: session:58
tools::Qt::session::create_window
QWidget * create_window(const char *a_title, int a_x, int a_y, unsigned int a_width, unsigned int a_height)
Definition: session:71
tools::Qt::sg_viewer::m_own_shell
bool m_own_shell
Definition: sg_viewer:95