Qt Virtual Chart Table (QVCT)
CVesselCockpit.cpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Qt Virtual Chart Table (QVCT)
5  * Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6  * Author: Cedric Dufour <http://cedric.dufour.name>
7  *
8  * The Qt Virtual Chart Table (QVCT) is free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Qt Virtual Chart Table (QVCT) is distributed in the hope
13  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU General Public License for more details.
17  */
18 
19 // QT
20 #include <QGridLayout>
21 #include <QString>
22 #include <QWidget>
23 
24 // QVCT
27 
28 
29 //------------------------------------------------------------------------------
30 // CONSTRUCTORS / DESTRUCTOR
31 //------------------------------------------------------------------------------
32 
33 CVesselCockpit::CVesselCockpit( const QString& _rqsTitle, QWidget* _pqParent )
34  : QWidget( _pqParent, Qt::Window )
35  , poVesselPoint( 0 )
36 {
37  QWidget::setWindowTitle( _rqsTitle );
38  pqGridLayout = new QGridLayout();
39  pqGridLayout->setContentsMargins( 0, 0, 0, 0 );
40  pqGridLayout->setSpacing( 0 );
41  QWidget::setLayout( pqGridLayout );
42 }
43 
44 
45 //------------------------------------------------------------------------------
46 // METHODS
47 //------------------------------------------------------------------------------
48 
49 //
50 // SLOTS
51 //
52 
53 void CVesselCockpit::slotDestroyed( QObject* _pqObject )
54 {
55  if( !_pqObject || (QObject*)poVesselPoint != _pqObject ) return;
57 }
58 
59 //
60 // SETTERS
61 //
62 
64 {
65  if( poVesselPoint == _poVesselPoint ) return;
66  poVesselPoint = _poVesselPoint;
67  QObject::connect( poVesselPoint, SIGNAL( destroyed(QObject*) ), this, SLOT( slotDestroyed(QObject*) ) );
68 }
69 
71 {
72  if( poVesselPoint ) QObject::disconnect( (QObject*)poVesselPoint, 0, this, 0 );
73  poVesselPoint = 0;
74  resetContent();
75 }
void setVesselPoint(CVesselPoint *_poVesselPoint)
Sets the vessel used to synchronize the instruments display.
virtual void resetContent()=0
Resets (clears) the content of the underlying widget.
CVesselCockpit(const QString &_rqsTitle, QWidget *_pqParent=0)
CVesselPoint * poVesselPoint
Overlay course being displayed.
QGridLayout * pqGridLayout
[UI:Layout] Layout
void resetVesselPoint()
Resets (clears) the vessel used to synchronize the instruments display.
void slotDestroyed(QObject *_pqObject)
Slot to handle object destruction.
[UI] Vessel overlay point (item) / vessel