Ejemplo n.º 1
0
CompassGrid::CompassGrid( QWidget *parent ):
    QFrame( parent )
{
    QPalette p = palette();
    p.setColor( backgroundRole(), Qt::gray );
    setPalette( p );

    setAutoFillBackground( true );

    QGridLayout *layout = new QGridLayout( this );
    layout->setSpacing( 5 );
    layout->setMargin( 0 );

    int i;
    for ( i = 0; i < 6; i++ )
    {
        QwtCompass *compass = createCompass( i );
        layout->addWidget( compass, i / 3, i % 3 );
    }

    for ( i = 0; i < layout->columnCount(); i++ )
        layout->setColumnStretch( i, 1 );
}
Ejemplo n.º 2
0
void DataWidget::setUI()
{

    mainLayout = new QHBoxLayout();
    horizonLayout = new QVBoxLayout();
    horizonData = new QGridLayout();
    compassLayout = new QVBoxLayout();
    compassData = new QGridLayout();
    altLayout = new QVBoxLayout();
    altData = new QGridLayout();

    yawLabel = new QLabel();
    yawLabel->setObjectName(QString::fromUtf8("yawLabel"));
    yawLabel->setGeometry(QRect(260, 130, 41, 21));
    altdLabel = new QLabel();
    altdLabel->setObjectName(QString::fromUtf8("altdLabel"));
    altdLabel->setGeometry(QRect(260, 290, 41, 21));
    pitchLabel = new QLabel();
    pitchLabel->setObjectName(QString::fromUtf8("pitchLabel"));
    pitchLabel->setGeometry(QRect(70, 250, 41, 21));
    rollLabel = new QLabel();
    rollLabel->setObjectName(QString::fromUtf8("rollLabel"));
    rollLabel->setGeometry(QRect(70, 270, 41, 21));
    pitchValue = new QLabel();
    pitchValue->setObjectName(QString::fromUtf8("pitchValue"));
    pitchValue->setGeometry(QRect(110, 250, 65, 21));
    pitchValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    rollValue = new QLabel();
    rollValue->setObjectName(QString::fromUtf8("rollValue"));
    rollValue->setGeometry(QRect(110, 270, 65, 21));
    rollValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    altdValue = new QLabel();
    altdValue->setObjectName(QString::fromUtf8("altdValue"));
    altdValue->setGeometry(QRect(300, 290, 65, 21));
    altdValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    yawValue = new QLabel();
    yawValue->setObjectName(QString::fromUtf8("yawValue"));
    yawValue->setGeometry(QRect(300, 130, 65, 21));
    yawValue->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    yawG = new QLabel();
    yawG->setObjectName(QString::fromUtf8("yawG"));
    yawG->setGeometry(QRect(370, 130, 16, 21));
    pitchG = new QLabel();
    pitchG->setObjectName(QString::fromUtf8("pitchG"));
    pitchG->setGeometry(QRect(180, 250, 16, 21));
    rollG = new QLabel();
    rollG->setObjectName(QString::fromUtf8("rollG"));
    rollG->setGeometry(QRect(180, 270, 16, 21));
    altdM = new QLabel();
    altdM->setObjectName(QString::fromUtf8("altdM"));
    altdM->setGeometry(QRect(370, 290, 16, 21));

    yawLabel->setText(QApplication::translate("DataWidget", "Yaw:", 0, QApplication::UnicodeUTF8));
    altdLabel->setText(QApplication::translate("DataWidget", "Altd.:", 0, QApplication::UnicodeUTF8));
    pitchLabel->setText(QApplication::translate("DataWidget", "Pitch:", 0, QApplication::UnicodeUTF8));
    rollLabel->setText(QApplication::translate("DataWidget", "Roll:", 0, QApplication::UnicodeUTF8));
    pitchValue->setText(QApplication::translate("DataWidget", "0", 0, QApplication::UnicodeUTF8));
    rollValue->setText(QApplication::translate("DataWidget", "0", 0, QApplication::UnicodeUTF8));
    altdValue->setText(QApplication::translate("DataWidget", "10", 0, QApplication::UnicodeUTF8));
    yawValue->setText(QApplication::translate("DataWidget", "0", 0, QApplication::UnicodeUTF8));
    yawG->setText(QApplication::translate("DataWidget", "\302\272", 0, QApplication::UnicodeUTF8));
    pitchG->setText(QApplication::translate("DataWidget", "\302\272", 0, QApplication::UnicodeUTF8));
    rollG->setText(QApplication::translate("DataWidget", "\302\272", 0, QApplication::UnicodeUTF8));
    altdM->setText(QApplication::translate("DataWidget", "m", 0, QApplication::UnicodeUTF8));

    horizonData->addWidget(pitchLabel,0,0,Qt::AlignCenter);
    horizonData->addWidget(pitchValue,0,1,Qt::AlignCenter);
    horizonData->addWidget(pitchG,0,2,Qt::AlignCenter);
    horizonData->addWidget(rollLabel,1,0,Qt::AlignCenter);
    horizonData->addWidget(rollValue,1,1,Qt::AlignCenter);
    horizonData->addWidget(rollG,1,2,Qt::AlignCenter);

    compassData->addWidget(yawLabel,0,0,Qt::AlignCenter);
    compassData->addWidget(yawValue,0,1,Qt::AlignCenter);

    altData->addWidget(altdLabel,0,0,Qt::AlignCenter);
    altData->addWidget(altdValue,0,1,Qt::AlignCenter);

    horizon=createDial(0);
    horizon->setGeometry(QRect(750,80,200,200));
    horizon->setMinimumSize(200,200);
    horizonLayout->addWidget(horizon);
    horizonLayout->addLayout(horizonData);

    compass=createCompass(1);
    compass->setGeometry(QRect(0,0,200,200));
    compass->setMinimumSize(200,200);
    compass->setReadOnly(true);
    compassLayout->addWidget(compass);
    compassLayout->addLayout(compassData);

    altd=createDial(2);
    altd->setGeometry(QRect(970,200,115,135));
    altd->setMinimumSize(115,135);
    altLayout->addWidget(altd);
    altLayout->addLayout(altData);

    mainLayout->addLayout(horizonLayout);
    mainLayout->addLayout(compassLayout);
    mainLayout->addLayout(altLayout);
    setLayout(mainLayout);

}