Logo Search packages:      
Sourcecode: sailcut version File versions  Download package

CSailViewerPanel::CSailViewerPanel ( QWidget *  parent,
const enumViewMode  viewMode,
bool  show_sliders,
bool  show_labeling = true 
)

Constructs a CSailViewerPanel object.

Parameters:
parent The parent widget
viewMode The viewing mode (shaded or wireframe)
show_sliders Should the elevation and azimuth sliders be displayed?
show_labeling Should the "Labeling" button be displayed?

Definition at line 39 of file sailviewer-panel.cpp.

References btnLabeling, btnResetView, btnZoomIn, btnZoomOut, grpControls, grpParams, languageChange(), lblAzimuth, lblAzimuthStatic, lblElevation, lblElevationStatic, sailDisp, showSliders, slotAzimuth(), and slotElevation().

        : QWidget(parent), showSliders(show_sliders)
{

    /* parameters groupbox */
    if (showSliders)
    {
        /* display parameters groupbox */
        grpParams = new QGroupBox( this );
        QGridLayout* grpParamsLayout = new QGridLayout( grpParams );
        lblAzimuthStatic = new QLabel( grpParams );
        grpParamsLayout->addWidget( lblAzimuthStatic, 0, 0 );
        lblAzimuth = new QLabel( grpParams );
        grpParamsLayout->addWidget( lblAzimuth, 0, 1 );
        lblElevationStatic = new QLabel( grpParams );
        grpParamsLayout->addWidget( lblElevationStatic, 1, 0 );
        lblElevation = new QLabel( grpParams );
        grpParamsLayout->addWidget( lblElevation, 1, 1 );
    }
    else
    {
        grpParams = NULL;
        lblAzimuthStatic = NULL;
        lblAzimuth = NULL;
        lblElevationStatic = NULL;
        lblElevation = NULL;
    }

    /* the drawing area */    
    sailDisp = new CSailViewer(this, viewMode, showSliders);
    sailDisp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    /* controls groupbox */
    grpControls = new QGroupBox( this );
    QVBoxLayout *grpControlsLayout = new QVBoxLayout( grpControls );

    btnResetView = new QPushButton( grpControls );
    grpControlsLayout->addWidget( btnResetView );
    btnZoomIn = new QPushButton( grpControls );
    grpControlsLayout->addWidget( btnZoomIn );
    btnZoomOut = new QPushButton( grpControls );
    grpControlsLayout->addWidget( btnZoomOut );
    if (viewMode == WIREFRAME && show_labeling)
    {
        btnLabeling = new QPushButton( grpControls );
        grpControlsLayout->addWidget( btnLabeling );
    }
    else
    {
        btnLabeling = NULL;
    }

    
    /* put it all together */
    QHBoxLayout *layout = new QHBoxLayout( this );
    layout->addWidget( sailDisp );
    
    QVBoxLayout *vbox = new QVBoxLayout();    
    vbox->addWidget( grpControls );
    vbox->addItem( new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding) );
    if (showSliders)
    {
        vbox->addWidget( grpParams );
    }
    layout->addLayout( vbox );

    
    /* set language and size */
    languageChange();

    /* connect signals */
    connect( sailDisp, SIGNAL( azimuthChanged(real) ), this, SLOT(slotAzimuth(real)) );
    connect( sailDisp, SIGNAL( elevationChanged(real) ), this, SLOT(slotElevation(real)) );

    if (btnLabeling)
    {
        connect( (QWidget*) btnLabeling, SIGNAL( clicked() ), sailDisp, SLOT( slotLabeling() ));
    }
    connect( (QWidget*) btnResetView, SIGNAL( clicked() ), sailDisp, SLOT( slotResetView() ));
    connect( (QWidget*) btnZoomIn, SIGNAL( clicked() ), sailDisp, SLOT( slotZoomIn() ));
    connect( (QWidget*) btnZoomOut, SIGNAL( clicked() ), sailDisp, SLOT( slotZoomOut() ));
}


Generated by  Doxygen 1.6.0   Back to index