Exemplo n.º 1
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QSpinBox *spinBox = new QSpinBox;
      spinBox->setRange(1,100);        //set range of spinBox's values
      spinBox->setSuffix(" MB");       // set suffix after our values
      spinBox->setButtonSymbols(QSpinBox::PlusMinus);
      spinBox->setWrapping(true);  // loop mode activating
      spinBox->setFixedHeight(100);
      spinBox->setFixedWidth(100);
      spinBox->move(430,340);
    spinBox->show();


    return a.exec();
}
Exemplo n.º 2
0
int main(int argc, char** argv) {
	QApplication app(argc, argv);

	QWidget wgt;
	wgt.setWindowTitle("Spin Boxes");

	QLabel* plblCount = new QLabel("Megabytes:");	
	QLabel* plblDate = new QLabel("Date and Time:");
	QLabel* plblValid = new QLabel("Name:");

	QSpinBox spb;
	spb.setRange(1, 100);
	spb.setSuffix(" MB");
	spb.setButtonSymbols(QSpinBox::PlusMinus);
	spb.setWrapping(true);
	spb.resize(100, 30);

	plblCount->setBuddy(&spb);
	QObject::connect(&spb, SIGNAL(valueChanged(const QString&)), plblCount, SLOT(setText(const QString&)));

	QDateTimeEdit dateTimeEdit(QDateTime::currentDateTime());

	QLineEdit* ptxt = new QLineEdit;

	NameValidator* pnameValidator = new NameValidator(ptxt);
	ptxt->setValidator(pnameValidator);
	plblValid->setBuddy(ptxt);

	QVBoxLayout* pvbxLayout = new QVBoxLayout;
	pvbxLayout->addWidget(plblCount);
	pvbxLayout->addWidget(&spb);
	pvbxLayout->addWidget(plblDate);
	pvbxLayout->addWidget(&dateTimeEdit);
	pvbxLayout->addWidget(plblValid);
	pvbxLayout->addWidget(ptxt);

	wgt.setLayout(pvbxLayout);
	wgt.resize(230, 180);
	wgt.show();
	return app.exec();
}
Exemplo n.º 3
0
void Window::createBottomBar() {
    bottomBar = new QToolBar();
    bottomBar->setOrientation(Qt::Horizontal);
    bottomBar->setFloatable(false);
    bottomBar->setMovable(false);

    //QLabel* linhaColorLabel = new QLabel("Linha");
    //bottomBar->addWidget(linhaColorLabel);
    linhaColorButton = new QToolButton();
    linhaColorButton->setToolTip("Cor de linha");
    linhaColorButton->setAutoRaise(true);
    updateLinhaButton();
    bottomBar->addWidget(linhaColorButton);
    QObject::connect(linhaColorButton, SIGNAL(clicked()), this, SLOT(setLinhaColor()));

    //QLabel* fillColorLabel = new QLabel("Fill");
    //bottomBar->addWidget(fillColorLabel);
    fillColorButton = new QToolButton();
    updateFillButton();
    fillColorButton->setAutoRaise(true);
    fillColorButton->setToolTip("Cor de preenchimento");
    fillColorButton->setAutoRaise(true);
    bottomBar->addWidget(fillColorButton);
    QObject::connect(fillColorButton, SIGNAL(clicked()), this, SLOT(setFillColor()));

    bottomBar->addSeparator();

    QLabel* espessuraLinhaLabel = new QLabel("Espessura");
    QSpinBox* espessuraLinhaSpinBox = new QSpinBox();
    espessuraLinhaSpinBox->setSuffix(" px");
    espessuraLinhaSpinBox->setMinimum(1);
    espessuraLinhaSpinBox->setMaximum(50);
    espessuraLinhaSpinBox->setSingleStep(1);
    espessuraLinhaSpinBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
    bottomBar->addWidget(espessuraLinhaLabel);
    bottomBar->addWidget(espessuraLinhaSpinBox);
    QObject::connect(espessuraLinhaSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setEspessuraLinha(int)));

    bottomBar->addSeparator();

    QLabel* estiloLinhaLabel = new QLabel("Estilo");
    estiloLinhaField = new QLineEdit();
    estiloLinhaField->setMaximumWidth(150);
    estiloLinhaField->setText("-");
    QRegExp expr("[-][-,.]+");
    QRegExpValidator *v = new QRegExpValidator(expr, 0);
    estiloLinhaField->setValidator(v);
    bottomBar->addWidget(estiloLinhaLabel);
    bottomBar->addWidget(estiloLinhaField);
    QObject::connect(estiloLinhaField, SIGNAL(textChanged(QString)), this, SLOT(setEstiloLinha(QString)));


    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    bottomBar->addWidget(spacer);

    toggleGradeButton = new QToolButton();
    toggleGradeButton->setIcon(QIcon(":/images/grade.png"));
    toggleGradeButton->setCheckable(true);
    toggleGradeButton->setToolTip("Mostrar/ocultar grade");
    bottomBar->addWidget(toggleGradeButton);
    QObject::connect(toggleGradeButton, SIGNAL(clicked()), this, SLOT(toggleGrade()));

    QSpinBox* zoomSpinBox = new QSpinBox();
    zoomSpinBox->setSuffix("%");
    zoomSpinBox->setMinimum(25);
    zoomSpinBox->setMaximum(1000);
    zoomSpinBox->setValue(100);
    zoomSpinBox->setSingleStep(5);
    bottomBar->addWidget(zoomSpinBox);

}
Exemplo n.º 4
0
void PrimaryGPSStatusTab::readPacket(std::shared_ptr<Packet> packet) {
  if (packet->instanceOfGroup()) {
    const Group& group = packet->groupCast();
    if (group.instanceOf<PrimaryGPSStatus>()) {
      enableFields(true);
      const PrimaryGPSStatus& msg = group.typeCast<PrimaryGPSStatus>();
      mUi->navPrimGPSText->setText(
        mStatusMsg[msg.mNavigationSolutionStatus].c_str());
      mUi->satPrimGPSSpinBox->setValue(msg.mNumberOfSVTracked);
      mUi->primGPSTypeText->setText(mGPSTypeMsg[msg.mGPSReceiverType].c_str());
      mUi->geoidalPrimGPSSpinBox->setValue(msg.mGeoidalSeparation);
      mUi->hdopSpinBox->setValue(msg.mHDOP);
      mUi->vdopSpinBox->setValue(msg.mVDOP);
      mUi->dgpsIDSpinBox->setValue(msg.mDGPSReferenceID);
      mUi->corrLatencySpinBox->setValue(msg.mDGPSCorrectionLatency);
      mUi->navLatencySpinBox->setValue(msg.mGPSNavigationMessageLatency);
      mUi->weekSpinBox->setValue(msg.mGPSUTCWeekNumber);
      mUi->offsetSpinBox->setValue(msg.mGPSUTCTimeOffset);
      while (mUi->channelsTable->rowCount())
        mUi->channelsTable->removeRow(mUi->channelsTable->rowCount() - 1);
      for (size_t i = 0; i < msg.mChannelNumber; ++i) {
        mUi->channelsTable->insertRow(mUi->channelsTable->rowCount());
        QSpinBox* PRN = new QSpinBox;
        PRN->setReadOnly(true);
        PRN->setValue(msg.mChannelStatusData[i].mSVPRN);
        PRN->setButtonSymbols(QAbstractSpinBox::NoButtons);
        mUi->channelsTable->setCellWidget(mUi->channelsTable->rowCount() - 1, 0,
          PRN);
        QLineEdit* status = new QLineEdit;
        status->setReadOnly(true);
        status->setText(mChannelStatusMsg[
          msg.mChannelStatusData[i].mChannelTrackingStatus].c_str());
        mUi->channelsTable->setCellWidget(mUi->channelsTable->rowCount() - 1, 1,
          status);
        QDoubleSpinBox* azimuth = new QDoubleSpinBox;
        azimuth->setReadOnly(true);
        azimuth->setValue(msg.mChannelStatusData[i].mSVAzimuth);
        azimuth->setButtonSymbols(QAbstractSpinBox::NoButtons);
        mUi->channelsTable->setCellWidget(mUi->channelsTable->rowCount() - 1, 2,
          azimuth);
        QDoubleSpinBox* elevation = new QDoubleSpinBox;
        elevation->setReadOnly(true);
        elevation->setValue(msg.mChannelStatusData[i].mSVElevation);
        elevation->setButtonSymbols(QAbstractSpinBox::NoButtons);
        mUi->channelsTable->setCellWidget(mUi->channelsTable->rowCount() - 1, 3,
          elevation);
        QDoubleSpinBox* l1snr = new QDoubleSpinBox;
        l1snr->setReadOnly(true);
        l1snr->setValue(msg.mChannelStatusData[i].mSVL1SNR);
        l1snr->setButtonSymbols(QAbstractSpinBox::NoButtons);
        mUi->channelsTable->setCellWidget(mUi->channelsTable->rowCount() - 1, 4,
          l1snr);
        QDoubleSpinBox* l2snr = new QDoubleSpinBox;
        l2snr->setReadOnly(true);
        l2snr->setValue(msg.mChannelStatusData[i].mSVL2SNR);
        l2snr->setButtonSymbols(QAbstractSpinBox::NoButtons);
        mUi->channelsTable->setCellWidget(mUi->channelsTable->rowCount() - 1, 5,
          l2snr);
      }
    }
    if (group.instanceOf<PPSTimeRecoveryStatus>()) {
      const PPSTimeRecoveryStatus& msg =
        group.typeCast<PPSTimeRecoveryStatus>();
      mUi->ppsSpinBox->setValue(msg.mPPSCount);
      mUi->timeStatusText->setText(
        mTimeSyncMsg[msg.mTimeSynchroStatus].c_str());
    }
  }
}