Example #1
0
int main(int argc, char *argv[]){
	QApplication app(argc, argv);
	
	QWidget *window = new QWidget;
	window->setWindowTitle("Enter Your Age");
	
	QSpinBox *spinBox = new QSpinBox;
	QSlider *slider = new QSlider(Qt::Horizontal);
	spinBox->setRange(0, 130);
	slider->setRange(0, 130);
	
	QObject::connect(spinBox, SIGNAL(valueChanged(int)),
		slider, SLOT(setValue(int)));
	QObject::connect(slider, SIGNAL(valueChanged(int)),
		spinBox, SLOT(setValue(int)));
	spinBox->setValue(35);
	
	QHBoxLayout *layout = new QHBoxLayout;
	layout->addWidget(spinBox);
	layout->addWidget(slider);
	window->setLayout(layout);
	
	window->show();
	
	return app.exec();	
}
void VCMatrixPresetSelection::displayProperties(RGBScript *script)
{
    if (script == NULL)
        return;

    int gridRowIdx = 0;

    QList<RGBScriptProperty> properties = script->properties();
    if (properties.count() > 0)
        m_propertiesGroup->show();
    else
        m_propertiesGroup->hide();

    foreach(RGBScriptProperty prop, properties)
    {
        switch(prop.m_type)
        {
            case RGBScriptProperty::List:
            {
                QLabel *propLabel = new QLabel(prop.m_displayName);
                m_propertiesLayout->addWidget(propLabel, gridRowIdx, 0);
                QComboBox *propCombo = new QComboBox(this);
                propCombo->addItems(prop.m_listValues);
                propCombo->setProperty("pName", prop.m_name);
                QString pValue = script->property(prop.m_name);
                if (!pValue.isEmpty())
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
                    propCombo->setCurrentText(pValue);
#else
                    propCombo->setCurrentIndex(propCombo->findText(pValue));
#endif
                connect(propCombo, SIGNAL(currentIndexChanged(QString)),
                        this, SLOT(slotPropertyComboChanged(QString)));
                m_propertiesLayout->addWidget(propCombo, gridRowIdx, 1);
                gridRowIdx++;
            }
            break;
            case RGBScriptProperty::Range:
            {
                QLabel *propLabel = new QLabel(prop.m_displayName);
                m_propertiesLayout->addWidget(propLabel, gridRowIdx, 0);
                QSpinBox *propSpin = new QSpinBox(this);
                propSpin->setRange(prop.m_rangeMinValue, prop.m_rangeMaxValue);
                propSpin->setProperty("pName", prop.m_name);
                QString pValue = script->property(prop.m_name);
                if (!pValue.isEmpty())
                    propSpin->setValue(pValue.toInt());
                connect(propSpin, SIGNAL(valueChanged(int)),
                        this, SLOT(slotPropertySpinChanged(int)));
                m_propertiesLayout->addWidget(propSpin, gridRowIdx, 1);
                gridRowIdx++;
            }
            break;
            default:
                qWarning() << "Type" << prop.m_type << "not handled yet";
            break;
        }
    }
}
Example #3
0
QWidget *spinDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
                                    const QModelIndex &index) const
{
    QSpinBox *editor = new QSpinBox(parent);
    editor->setRange(0, 10000);
    editor->installEventFilter(const_cast<spinDelegate *>(this));
    return editor;
}
Example #4
0
QWidget *ProcessingCropBelowLevel::createGUI(void)
{
	QSpinBox *spinBox = new QSpinBox;
	spinBox->setRange(0, 32767);
	spinBox->setValue(level);
	connect(spinBox, SIGNAL(valueChanged(int)), SLOT(levelChanged(int)));
	return spinBox;
}
Example #5
0
//! [0]
MainWindow::MainWindow()
{
    selectedDate = QDate::currentDate();
    fontSize = 10;

    QWidget *centralWidget = new QWidget;
//! [0]

//! [1]
    QLabel *dateLabel = new QLabel(tr("Date:"));
    QComboBox *monthCombo = new QComboBox;

    for (int month = 1; month <= 12; ++month)
        monthCombo->addItem(QDate::longMonthName(month));

    QDateTimeEdit *yearEdit = new QDateTimeEdit;
    yearEdit->setDisplayFormat("yyyy");
    yearEdit->setDateRange(QDate(1753, 1, 1), QDate(8000, 1, 1));
//! [1]

    monthCombo->setCurrentIndex(selectedDate.month() - 1);
    yearEdit->setDate(selectedDate);

//! [2]
    QLabel *fontSizeLabel = new QLabel(tr("Font size:"));
    QSpinBox *fontSizeSpinBox = new QSpinBox;
    fontSizeSpinBox->setRange(1, 64);
    fontSizeSpinBox->setValue(10);

    editor = new QTextBrowser;
    insertCalendar();
//! [2]

//! [3]
    connect(monthCombo, SIGNAL(activated(int)), this, SLOT(setMonth(int)));
    connect(yearEdit, SIGNAL(dateChanged(QDate)), this, SLOT(setYear(QDate)));
    connect(fontSizeSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(setFontSize(int)));
//! [3]

//! [4]
    QHBoxLayout *controlsLayout = new QHBoxLayout;
    controlsLayout->addWidget(dateLabel);
    controlsLayout->addWidget(monthCombo);
    controlsLayout->addWidget(yearEdit);
    controlsLayout->addSpacing(24);
    controlsLayout->addWidget(fontSizeLabel);
    controlsLayout->addWidget(fontSizeSpinBox);
    controlsLayout->addStretch(1);

    QVBoxLayout *centralLayout = new QVBoxLayout;
    centralLayout->addLayout(controlsLayout);
    centralLayout->addWidget(editor, 1);
    centralWidget->setLayout(centralLayout);

    setCentralWidget(centralWidget);
//! [4]
}
Example #6
0
void Window::createDoubleSpinBoxes() {
  doubleSpinBoxesGroup = new QGroupBox(tr("Double precision spinboxes"));

  QLabel *precisionLabel = new QLabel(tr("Number of decimal places to show:"));
  QSpinBox *precisionSpinBox = new QSpinBox;
  precisionSpinBox->setRange(0, 100);
  precisionSpinBox->setValue(2);

  QLabel *doubleLabel =
      new QLabel(tr("Enter a value between %1 and %2:").arg(-20).arg(20));
  doubleSpinBox = new QDoubleSpinBox;
  doubleSpinBox->setRange(-20.0, 20.0);
  doubleSpinBox->setSingleStep(1.0);
  doubleSpinBox->setValue(0.0);

  QLabel *scaleLabel = new QLabel(
      tr("Enter a scale factor between %1 and %2:").arg(0).arg(1000.0));
  scaleSpinBox = new QDoubleSpinBox;
  scaleSpinBox->setRange(0.0, 1000.0);
  scaleSpinBox->setSingleStep(10.0);
  scaleSpinBox->setSuffix("%");
  scaleSpinBox->setSpecialValueText(tr("No scaling"));
  scaleSpinBox->setValue(100.0);

  QLabel *priceLabel =
      new QLabel(tr("Enter a price between %1 and %2:").arg(0).arg(1000));
  priceSpinBox = new QDoubleSpinBox;
  priceSpinBox->setRange(0.0, 1000.0);
  priceSpinBox->setSingleStep(1.0);
  priceSpinBox->setPrefix(tr("$"));
  priceSpinBox->setValue(99.99);
  connect(precisionSpinBox, SIGNAL(valueChanged(int)), this,
          SLOT(changePrecision(int)));

  groupSeparatorSpinBox_d = new QDoubleSpinBox;
  groupSeparatorSpinBox_d->setRange(-99999999, 99999999);
  groupSeparatorSpinBox_d->setDecimals(2);
  groupSeparatorSpinBox_d->setValue(1000.00);
  groupSeparatorSpinBox_d->setGroupSeparatorShown(true);
  QCheckBox *groupSeparatorChkBox = new QCheckBox;
  groupSeparatorChkBox->setText(tr("Show group separator"));
  groupSeparatorChkBox->setChecked(true);
  connect(groupSeparatorChkBox, &QCheckBox::toggled, groupSeparatorSpinBox_d,
          &QDoubleSpinBox::setGroupSeparatorShown);

  QVBoxLayout *spinBoxLayout = new QVBoxLayout;
  spinBoxLayout->addWidget(precisionLabel);
  spinBoxLayout->addWidget(precisionSpinBox);
  spinBoxLayout->addWidget(doubleLabel);
  spinBoxLayout->addWidget(doubleSpinBox);
  spinBoxLayout->addWidget(scaleLabel);
  spinBoxLayout->addWidget(scaleSpinBox);
  spinBoxLayout->addWidget(priceLabel);
  spinBoxLayout->addWidget(priceSpinBox);
  spinBoxLayout->addWidget(groupSeparatorChkBox);
  spinBoxLayout->addWidget(groupSeparatorSpinBox_d);
  doubleSpinBoxesGroup->setLayout(spinBoxLayout);
}
Example #7
0
QWidget* IntProperty::createEditor( QWidget* parent,
                                    const QStyleOptionViewItem& option )
{
  QSpinBox* editor = new QSpinBox( parent );
  editor->setFrame( false );
  editor->setRange( min_, max_ );
  connect( editor, SIGNAL( valueChanged( int )), this, SLOT( setInt( int )));
  return editor;
}
Example #8
0
AddD::AddD(Settings &sets, QWidget *parent, QObject *moduleSetsW) :
	QDialog(parent), moduleSetsW(moduleSetsW), sets(sets), hzW(NULL)
{
	QGroupBox *gB = NULL;
	if (parent)
	{
		setWindowTitle(tr("Tone generator"));
		setWindowIcon(QIcon(":/sine"));
	}
	else
		gB = new QGroupBox(tr("Tone generator"));

	QLabel *channelsL = new QLabel(tr("Channel count") + ": ");

	QSpinBox *channelsB = new QSpinBox;
	connect(channelsB, SIGNAL(valueChanged(int)), this, SLOT(channelsChanged(int)));

	QLabel *srateL = new QLabel(tr("Sample rate") + ": ");

	srateB = new QSpinBox;
	srateB->setRange(4, 384000);
	srateB->setSuffix(" Hz");
	srateB->setValue(sets.getInt("ToneGenerator/srate"));

	QDialogButtonBox *bb = NULL;
	QPushButton *addB = NULL;
	if (parent)
	{
		bb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
		connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
		connect(bb, SIGNAL(rejected()), this, SLOT(reject()));
	}
	else
	{
		addB = new QPushButton(tr("Play"));
		addB->setIcon(QIcon(":/sine"));
		connect(addB, SIGNAL(clicked()), this, SLOT(add()));
	}

	layout = new QGridLayout(parent ? (QWidget *)this : (QWidget *)gB);
	layout->addWidget(channelsL, 0, 0, 1, 1);
	layout->addWidget(channelsB, 0, 1, 1, 1);
	layout->addWidget(srateL, 1, 0, 1, 1);
	layout->addWidget(srateB, 1, 1, 1, 1);
	if (parent)
		layout->addWidget(bb, 3, 0, 1, 2);
	else
	{
		layout->addWidget(addB, 3, 0, 1, 2);
		QGridLayout *layout = new QGridLayout(this);
		layout->setMargin(0);
		layout->addWidget(gB);
	}

	channelsB->setRange(1, 8);
	channelsB->setValue(sets.getString("ToneGenerator/freqs").split(',').count());
}
Example #9
0
//! [14]
void Window::createDoubleSpinBoxes()
{
    doubleSpinBoxesGroup = new QGroupBox(tr("Double precision spinboxes"));

    QLabel *precisionLabel = new QLabel(tr("Number of decimal places "
                                           "to show:"));
    QSpinBox *precisionSpinBox = new QSpinBox;
    precisionSpinBox->setRange(0, 100);
    precisionSpinBox->setValue(2);
//! [14]

//! [15]
    QLabel *doubleLabel = new QLabel(tr("Enter a value between "
        "%1 and %2:").arg(-20).arg(20));
    doubleSpinBox = new QDoubleSpinBox;
    doubleSpinBox->setRange(-20.0, 20.0);
    doubleSpinBox->setSingleStep(1.0);
    doubleSpinBox->setValue(0.0);
//! [15]

//! [16]
    QLabel *scaleLabel = new QLabel(tr("Enter a scale factor between "
        "%1 and %2:").arg(0).arg(1000.0));
    scaleSpinBox = new QDoubleSpinBox;
    scaleSpinBox->setRange(0.0, 1000.0);
    scaleSpinBox->setSingleStep(10.0);
    scaleSpinBox->setSuffix("%");
    scaleSpinBox->setSpecialValueText(tr("No scaling"));
    scaleSpinBox->setValue(100.0);
//! [16]

//! [17]
    QLabel *priceLabel = new QLabel(tr("Enter a price between "
        "%1 and %2:").arg(0).arg(1000));
    priceSpinBox = new QDoubleSpinBox;
    priceSpinBox->setRange(0.0, 1000.0);
    priceSpinBox->setSingleStep(1.0);
    priceSpinBox->setPrefix("$");
    priceSpinBox->setValue(99.99);

    connect(precisionSpinBox, SIGNAL(valueChanged(int)),
//! [17]
            this, SLOT(changePrecision(int)));

//! [18]
    QVBoxLayout *spinBoxLayout = new QVBoxLayout;
    spinBoxLayout->addWidget(precisionLabel);
    spinBoxLayout->addWidget(precisionSpinBox);
    spinBoxLayout->addWidget(doubleLabel);
    spinBoxLayout->addWidget(doubleSpinBox);
    spinBoxLayout->addWidget(scaleLabel);
    spinBoxLayout->addWidget(scaleSpinBox);
    spinBoxLayout->addWidget(priceLabel);
    spinBoxLayout->addWidget(priceSpinBox);
    doubleSpinBoxesGroup->setLayout(spinBoxLayout);
}
Example #10
0
TtipMelody::TtipMelody(TquestionPoint *point) :
    TtipChart(point)
{
    setBgColor(point->color());
    setPlainText(" ");

    m_w = new QWidget();
    m_w->setObjectName("m_melodyView");
    m_w->setStyleSheet("QWidget#m_melodyView { background: transparent }");
    QString txt;
    if (point->nr())
        txt = QString(TquestionAsWdg::questionTxt() + " <big><b>%1.</b></big>").arg(point->nr());
    if (point->question()->questionAsNote() && point->question()->answerAsSound())
        txt += (" <b>" + TexTrans::playMelodyTxt() + "</b>");
    else if (point->question()->questionAsSound() && point->question()->answerAsNote())
        txt += (" <b>" + TexTrans::writeMelodyTxt() + "</b>");
    QLabel *headLab = new QLabel(txt, m_w);
    headLab->setAlignment(Qt::AlignCenter);
    m_score = new TmelodyView(qa()->question()->melody(), m_w);
    m_score->setFixedHeight(qApp->desktop()->availableGeometry().height() / 12);
    if (point->question()->exam()) {
        if (point->question()->exam()->level()->showStrNr)
            m_score->showStringNumbers(true);
    }
    QSpinBox *spinAtt = new QSpinBox(m_w);
    spinAtt->setRange(0, qa()->question()->attemptsCount());
    spinAtt->setPrefix(TexTrans::attemptTxt() + " ");
    spinAtt->setSuffix(" " + tr("of", "It will give text: 'Attempt x of y'") + QString(" %1").arg(qa()->question()->attemptsCount()));
    m_attemptLabel = new QLabel(m_w);
    m_resultLabel = new QLabel(wasAnswerOKtext(point->question(), point->color()).replace("<br>", " "), m_w);
    m_resultLabel->setAlignment(Qt::AlignCenter);
//   txt = wasAnswerOKtext(point->question(), point->color()).replace("<br>", " ") + "<br>";
    txt = tr("Melody was played <b>%n</b> times", "", qa()->question()->totalPlayBacks()) + "<br>";
    txt += TexTrans::effectTxt() + QString(": <big><b>%1%</b></big>, ").arg(point->question()->effectiveness(), 0, 'f', 1, '0');
    txt += TexTrans::reactTimeTxt() + QString("<big><b>  %1</b></big>").arg(Texam::formatReactTime(point->question()->time, true));
    QLabel *sumLab = new QLabel(txt, m_w);
    sumLab->setAlignment(Qt::AlignCenter);

    QVBoxLayout *lay = new QVBoxLayout;
    lay->addWidget(headLab);
    lay->addWidget(m_score, 0, Qt::AlignCenter);
    QHBoxLayout *attLay = new QHBoxLayout;
    attLay->addStretch();
    attLay->addWidget(spinAtt);
    attLay->addStretch();
    lay->addLayout(attLay);
    lay->addWidget(m_attemptLabel);
    lay->addWidget(m_resultLabel);
    lay->addWidget(sumLab);

    m_w->setLayout(lay);
    m_widget = point->scene()->addWidget(m_w);
    m_widget->setParentItem(this);

    connect(spinAtt, SIGNAL(valueChanged(int)), this, SLOT(attemptChanged(int)));
}
QWidget *SpinBoxDelegate::createEditor(QWidget *parent,
                                       const QStyleOptionViewItem &/* option */,
                                       const QModelIndex &/* index */) const
{
    QSpinBox *editor = new QSpinBox(parent);
    editor->setRange(0, 1000000);
    connect(editor, SIGNAL(valueChanged(int)), SIGNAL(sbd_valueChanged(int)));
    connect(editor, SIGNAL(editingFinished()), SIGNAL(sbd_editingFinished()));
    return editor;
}
void SpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    int value = index.model()->data(index, Qt::EditRole).toInt();
    int min = index.model()->data(index, Role::Minimum).toInt();
    int max = index.model()->data(index, Role::Maximum).toInt();

    QSpinBox *box = static_cast<QSpinBox*>(editor);
    box->setRange( min, max );
    box->setValue( value );
}
Example #13
0
//! [1]
void Window::createSpinBoxes()
{
    spinBoxesGroup = new QGroupBox(tr("Spinboxes"));

    QLabel *integerLabel = new QLabel(tr("Enter a value between "
        "%1 and %2:").arg(-20).arg(20));
    QSpinBox *integerSpinBox = new QSpinBox;
    integerSpinBox->setRange(-20, 20);
    integerSpinBox->setSingleStep(1);
    integerSpinBox->setValue(0);
//! [1]

//! [2]
    QLabel *zoomLabel = new QLabel(tr("Enter a zoom value between "
        "%1 and %2:").arg(0).arg(1000));
//! [3]
    QSpinBox *zoomSpinBox = new QSpinBox;
    zoomSpinBox->setRange(0, 1000);
    zoomSpinBox->setSingleStep(10);
    zoomSpinBox->setSuffix("%");
    zoomSpinBox->setSpecialValueText(tr("Automatic"));
    zoomSpinBox->setValue(100);
//! [2] //! [3]

//! [4]
    QLabel *priceLabel = new QLabel(tr("Enter a price between "
        "%1 and %2:").arg(0).arg(999));
    QSpinBox *priceSpinBox = new QSpinBox;
    priceSpinBox->setRange(0, 999);
    priceSpinBox->setSingleStep(1);
    priceSpinBox->setPrefix("$");
    priceSpinBox->setValue(99);
//! [4] //! [5]

    QVBoxLayout *spinBoxLayout = new QVBoxLayout;
    spinBoxLayout->addWidget(integerLabel);
    spinBoxLayout->addWidget(integerSpinBox);
    spinBoxLayout->addWidget(zoomLabel);
    spinBoxLayout->addWidget(zoomSpinBox);
    spinBoxLayout->addWidget(priceLabel);
    spinBoxLayout->addWidget(priceSpinBox);
    spinBoxesGroup->setLayout(spinBoxLayout);
}
Example #14
0
QWidget *SpinBoxItem::createEditor() const
{
    // create a spinbox editor
    QSpinBox *spinbox = new QSpinBox(table()->viewport());
    spinbox->setSuffix(" ns");
    if (field_ == OFFSET) {
        spinbox->setRange(-1, INT_MAX);
        spinbox->setValue(node_->autoOffset() ? -1 : (int)node_->offset());
        spinbox->setSpecialValueText
            (QString("Auto (%1 ns)").arg(node_->offset()));
    }
    else {
        spinbox->setRange(0, INT_MAX);
        spinbox->setValue(field_ == CLOCK
                           ? node_->clock()
                           : node_->runtime());
    }

    return spinbox;
}
QWidget *
CQPropertyIntegerEditor::
createEdit(QWidget *parent)
{
  QSpinBox *spin = new QSpinBox(parent);

  spin->setRange(min_, max_);
  spin->setSingleStep(step_);

  return spin;
}
Example #16
0
QWidget *dSettingWindow::createWidget()
{
    QWidget * widget =  new QWidget();
    
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin(1);
    layout->setSpacing(5);
    layout->addWidget( new QLabel("Непрозрачноть окна (заначения от 0 до 100).<br>Прозрачные окна имеют проблемы с прорисовкой!") ); 

        QSpinBox *opacitySpinBox = new QSpinBox;
        opacitySpinBox->setRange(30, 100);
        opacitySpinBox->setSingleStep(1);
        opacitySpinBox->setValue(int(window->windowOpacity()*100));
        connect(opacitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(opacityValueChanged(int)));
        
        QSlider *opacitySlider = new QSlider(Qt::Horizontal);
        opacitySlider->setFocusPolicy(Qt::StrongFocus);
        opacitySlider->setTickPosition(QSlider::TicksBothSides);
        opacitySlider->setTickInterval(10);
        opacitySlider->setSingleStep(1);
        opacitySlider->setMaximum ( 100 );
        opacitySlider->setMinimum ( 30 );
        opacitySlider->setValue(opacitySpinBox->value());
        connect(opacitySlider, SIGNAL(valueChanged(int)), opacitySpinBox, SLOT(setValue(int)));
        connect(opacitySpinBox, SIGNAL(valueChanged(int)), opacitySlider, SLOT(setValue(int)));
    
        QHBoxLayout *opacityLayout = new QHBoxLayout;
        opacityLayout->setSpacing(15);
        opacityLayout->addWidget( opacitySpinBox );   
        opacityLayout->addWidget( opacitySlider );   
    
    layout->addItem( opacityLayout );   

        layout->addWidget( new QLabel("Изменение рамки окна. Есть возможность использовать стандартное окно,<br> но тогда пропадет эффект \"магнетизма\" окон.") );     
        QHBoxLayout *skinLayout = new QHBoxLayout;
        skinLayout->setSpacing(15);
        skinPushButton = new QPushButton(tr("Load skin"));
        skinPushButton->setDefault(true);
        skinPushButton->setIcon(QIcon(tr("pic/open32x32.png")));
        connect(skinPushButton, SIGNAL(clicked(bool)), this, SLOT(clickedSkinButton(bool)));
        skinLayout->addWidget( skinPushButton );
    
    
        QCheckBox *standartFrameCheckBox = new QCheckBox(tr("Стандартная рамка окна"));    
        connect(standartFrameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
        skinLayout->addWidget( standartFrameCheckBox );
        skinLayout->addStretch ( 1 );

    layout->addItem(skinLayout);

    widget->setLayout(layout); 

    return widget; 
};
Example #17
0
TestDialog::TestDialog(QToolTipTest *s) : style(s)
{
    // Notice that these tool tips will disappear if another tool tip is shown.
    QLabel *label1 = new QLabel(tr("Tooltip - Only two seconds display"));
    label1->setToolTip(tr("2 seconds display"));
    label1->setToolTipDuration(2000);
    Q_ASSERT(label1->toolTipDuration() == 2000);

    QLabel *label2 = new QLabel(tr("Tooltip - 30 seconds display time"));
    label2->setToolTip(tr("30 seconds display"));
    label2->setToolTipDuration(30000);

    QPushButton *pb = new QPushButton(tr("&Test"));
    pb->setToolTip(tr("Show some tool tips."));
    Q_ASSERT(pb->toolTipDuration() == -1);
    connect(pb, SIGNAL(clicked()), this, SLOT(showSomeToolTips()));

    QLabel *wakeLabel = new QLabel(tr("Wake Delay:"));
    QSpinBox *wakeSpinBox = new QSpinBox();
    wakeSpinBox->setRange(0, 100000);
    wakeSpinBox->setValue(style->styleHint(QStyle::SH_ToolTip_WakeUpDelay));
    connect(wakeSpinBox, SIGNAL(valueChanged(int)), style, SLOT(setWakeTime(int)));

    QLabel *sleepLabel = new QLabel(tr("Sleep Delay:"));
    QSpinBox *sleepSpinBox = new QSpinBox();
    sleepSpinBox->setRange(0, 100000);
    sleepSpinBox->setValue(style->styleHint(QStyle::SH_ToolTip_FallAsleepDelay));
    connect(sleepSpinBox, SIGNAL(valueChanged(int)), style, SLOT(setSleepTime(int)));

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(label1);
    layout->addWidget(label2);
    layout->addWidget(pb);
    layout->addWidget(wakeLabel);
    layout->addWidget(wakeSpinBox);
    layout->addWidget(wakeLabel);
    layout->addWidget(sleepLabel);
    layout->addWidget(sleepSpinBox);

    setLayout(layout);
}
Example #18
0
NewProjectDialog::NewProjectDialog(QWidget *parent)
    : QDialog(parent)
{
    QFormLayout *l = new QFormLayout;

    QValidator *validator = new QIntValidator(1, 65536, this);
    m_WidthEdit = new QLineEdit(this);
    m_WidthEdit->setText( "256" );
    m_WidthEdit->setValidator(validator);
    l->addRow("Width", m_WidthEdit);

    m_HeightEdit = new QLineEdit(this);
    m_HeightEdit->setValidator(validator);
    m_HeightEdit->setText( "256" );
    l->addRow("Height", m_HeightEdit);

    {
        QSpinBox* w = new QSpinBox(this);
        num_frames=1;
        w->setValue(num_frames);
        w->setRange(1,65536);
        connect(w, SIGNAL(valueChanged(int)), this, SLOT(framesChanged(int)));
        l->addRow("Frames", w);
    }

    {
        QComboBox* w = new QComboBox(this);
        m_Format = w;
        w->addItem("RGB",-1);
        w->addItem("2 colour palette",2);
        w->addItem("4 colour palette",4);
        w->addItem("8 colour palette",8);
        w->addItem("16 colour palette",16);
        w->addItem("32 colour palette",32);
        w->addItem("64 colour palette",64);
        w->addItem("128 colour palette",128);
        w->addItem("256 colour palette",256);
        num_colours = 32;
        pixel_format = FMT_I8;
        w->setCurrentIndex(5);
        connect(w,SIGNAL(currentIndexChanged(int)), this, SLOT(formatChanged(int)));
        l->addRow("Format", w);
    }

    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    l->addRow(buttonBox);
    setLayout(l);
    setWindowTitle(tr("New Project"));
}
Example #19
0
void GameParamInputRange::createWidget(QString value, QWidget** left, QWidget** right)
{
	QSpinBox* pBox = new QSpinBox;
	
	*left = new QLabel(m_strText);
	*right = pBox;
	
	applyPalette(*left, PaletteMain);
	applyPalette(*right, PaletteEdit);
	
	pBox->setRange(m_min,m_max);
	pBox->setValue(value.toLong());
}
/*!
    \internal

    Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtSpinBoxFactory::createEditor(QtIntPropertyManager *manager, QtProperty *property,
        QWidget *parent)
{
    QSpinBox *editor = this->createEditorImpl(property, parent);
    editor->setSingleStep(manager->singleStep(property));
    editor->setRange(manager->minimum(property), manager->maximum(property));
    editor->setValue(manager->value(property));
    editor->setKeyboardTracking(false);

    connect(editor, SIGNAL(valueChanged(int)), this, SLOT(slotSetValue(int)));
    connect(editor, SIGNAL(destroyed(QObject*)),
                this, SLOT(slotEditorDestroyed(QObject*)));
    return editor;
}
    QtnPropertyIntSpinBoxHandler(QtnPropertyIntBase& property, QSpinBox& editor)
        : QtnPropertyEditorHandlerType(property, editor)
    {
        if (!property.isEditableByUser())
            editor.setReadOnly(true);

        editor.setRange(property.minValue(), property.maxValue());
        editor.setSingleStep(property.stepValue());

        updateEditor();

        QObject::connect(  &editor, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
                         , this, &QtnPropertyIntSpinBoxHandler::onValueChanged);
    }
Example #22
0
QWidget * AlphasDialog::AlphasItemDelegate::createEditor ( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
  const int column ( index.column() );
  if ( 0 <= column && column <= 3 )
  {
    //const unsigned short value ( index.model()->data ( index, Qt::DisplayRole ).toUInt() );
    
    QSpinBox *spinBox ( new QSpinBox ( parent ) );
    spinBox->setRange( 0, 255 );
    //spinBox->setValue ( value );
    return spinBox;
  }
  
  return BaseClass::createEditor ( parent, option, index );
}
void SpinBoxTest::testSetting()
{
  QSpinBox spinBox;
  
  spinBox.setRange( 1, 10 );

  spinBox.setValue( 5 );
  QCOMPARE( spinBox.value(), 5 );
  
  spinBox.setValue( 0 );
  QCOMPARE( spinBox.value(), 1 );

  spinBox.setValue( 11 );
  QCOMPARE( spinBox.value(), 10 );
}
Example #24
0
StimConfigTab::StimConfigTab (QWidget *parent)
  : QWidget(parent)
{
  QGridLayout *layout = new QGridLayout;
  layout->addWidget(new QLabel("Number of pulse trains"), 0, 0,
      Qt::AlignRight | Qt::AlignVCenter);

  QSpinBox *nTrainsSpinBox = new QSpinBox();
  nTrainsSpinBox->setAlignment(Qt::AlignRight);
  nTrainsSpinBox->setDecimals(1);
  nTrainsSpinBox->setRange(1,200);
  layout->addWidget(nTrainsSpinBox, 0, 1);

  QPushButton *continuousButton = new QPushButton("Contiuous");
  layout->addWidget(continuousButton,0,2);

  layout->addWidget(new QLabel("Inter-train Interval"), 1, 0,
      Qt::AlignRight | Qt::AlignVCenter);
  QSpinBox *trainIntervalSpinBox = new QSpinBox();
  trainIntervalSpinBox->setAlignment(Qt::AlignRight);
  trainIntervalSpinBox->setSuffix(" ms");
  trainIntervalSpinBox->setRange(500, 50000);
  layout->addWidget(trainIntervalSpinBox, 1, 1);

  QPushButton *stimSingleButton = new QPushButton("Trigger Single Pulse Sequence");
  layout->addWidget(stimSingleButton,2,0);

  QPushButton *startStimButton = new QPushButton("Start Pulse Sequence");
  layout->addWidget(stimSingleButton,2,1);

  QPushButton *abortStimButton = new QPushButton("Abort");
  layout->addWidget(abortSingleButton,2,2);

  setLayout(layout);

}
QSpinBox* RenderSettingsWindow::create_integer_input(
    const string&           widget_key,
    const int               min,
    const int               max)
{
    QSpinBox* spinbox = new QSpinBox();
    m_widget_proxies[widget_key] = new SpinBoxProxy(spinbox);

    spinbox->setRange(min, max);
    set_widget_width_for_value(spinbox, max, SpinBoxMargin, SpinBoxMinWidth);

    new MouseWheelFocusEventFilter(spinbox);

    return spinbox;
}
Example #26
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    //Main window widget
    QWidget *mainw = new QWidget;
    mainw->setWindowTitle("first qt window");
    //spinbox & slider
    QSpinBox *spin = new QSpinBox;
    QSpinBox *spin2 = new QSpinBox;
    QSlider *slider = new QSlider(Qt::Horizontal);
    spin->setRange(1,50);
    spin2->setRange(51,100);
    slider->setRange(1,50);
    QObject::connect(spin, SIGNAL(valueChanged(int)),slider,SLOT(setValue(int)));
    QObject::connect(spin2, SIGNAL(valueChanged(int)),slider,SLOT(setValue(int)));
    QObject::connect(slider, SIGNAL(valueChanged(int)),spin,SLOT(setValue(int)));
    spin->setValue(10);
    spin->setValue(60);
    slider->setValue(10);
    //Label
    QLabel *qlable = new QLabel("Hello this is Lable");
    //Push button
    QPushButton *qpush = new QPushButton("quit me");
    QPushButton *qpush2 = new QPushButton("clicking me");
    //qpush->show();
    QObject::connect(qpush,SIGNAL(clicked()),&a,SLOT(quit()));
    QObject::connect(qpush2,SIGNAL(clicked()),&a,SLOT(quit()));
//    qlable->show();

    //Create layout
    QHBoxLayout *layout = new QHBoxLayout;
    //add widget to layout
    layout->addWidget(spin);
    layout->addWidget(spin2);
    layout->addWidget(slider);
    layout->addWidget(qlable);
    layout->addWidget(qpush);
    layout->addWidget(qpush2);

    //set layout for main window
    mainw->setLayout(layout);
    mainw->show();

    MainWindow w;
    w.show();
    
    return a.exec();
}
void PICWeeklySettings::addShock()
{
    QDialog shockDialog;
    QDialogButtonBox* dialogBtn = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &shockDialog);
    QLabel* ratingLabel = new QLabel(&shockDialog);
    ratingLabel->setText(tr("Rating Band"));
    QComboBox* ratingCombo = new QComboBox(&shockDialog);
    for (int i = 2; i < numRatingBands+2; ++i)
        ratingCombo->addItem(m_ShocksModel->headerData(i, Qt::Horizontal).toString());
    QLabel* sectorLabel = new QLabel(&shockDialog);
    sectorLabel->setText(tr("Sector"));
    QComboBox* sectorCombo = new QComboBox(&shockDialog);
    sectorCombo->setModel(sectorDelegate->model());
    QLabel* geogLabel = new QLabel(&shockDialog);
    geogLabel->setText(tr("Country"));
    QComboBox* geogCombo = new QComboBox(&shockDialog);
    geogCombo->setModel(geographyDelegate->model());
    QLabel* shockLabel = new QLabel(&shockDialog);
    shockLabel->setText(tr("Shock (bps)"));
    QSpinBox* shockSpin = new QSpinBox(&shockDialog);
    shockSpin->setRange(0, std::numeric_limits<int>::max());
    shockSpin->setValue(0);
    shockSpin->setSingleStep(1);
    QGridLayout* dialogLay = new QGridLayout(&shockDialog);
    dialogLay->addWidget(ratingLabel, 0, 0);
    dialogLay->addWidget(ratingCombo, 0, 1);
    dialogLay->addWidget(sectorLabel, 1, 0);
    dialogLay->addWidget(sectorCombo, 1, 1);
    dialogLay->addWidget(geogLabel, 2, 0);
    dialogLay->addWidget(geogCombo, 2, 1);
    dialogLay->addWidget(shockLabel, 3, 0);
    dialogLay->addWidget(shockSpin, 3, 1);
    dialogLay->addWidget(dialogBtn, 4, 0, 1, 2);
    connect(dialogBtn, &QDialogButtonBox::accepted, &shockDialog, &QDialog::accept);
    connect(dialogBtn, &QDialogButtonBox::rejected, &shockDialog, &QDialog::reject);
    if(shockDialog.exec()==QDialog::Accepted){
        const QModelIndex currPar=m_Shockview->rootIndex();
        if (!currPar.isValid())
            return;
        addScenarioData(
            currPar.data().toString()
            , geogCombo->currentData().toBool() ? QString(): geogCombo->currentText()
            , sectorCombo->currentData().toBool() ? QString() : sectorCombo->currentText()
            , ratingCombo->currentData().toBool() ? QString() : ratingCombo->currentText()
            , shockSpin->value()
            );
    }
}
QWidget* FilesViewDelegate::createEditor (QWidget *parent,
        const QStyleOptionViewItem& option, const QModelIndex& index) const
{
    if (index.column () == TorrentFilesModel::ColumnPriority &&
            !HasChildren (index))
    {
        QSpinBox *box = new QSpinBox (parent);
        box->setRange (0, 7);
        return box;
    }
    else if (index.column () == TorrentFilesModel::ColumnPath &&
             !HasChildren (index))
        return new QLineEdit (parent);
    else
        return QStyledItemDelegate::createEditor (parent, option, index);
}
Example #29
0
HzW::HzW(int c, const QStringList &freqs)
{
	QGridLayout *layout = new QGridLayout(this);
	for (int i = 0; i < c; ++i)
	{
		QSpinBox *sB = new QSpinBox;
		sB->setRange(0, 96000);
		sB->setSuffix(" Hz");
		if (freqs.count() > i)
			sB->setValue(freqs[i].toInt());
		else
			sB->setValue(440);
		hzB.append(sB);
		layout->addWidget(sB, i/4, i%4);
	}
}
Example #30
0
void EFXEditor::updateIntensityColumn(QTreeWidgetItem* item, EFXFixture* ef)
{
    Q_ASSERT(item != NULL);
    Q_ASSERT(ef != NULL);

    if (m_tree->itemWidget(item, KColumnIntensity) == NULL)
    {
        QSpinBox* spin = new QSpinBox(m_tree);
        spin->setAutoFillBackground(true);
        spin->setRange(0, 255);
        spin->setValue(ef->fadeIntensity());
        m_tree->setItemWidget(item, KColumnIntensity, spin);
        spin->setProperty(PROPERTY_FIXTURE, (qulonglong) ef);
        connect(spin, SIGNAL(valueChanged(int)),
                this, SLOT(slotFixtureIntensityChanged(int)));
    }