当前位置: 首页>>代码示例>>C++>>正文


C++ QSpinBox::setKeyboardTracking方法代码示例

本文整理汇总了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;
}
开发者ID:LabShare,项目名称:IMOD,代码行数:40,代码来源:dia_qtutils.cpp

示例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;
}
开发者ID:Masstronaut,项目名称:phantom-cpp,代码行数:19,代码来源:qteditorfactory.cpp

示例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*)));
  }
开发者ID:Yanzqing,项目名称:BHumanCodeRelease,代码行数:23,代码来源:PropertyEditorFactory.cpp


注:本文中的QSpinBox::setKeyboardTracking方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。