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


C++ QtProperty类代码示例

本文整理汇总了C++中QtProperty的典型用法代码示例。如果您正苦于以下问题:C++ QtProperty类的具体用法?C++ QtProperty怎么用?C++ QtProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QtProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fitContextMenu

void IqtFit::fitContextMenu(const QPoint &) {
  QtBrowserItem *item(NULL);

  item = m_ffTree->currentItem();

  if (!item)
    return;

  // is it a fit property ?
  QtProperty *prop = item->property();

  // is it already fixed?
  bool fixed = prop->propertyManager() != m_dblManager;

  if (fixed && prop->propertyManager() != m_stringManager)
    return;

  // Create the menu
  QMenu *menu = new QMenu("IqtFit", m_ffTree);
  QAction *action;

  if (!fixed) {
    action = new QAction("Fix", m_parentWidget);
    connect(action, SIGNAL(triggered()), this, SLOT(fixItem()));
  } else {
    action = new QAction("Remove Fix", m_parentWidget);
    connect(action, SIGNAL(triggered()), this, SLOT(unFixItem()));
  }

  menu->addAction(action);

  // Show the menu
  menu->popup(QCursor::pos());
}
开发者ID:dezed,项目名称:mantid,代码行数:34,代码来源:IqtFit.cpp

示例2: QString

QtProperty *CrossCommonPropertyGroup::extrackViewProperty(QtVariantPropertyManager *manager,
                                                          QHash<QString, QtVariantProperty *> &propertyTable)
{
    QtProperty          *parameters;
    QtVariantProperty   *item;

    parameters = manager->addProperty(QtVariantPropertyManager::groupTypeId(),
                                      QString(QObject::tr("外观属性")));

    item = manager->addProperty(QVariant::Color, QString(QObject::tr("背景颜色")));
    item->setValue(QColor(0, 0, 0, 255));
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/view/backgroud_color", item);

    item = manager->addProperty(QVariant::Color, QString(QObject::tr("边框颜色")));
    item->setValue(QColor(0, 0, 0, 255));
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/view/border_color", item);

    item = manager->addProperty(QVariant::Double, QString(QObject::tr("边框宽度")));
    item->setValue(1);
    parameters->addSubProperty(item);
    propertyTable.insert("/map_key/view/border_line_width", item);

    return parameters;
}
开发者ID:yujiajia,项目名称:Just-Go,代码行数:26,代码来源:cross_common_property_group.cpp

示例3: ScaleDraw

void QwtPlotPropertySetDialog::setAxisScaleDrawStyle(QwtPlot::Axis axis, const QVariant& value)
{
    ScaleDraw sType = ScaleDraw( value.toInt());//强制转换,因为已经设置好枚举的值,所以这里可以进行强制转换
    QwtScaleDraw *scaleDraw = m_plot->axisScaleDraw(axis);
    QwtDateScaleDraw* dateScale = dynamic_cast<QwtDateScaleDraw*>(scaleDraw);
    QtProperty * property = m_property_id.getProperty(axisPropertyID(axis,3));

    if(NormalScale == sType)
    {
        if(property)
            property->setEnabled(false);
        if(dateScale)
        {//说明当前是时间坐标轴
            QwtScaleDraw* scale = nullptr;
            scale = new QwtScaleDraw;
            m_plot->setAxisScaleDraw(axis,scale);
        }
    }
    else if(DateScale == sType)
    {
        ChartWave_qwt::AxisDateScaleType st(ChartWave_qwt::hh_mm_ss);
        if(property)
        {
            property->setEnabled(true);
            st = ChartWave_qwt::AxisDateScaleType( static_cast<QtVariantProperty*>(property)->value().toInt() );
        }
        if(!dateScale)
        {//说明当前不是时间坐标轴
            m_plot->setDateAxis(st,axis,QwtDate::Second);
        }
    }
}
开发者ID:czyt1988,项目名称:chart,代码行数:32,代码来源:QwtPlotPropertySetDialog.cpp

示例4: drawRow

void QtPropertyTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    QStyleOptionViewItemV3 opt = option;
    QColor bgColor;
    if (editorPrivate_)
    {
        QtProperty *property = editorPrivate_->indexToProperty(index);
        if (property)
        {
            bgColor = property->getBackgroundColor();
        }
    }

    if(bgColor.isValid())
    {
        painter->fillRect(option.rect, bgColor);
        opt.palette.setColor(QPalette::AlternateBase, bgColor);
    }

    QTreeWidget::drawRow(painter, opt, index);
//    QColor color = static_cast<QRgb>(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &opt));
//    painter->save();
//    painter->setPen(QPen(color));
//    painter->drawLine(opt.rect.x(), opt.rect.bottom(), opt.rect.right(), opt.rect.bottom());
//    painter->restore();
}
开发者ID:youlanhai,项目名称:qtpropertysheet,代码行数:26,代码来源:qtpropertytreeview.cpp

示例5:

QtProperty *ShapePropertyString::getQtProperty()
{
    QtProperty *pProp = m_stringManager->addProperty( m_sName );
    pProp->setToolTip( m_sDescription );
    pProp->setWhatsThis( m_sDescription );
    pProp->setEnabled( m_bEnabled );
    return pProp;
}
开发者ID:neomilium,项目名称:GenericHID,代码行数:8,代码来源:shapepropertystring.cpp

示例6:

QtProperty *ShapePropertyRCNames::getQtProperty()
{
    QtProperty *pProp = m_keyMatrixNameManager->addProperty( m_sName );
    pProp->setToolTip( m_sDescription );
    pProp->setWhatsThis( m_sDescription );
    pProp->setEnabled( m_bEnabled );
    return pProp;
}
开发者ID:neomilium,项目名称:GenericHID,代码行数:8,代码来源:shapepropertyrcnames.cpp

示例7:

QtProperty *IqtFit::createExponential(const QString &name) {
  QtProperty *expGroup = m_grpManager->addProperty(name);
  m_properties[name + ".Intensity"] = m_dblManager->addProperty("Intensity");
  m_dblManager->setDecimals(m_properties[name + ".Intensity"], NUM_DECIMALS);
  m_properties[name + ".Tau"] = m_dblManager->addProperty("Tau");
  m_dblManager->setDecimals(m_properties[name + ".Tau"], NUM_DECIMALS);
  expGroup->addSubProperty(m_properties[name + ".Intensity"]);
  expGroup->addSubProperty(m_properties[name + ".Tau"]);
  return expGroup;
}
开发者ID:dezed,项目名称:mantid,代码行数:10,代码来源:IqtFit.cpp

示例8: fixItem

void IqtFit::fixItem() {
  QtBrowserItem *item = m_ffTree->currentItem();

  // Determine what the property is.
  QtProperty *prop = item->property();

  QtProperty *fixedProp = m_stringManager->addProperty(prop->propertyName());
  QtProperty *fprlbl = m_stringManager->addProperty("Fixed");
  fixedProp->addSubProperty(fprlbl);
  m_stringManager->setValue(fixedProp, prop->valueText());

  item->parent()->property()->addSubProperty(fixedProp);
  m_fixedProps[fixedProp] = prop;
  item->parent()->property()->removeSubProperty(prop);
}
开发者ID:dezed,项目名称:mantid,代码行数:15,代码来源:IqtFit.cpp

示例9: itProperty

int PropertyEditor::applyPropertiesFilter(const QList<QtBrowserItem *> &items)
{
    int showCount = 0;
    const bool matchAll = m_filterPattern.isEmpty();
    QListIterator<QtBrowserItem *> itProperty(items);
    while (itProperty.hasNext()) {
        QtBrowserItem *propertyItem = itProperty.next();
        QtProperty *property = propertyItem->property();
        const QString propertyName = property->propertyName();
        const bool showProperty = matchAll || propertyName.contains(m_filterPattern, Qt::CaseInsensitive);
        setItemVisible(propertyItem, showProperty);
        if (showProperty)
            showCount++;
    }
    return showCount;
}
开发者ID:Fale,项目名称:qtmoko,代码行数:16,代码来源:propertyeditor.cpp

示例10: PropertyChanged

void ShapeKeyMatrix::PropertyChanged( QtBrowserItem *item, QList<PropertyValue *> & ) const
{
    // if rows or columns change, update the key names editor
    QtProperty *prop = item->property();
    assert( prop != NULL );
    if ( prop != NULL && prop->propertyName().compare( "Rows", Qt::CaseInsensitive ) == 0 )
    {
        int nRows = ShapeProperty::m_intManager->value( prop );
        ShapeProperty::m_keyMatrixNameFactory->setRows( nRows );
    }
    else if ( prop != NULL && prop->propertyName().compare( "Columns", Qt::CaseInsensitive ) == 0 )
    {
        int nColumns = ShapeProperty::m_intManager->value( prop );
        ShapeProperty::m_keyMatrixNameFactory->setColumns( nColumns );
    }
}
开发者ID:neomilium,项目名称:GenericHID,代码行数:16,代码来源:shapekeymatrix.cpp

示例11: unFixItem

void IqtFit::unFixItem() {
  QtBrowserItem *item = m_ffTree->currentItem();

  QtProperty *prop = item->property();
  if (prop->subProperties().empty()) {
    item = item->parent();
    prop = item->property();
  }

  item->parent()->property()->addSubProperty(m_fixedProps[prop]);
  item->parent()->property()->removeSubProperty(prop);
  m_fixedProps.remove(prop);
  QtProperty *proplbl = prop->subProperties()[0];
  delete proplbl;
  delete prop;
}
开发者ID:dezed,项目名称:mantid,代码行数:16,代码来源:IqtFit.cpp

示例12: clearProperties

void InstrumentWidgetMaskTab::setProperties() {
  clearProperties();
  m_userEditing = false;

  // bounding rect property
  QtProperty *boundingRectGroup = m_groupManager->addProperty("Bounding Rect");
  m_browser->addProperty(boundingRectGroup);
  m_left = addDoubleProperty("left");
  m_top = addDoubleProperty("top");
  m_right = addDoubleProperty("right");
  m_bottom = addDoubleProperty("bottom");
  boundingRectGroup->addSubProperty(m_left);
  boundingRectGroup->addSubProperty(m_top);
  boundingRectGroup->addSubProperty(m_right);
  boundingRectGroup->addSubProperty(m_bottom);

  // point properties
  QStringList pointProperties =
      m_instrWidget->getSurface()->getCurrentPointNames();
  foreach (QString name, pointProperties) {
    QtProperty *point = m_groupManager->addProperty(name);
    QtProperty *prop_x = addDoubleProperty("x");
    QtProperty *prop_y = addDoubleProperty("y");
    point->addSubProperty(prop_x);
    point->addSubProperty(prop_y);
    m_browser->addProperty(point);
    m_pointComponentsMap[prop_x] = name;
    m_pointComponentsMap[prop_y] = name;
    m_pointPropertyMap[name] = point;
  }
开发者ID:samueljackson92,项目名称:mantid,代码行数:30,代码来源:InstrumentWidgetMaskTab.cpp

示例13: QLatin1Char

void PropertyEditor::storePropertiesExpansionState(const QList<QtBrowserItem *> &items)
{
    const QChar bar = QLatin1Char('|');
    QListIterator<QtBrowserItem *> itProperty(items);
    while (itProperty.hasNext()) {
        QtBrowserItem *propertyItem = itProperty.next();
        if (!propertyItem->children().empty()) {
            QtProperty *property = propertyItem->property();
            const QString propertyName = property->propertyName();
            const QMap<QtProperty *, QString>::const_iterator itGroup = m_propertyToGroup.constFind(property);
            if (itGroup != m_propertyToGroup.constEnd()) {
                QString key = itGroup.value();
                key += bar;
                key += propertyName;
                m_expansionState[key] = isExpanded(propertyItem);
            }
        }
    }
}
开发者ID:Fale,项目名称:qtmoko,代码行数:19,代码来源:propertyeditor.cpp

示例14: getSelectedLayerId

/** The move up button was clicked
*/
void QtSpacescapeMainWindow::onMoveLayerUp()
{
    // get the selected layer
    int layerId = getSelectedLayerId();
    if(layerId > -1) {
        if(ui->ogreWindow->moveLayerUp(layerId)) {
            QList<QtBrowserItem *> bl = ui->layerProperties->topLevelItems();
            unsigned int index = bl.size() - layerId - 1;
            QtProperty *p = bl[index]->property();

            // save expanded settings
            bool expanded = ui->layerProperties->isExpanded(bl[index]);

            // remove and re-insert at the new location
            ui->layerProperties->removeProperty(p);
            if(index == 1) {
                ui->layerProperties->insertProperty(p, NULL);
            }
            else {
                ui->layerProperties->insertProperty(p,bl[index - 2]->property());
            }

            // re-apply property tree visiblity settings
            bl = ui->layerProperties->topLevelItems();
            ui->layerProperties->setExpanded(bl[index - 1],expanded);

            // un-expand the color items
            QList<QtProperty *> sl = p->subProperties();
            for(int i = 0; i < sl.size(); i++) {
                if(((QtVariantProperty*)sl[i])->propertyType() == QVariant::Color) {
                    QList<QtBrowserItem *> bi = ui->layerProperties->items(sl[i]);
                    ui->layerProperties->setExpanded(bi.first(),false);
                }
            }

            // re-select the item
            ui->layerProperties->setFocus();
            ui->layerProperties->setCurrentItem(bl[index - 1]);
        }
    }
}
开发者ID:svenstaro,项目名称:Spacescape,代码行数:43,代码来源:QtSpacescapeMainWindow.cpp

示例15: insertLayerProperties

/** Utility function for creating and inserting layer properties
@param layer Spacescape layer
@param insertAfter Property to insert after
@param minimize Minimize this layer
@return The created / inserted property
*/
QtProperty* QtSpacescapeMainWindow::insertLayerProperties(Ogre::SpacescapeLayer* layer, QtProperty *insertAfter, bool minimize)
{
    // turn refreshing flag on so we don't process valueChanged events
    mRefreshing = true;

    // get layer params
    Ogre::NameValuePairList params = layer->getParams();

    // create the layer properties object
    QtProperty *layerProperties = mPropertyManager->addProperty(
                QtVariantPropertyManager::groupTypeId(),
                QLatin1String(layer->getName().c_str())
    );

    // insert it into the property tree early so we can minize items inside
    ui->layerProperties->insertProperty(layerProperties, insertAfter);

    // minimize the layer - speeds things up!
    if(minimize) {
        ui->layerProperties->setExpanded(ui->layerProperties->topLevelItem(layerProperties), false);
    }

    // add the common layer params to the subproperties first
    layerProperties->addSubProperty(createProperty( "name", layer->getName()));
    layerProperties->addSubProperty(createProperty( "type", layer->getLayerTypeName()));
    layerProperties->addSubProperty(createProperty( "visible", "true"));
    layerProperties->addSubProperty(createProperty( "seed", params["seed"]));

    // now add all the remaining layer params to the subproperties
    Ogre::NameValuePairList::iterator pl;
    for(pl = params.begin(); pl != params.end(); pl++) {
        // skip common params that come first
        if(pl->first == "name" || pl->first == "type" || 
            pl->first == "visible" || pl->first == "seed") {
            continue;
        }

        // create the sub property
        QtVariantProperty* subProperty = createProperty(pl->first, pl->second);
        if(!subProperty) {
            continue;
        }

        // add this sub property parameter
        layerProperties->addSubProperty(subProperty);

        // special auto hide for color types
        if(getPropertyType(pl->first) == QVariant::Color) {
            QList<QtBrowserItem *> bi = ui->layerProperties->items(subProperty);
            ui->layerProperties->setExpanded(bi.first(),false);
        }
    }

    // done adding properties
    mRefreshing = false;

    return layerProperties;
}
开发者ID:svenstaro,项目名称:Spacescape,代码行数:64,代码来源:QtSpacescapeMainWindow.cpp


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