本文整理汇总了C++中QSpinBox::setKeyboardTracking方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setKeyboardTracking方法的具体用法?C++ QSpinBox::setKeyboardTracking怎么用?C++ QSpinBox::setKeyboardTracking使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::setKeyboardTracking方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: diaLabel
/*!
* Makes a labeled spin box, with the label given by [text] to the left of the
* box and right aligned to it, provided that [layout] is a horizontal layout
* box in which to place them. (In a toolbar, [layout] can be NULL.)
* [minValue], [maxValue], and [step] are the minimum, maximum, and step
* sizes for the spin box. If [nDecimal] is non-zero, it creates and returns
* a QDoubleSpinBox with that number of decimal places. It skips the label
* if [text] is NULL. The focus policy is set to ClickFocus. Keyboard
* tracking is turned off. If a pointer is supplied in the optional argument [labelPtr]
* (which is NULL by default), it is returned with the label pointer.
*/
QAbstractSpinBox *diaLabeledSpin(int nDecimal, float minValue, float maxValue,
float step, const char *text, QWidget *parent,
QBoxLayout *layout, QLabel **labelPtr)
{
QSpinBox *spin;
QDoubleSpinBox *fspin;
if (text) {
QLabel *label = diaLabel(text, parent, layout);
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
if (labelPtr)
*labelPtr = label;
}
if (nDecimal) {
fspin = new QDoubleSpinBox(parent);
fspin->setDecimals(nDecimal);
fspin->setRange((double)minValue, (double)maxValue);
fspin->setSingleStep((double)step);
spin = (QSpinBox *)fspin;
} else {
spin = new QSpinBox(parent);
spin->setRange(B3DNINT(minValue), B3DNINT(maxValue));
spin->setSingleStep(B3DNINT(step));
}
if (layout)
layout->addWidget(spin);
spin->setFocusPolicy(Qt::ClickFocus);
spin->setKeyboardTracking(false);
return (QAbstractSpinBox *)spin;
}
示例2: connect
/*!
\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;
}
示例3: createEditor
QWidget* PropertyEditorFactory::createEditor(QtVariantPropertyManager* pManager, QtProperty* pProperty, QWidget* pParent)
{
/**
* Whenever the user wants to edit a property a new editor is created.
* The editor is destroyed as soon as the user finished editing the property.
*/
QWidget* pReturnWidget = nullptr;
QWidget* pFilterWidget = nullptr;
//FIXME copy&paste code
if(TypeDescriptor::getTypeId<unsigned int>() == pManager->propertyType(pProperty))
{
QSpinBox* pBox = new IntSpinBox(pParent);
pBox->setKeyboardTracking(false); //This is done to avoid changed updates on every keypress
propertyToSpinBox[pProperty] = pBox;
spinBoxToProperty[pBox] = pProperty;
pBox->setMinimum(0);
//Maximum can only be int max because the spinbox uses int internally
pBox->setMaximum(std::numeric_limits<int>::max());
pBox->setValue((int)pManager->value(pProperty).value<unsigned int>()); //the cast to int is not very nice :(
pReturnWidget = pBox;
connect(pBox, SIGNAL(valueChanged(int)), this, SLOT(slotSpinBoxValueChanged(int)));
connect(pBox, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*)));
}