ZDoubleSpinBox::ZDoubleSpinBox(QWidget *parent) : QDoubleSpinBox(parent) { installEventFilter(new ZSpinBoxEventFilter(this)); setFocusPolicy(Qt::StrongFocus); setKeyboardTracking(false); }
SpinBox::SpinBox(QWidget* parent) : QSpinBox(parent) { _returnMode = false; SpinBoxLineEdit* le = new SpinBoxLineEdit(this); setLineEdit(le); setKeyboardTracking(false); connect(le, SIGNAL(doubleClicked()), this, SIGNAL(doubleClicked())); connect(le, SIGNAL(ctrlDoubleClicked()), this, SIGNAL(ctrlDoubleClicked())); //connect(le, SIGNAL(ctrlClicked()), this, SIGNAL(ctrlClicked())); }
void GIntSpinBox::Init() { m_ShouldEmit_ValueChangedSignificantly = true; connect(this, SIGNAL(valueChanged(int)), this, SLOT(ReProcessValueChangedSiganl(int))); setRange(G_DEFAULT_RANGE_MIN, G_DEFAULT_RANGE_MAX); setKeyboardTracking(false); setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue); UpdateUnits(); connect(m_pParam, SIGNAL(UnitsChanged(QString)), this, SLOT(UpdateUnits())); connect(m_pParam, SIGNAL(UnitDisplayChanged(bool)), this, SLOT(UpdateUnits())); }
SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent) : QSpinBox(parent) { _returnMode = false; SpinBoxLineEdit* le = new SpinBoxLineEdit(this); setLineEdit(le); setRange(minValue, maxValue); setSingleStep(step); setKeyboardTracking(false); connect(le, SIGNAL(doubleClicked()), this, SIGNAL(doubleClicked())); connect(le, SIGNAL(ctrlDoubleClicked()), this, SIGNAL(ctrlDoubleClicked())); //connect(le, SIGNAL(ctrlClicked()), this, SIGNAL(ctrlClicked())); }
DoubleSpinBox::DoubleSpinBox(const char format, QWidget * parent) :QAbstractSpinBox(parent), d_format(format), d_min_val(-DBL_MAX), d_max_val(DBL_MAX), d_value(0.0), d_step(0.1), d_prec(1) { lineEdit()->setText(locale().toString(d_value, d_format, d_prec)); setKeyboardTracking(false); setWrapping(false); connect(this, SIGNAL(editingFinished()), this, SLOT(interpretText())); }
DoubleSpinBox::DoubleSpinBox(QWidget *parent) : QDoubleSpinBox(parent), validator(QRegularExpression(QString("[+-]?\\d+(%1\\d+)?").arg(QRegularExpression::escape(locale().decimalPoint()))), this), edit(new LineEdit(this)), multiple(false) { setKeyboardTracking(false); edit->setValidator(&validator); setLineEdit(edit); connect(this, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [this](double val) { setValue(val, false); }); }
void FloatSpinBox::init( ) { // setValidator( new QDoubleValidator(this) ); // QDoubleSpinBox::setValue( 0.0 ); setFocusPolicy( Qt::ClickFocus ); calcLineStep( ); lineEdit()->setAlignment( Qt::AlignRight ); setMinimum (-1000000.0); setMaximum (1000000.0); setLocale(QLocale::C); setKeyboardTracking(false); // qDebug ( "float spin box created"); }
ShapeSideBar::ShapeSideBar(LayerScene *scene, QWidget *parent) : AbstractLayerPropertyEditor(scene, parent), d(new Data) { d->rectGroup = new WidgetGroup(this); d->textGroup = new WidgetGroup(this); d->alignSignalMapper = new QSignalMapper(this); connect(d->alignSignalMapper, SIGNAL(mapped(int)), this, SLOT(onTextAlignmentChanged(int))); auto layout = new QFormLayout(); auto addRowWidget = [layout](const QString &text, QWidget *field, WidgetGroup *group) { auto label = new QLabel(text); layout->addRow(label, field); group->addWidget(label); group->addWidget(field); }; auto addRowLayout = [layout](const QString &text, QLayout *field, WidgetGroup *group) { auto label = new QLabel(text); layout->addRow(label, field); group->addWidget(label); group->addLayout(field); }; QFont boldFont; boldFont.setBold(true); { { auto label = new QLabel(tr("RECTANGLE")); label->setFont(boldFont); d->rectGroup->addWidget(label); layout->addRow(label); } auto createSpinBox = []() { auto s = new QSpinBox(); s->setRange(INT_MIN, INT_MAX); s->setMaximumWidth(60); s->setKeyboardTracking(false); return s; }; { auto hl = new QHBoxLayout(); { auto s = createSpinBox(); connect(this, SIGNAL(xChanged(int)), s, SLOT(setValue(int))); connect(s, SIGNAL(valueChanged(int)), this, SLOT(onXChanged(int))); hl->addWidget(s); } { auto s = createSpinBox(); connect(this, SIGNAL(yChanged(int)), s, SLOT(setValue(int))); connect(s, SIGNAL(valueChanged(int)), this, SLOT(onYChanged(int))); hl->addWidget(s); } addRowLayout(tr("Position"), hl, d->rectGroup); } { auto hl = new QHBoxLayout(); { auto s = createSpinBox(); connect(this, SIGNAL(widthChanged(int)), s, SLOT(setValue(int))); connect(s, SIGNAL(valueChanged(int)), this, SLOT(onWidthChanged(int))); hl->addWidget(s); } { auto s = createSpinBox(); connect(this, SIGNAL(heightChanged(int)), s, SLOT(setValue(int))); connect(s, SIGNAL(valueChanged(int)), this, SLOT(onHeightChanged(int))); hl->addWidget(s); } addRowLayout(tr("Size"), hl, d->rectGroup); } } { { auto label = new QLabel(tr("TEXT")); label->setFont(boldFont); d->textGroup->addWidget(label); layout->addRow(label); } { auto b = new QToolButton(); connect(b, SIGNAL(pressed()), this, SLOT(onFontSelectRequested())); d->fontButton = b; addRowWidget(tr("Font"), b, d->textGroup); } { auto checkBox = new QCheckBox(tr("Italic")); connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(onFontItalicChanged(bool))); connect(this, SIGNAL(fontItalicChanged(bool)), checkBox, SLOT(setChecked(bool))); addRowWidget("", checkBox, d->textGroup); } { auto hlayout = new QHBoxLayout(); auto hgroup = new QButtonGroup(this); auto vgroup = new QButtonGroup(this); auto addAlignButton = [hlayout, this](const QString &iconPath, int alignment, QButtonGroup *buttonGroup) { auto b = new SimpleButton(iconPath, QSize(16, 16)); b->setCheckable(true); connect(b, SIGNAL(pressed()), d->alignSignalMapper, SLOT(map())); d->alignSignalMapper->setMapping(b, alignment); d->alignButtons[alignment] = b; hlayout->addWidget(b); buttonGroup->addButton(b); }; addAlignButton(":/icons/16x16/alignLeft.svg", Qt::AlignLeft, hgroup); addAlignButton(":/icons/16x16/alignHCenter.svg", Qt::AlignHCenter, hgroup); addAlignButton(":/icons/16x16/alignRight.svg", Qt::AlignRight, hgroup); addAlignButton(":/icons/16x16/alignTop.svg", Qt::AlignTop, vgroup); addAlignButton(":/icons/16x16/alignVCenter.svg", Qt::AlignVCenter, vgroup); addAlignButton(":/icons/16x16/alignBottom.svg", Qt::AlignBottom, vgroup); addRowLayout(tr("Align"), hlayout, d->textGroup); } { auto t = new QTextEdit(); connect(t, SIGNAL(textChanged()), this, SLOT(onTextChanged())); d->textEdit = t; addRowWidget(tr("Text"), t, d->textGroup); } } setLayout(layout); }
DoubleValueEditor::DoubleValueEditor(QWidget* parent) : QDoubleSpinBox(parent), wheelEventSignal(true), last_press(0) { setKeyboardTracking(false); connect(this, SIGNAL(valueChanged(double)), this, SIGNAL(valueUpdated())); }