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


C++ setExpression函数代码示例

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


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

示例1: expression

void QgsExpressionLineEdit::setMultiLine( bool multiLine )
{
  QString exp = expression();

  if ( multiLine && !mCodeEditor )
  {
    mCodeEditor = new QgsCodeEditorSQL();
    mCodeEditor->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    delete mLineEdit;
    mLineEdit = nullptr;

    QHBoxLayout* newLayout = new QHBoxLayout();
    newLayout->setContentsMargins( 0, 0, 0, 0 );
    newLayout->addWidget( mCodeEditor );

    QVBoxLayout* vLayout = new QVBoxLayout();
    vLayout->addWidget( mButton );
    vLayout->addStretch();
    newLayout->addLayout( vLayout );

    delete layout();
    setLayout( newLayout );

    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

    setFocusProxy( mCodeEditor );
    connect( mCodeEditor, SIGNAL( textChanged() ), this, SLOT( expressionEdited() ) );

    setExpression( exp );
  }
  else if ( !multiLine && !mLineEdit )
  {
    delete mCodeEditor;
    mCodeEditor = nullptr;
    mLineEdit = new QgsFilterLineEdit();
    mLineEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );

    QHBoxLayout* newLayout = new QHBoxLayout();
    newLayout->setContentsMargins( 0, 0, 0, 0 );
    newLayout->addWidget( mLineEdit );
    newLayout->addWidget( mButton );

    delete layout();
    setLayout( newLayout );

    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );

    setFocusProxy( mLineEdit );
    connect( mLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( expressionEdited( QString ) ) );

    setExpression( exp );
  }
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:53,代码来源:qgsexpressionlineedit.cpp

示例2: QWidget

ExpressionEditorWidget::ExpressionEditorWidget(const iscore::DocumentContext& doc, QWidget *parent) :
    QWidget(parent),
    m_context{doc}
{
    m_mainLayout = new iscore::MarginLess<QVBoxLayout>{this};

    auto btnWidg = new QWidget{this};
    auto btnLay = new iscore::MarginLess<QHBoxLayout>{btnWidg};

    auto validBtn = new QPushButton{tr("Ok"), btnWidg};
    auto cancelBtn = new QPushButton{tr("Cancel"),btnWidg};
    btnLay->addWidget(validBtn);
    btnLay->addWidget(cancelBtn);

    m_mainLayout->addWidget(btnWidg);

    connect(validBtn, &QPushButton::clicked,
            this, &ExpressionEditorWidget::on_editFinished);
    connect(cancelBtn, &QPushButton::clicked,
            this, [&] ()
    {
        if(m_expression.isEmpty()) {
            for(auto& elt : m_relations)
            {
                delete elt;
            }
            m_relations.clear();
            addNewTerm();
        }
        else
            setExpression(*State::parseExpression(m_expression));
    });
}
开发者ID:Sciss,项目名称:i-score,代码行数:33,代码来源:ExpressionEditorWidget.cpp

示例3: QWidget

QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *parent )
    : QWidget( parent )
    , mLayer( 0 )
    , mEditIndex( 0 )
    , mEditing( false )
    , mSymbol( 0 )
{
  setupUi( this );
  mDeleteButton->hide();
  connect( mFieldCombo, SIGNAL( fieldChanged( QString ) ), SLOT( fieldChanged( QString ) ) );
  connect( fieldRadio, SIGNAL( clicked() ), SLOT( reloadStyles() ) );
  connect( rowRadio, SIGNAL( clicked() ), SLOT( reloadStyles() ) );
  connect( mNewButton, SIGNAL( clicked() ), SLOT( addNewRule() ) );
  connect( mSaveRule, SIGNAL( clicked() ), SLOT( saveRule() ) );
  connect( mCancelButton, SIGNAL( clicked() ), SLOT( cancelRule() ) );
  connect( mDeleteButton, SIGNAL( clicked() ), SLOT( deleteRule() ) );
  connect( listView, SIGNAL( clicked( QModelIndex ) ), SLOT( ruleClicked( QModelIndex ) ) );
  connect( btnChangeIcon , SIGNAL( clicked() ), SLOT( updateIcon() ) );
  connect( btnBuildExpression , SIGNAL( clicked() ), SLOT( setExpression() ) );
  connect( mPresetsList , SIGNAL( currentIndexChanged( int ) ), SLOT( presetSet( int ) ) );
  btnBackgroundColor->setAllowAlpha( true );
  btnBackgroundColor->setShowNoColor( true );
  btnTextColor->setAllowAlpha( true );
  btnTextColor->setShowNoColor( true );
  mPresetsModel = new QStandardItemModel( listView );
  mModel = new QStandardItemModel( listView );
  listView->setModel( mModel );
  mPresetsList->setModel( mPresetsModel );

  setPresets( defaultPresets() );
}
开发者ID:paulfab,项目名称:QGIS,代码行数:31,代码来源:qgsfieldconditionalformatwidget.cpp

示例4: valueCleared

void QgsDefaultSearchWidgetWrapper::textChanged( const QString &text )
{
  if ( text.isEmpty() )
    emit valueCleared();

  setExpression( text );
}
开发者ID:alexbruy,项目名称:QGIS,代码行数:7,代码来源:qgsdefaultsearchwidgetwrapper.cpp

示例5: setExpression

bool DlgSetRDRPropertyByExpressionEditor::loadWidget(QSettings *settings, const QString &prefix)
{
    setExpression(settings->value(prefix+"expression").toString());
    setType(settings->value(prefix+"type").toInt());
    setPropertyName(settings->value(prefix+"property").toString());
    return true;
}
开发者ID:jkriege2,项目名称:QuickFit3,代码行数:7,代码来源:dlgsetrdrpropertybyexpressioneditor.cpp

示例6: BASE_CL

EVALOBJ::EVALOBJ(int num) : BASE_CL()
{
	outports = 1;
	inports=1;
    width = 70;
	strcpy(in_ports[0].in_name,"A");
	strcpy(in_ports[1].in_name,"B");
	strcpy(in_ports[2].in_name,"C");
	strcpy(in_ports[3].in_name,"D");
	strcpy(in_ports[4].in_name,"E");
	strcpy(in_ports[5].in_name,"F");

	strcpy(out_ports[0].out_name,"out");
 
	inputA = 0;
    inputB = 0;
    inputC = 0;
    inputD = 0;
    inputE = 0;
    inputF = 0;
    expression = NULL;    evaluator = NULL;
	setexp=FALSE;

	setExpression("A");
}
开发者ID:RD3BAX,项目名称:BrainBay,代码行数:25,代码来源:ob_evaluator.cpp

示例7: while

void HStatement::keyPressEvent(Visualization::Item *target, QKeyEvent *event)
{
	Visualization::VList* lst = nullptr;
	auto p = target->parent();
	while (p && !(lst = dynamic_cast<Visualization::VList*>(p))) p = p->parent();

	bool processed = false;

	if (lst && event->modifiers() == Qt::NoModifier
			&& (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return))
	{
			processed = true;
			event->accept();

			int index = lst->focusedNodeIndex() + 1;

			auto empty = new OOModel::EmptyExpression();
			auto es = new OOModel::ExpressionStatement();
			es->setExpression(empty);
			lst->node()->model()->beginModification(lst->node(), "add empty statement");
			lst->node()->insert(index, es);
			lst->node()->model()->endModification();

			lst->setUpdateNeeded(Visualization::Item::StandardUpdate);
			target->scene()->addPostEventAction( new Interaction::SetCursorEvent(lst, empty));
	}

	if (!processed) GenericHandler::keyPressEvent(target, event);
}
开发者ID:JurajKubelka,项目名称:Envision,代码行数:29,代码来源:HStatement.cpp

示例8: load_object_basics

void EVALOBJ::load(HANDLE hFile) 
{
    char expr[MAXEXPRLENGTH];

	load_object_basics(this);
    load_property("expression",P_STRING,expr);
    setExpression(expr);
}
开发者ID:RD3BAX,项目名称:BrainBay,代码行数:8,代码来源:ob_evaluator.cpp

示例9: assignNode

Variable::Variable(const string& name, bool create_expression){
  assignNode(new VariableInternal(name));
  if(create_expression){
    setExpression(SX(name));
    setDerivative(SX("der_" + name));
    setBinding(var(),false);
    setBinding(der(),true);
  }
}
开发者ID:Snkrnryn,项目名称:casadi,代码行数:9,代码来源:variable.cpp

示例10: VECTOR_SET_ASSOCIATION

FindMatch::FindMatch( char *_expression, U32 _maxMatches )
{
   VECTOR_SET_ASSOCIATION(matchList);

   expression = NULL;
   setExpression( _expression );
   maxMatches = _maxMatches;
   matchList.reserve( maxMatches );
}
开发者ID:fr1tz,项目名称:terminal-overload,代码行数:9,代码来源:findMatch.cpp

示例11: assert

/*
 * If the expression of a simple query clause is query local, then
 * return the clause as is. Otherwise return a clone of the clause
 * with the expression rewritten to reference a query parameter.
 */
SimpleQueryClausePtr CaptureExtractor::rewriteSimpleClause(
    SimpleQueryClausePtr sc) {
  assert (sc != nullptr);
  auto expr = sc->getExpression();
  auto newExpr = rewrite(expr);
  if (expr == newExpr) return sc;
  auto rsc = static_pointer_cast<SimpleQueryClause>(sc->clone());
  rsc->setExpression(newExpr);
  return rsc;
}
开发者ID:shuc324,项目名称:hhvm,代码行数:15,代码来源:capture_extractor.cpp

示例12: while

bool SglExprLex::run(const QStringList& script)
{
  int i = -1;
  bool result = true;
  while (result && ++i < script.size())
  {
    setExpression(script.at(i));
    result = Error(eval()) == Success;
  }
  return result;
}
开发者ID:2garryn,项目名称:SpeedCrunch,代码行数:11,代码来源:bisonparser.cpp

示例13: value

void QgsCheckboxSearchWidgetWrapper::stateChanged( int )
{
  if ( mCheckBox )
  {
    mCheckBox->setTristate( false );
    QString exp = value().toString();
    setExpression( exp );
    emit valueChanged();
    emit expressionChanged( mExpression );
  }
}
开发者ID:AM7000000,项目名称:QGIS,代码行数:11,代码来源:qgscheckboxsearchwidgetwrapper.cpp

示例14: keyPressEvent

void HMethod::keyPressEvent(Visualization::Item *target, QKeyEvent *event)
{
	bool createDown = event->modifiers() == Qt::NoModifier &&
			(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return);
	bool createRight = event->modifiers() == Qt::ShiftModifier &&
			(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return);
	//bool switchVertical = event->modifiers() == Qt::NoModifier && event->key() == Qt::Key_Tab;
	bool switchHorizontal = event->modifiers() == Qt::ShiftModifier && event->key() == Qt::Key_Tab;

	bool processed = false;
	auto m = dynamic_cast<OOVisualization::VMethod*> ( target );
	if (m)
	{
		if ( (m->name()->itemOrChildHasFocus() || m->arguments()->itemOrChildHasFocus()) && createDown)
		{
			processed = true;
			if (m->node()->items()->size() > 0)
			{
				target->scene()->addPostEventAction( new Interaction::SetCursorEvent(target, m->node()->items()->at(0)));
			}
			else
			{
				auto empty = new OOModel::EmptyExpression();
				auto es = new OOModel::ExpressionStatement();
				es->setExpression(empty);
				m->node()->model()->beginModification(m->node(), "add empty statement");
				m->node()->items()->append(es);
				m->node()->model()->endModification();

				m->setUpdateNeeded(Visualization::Item::StandardUpdate);
				target->scene()->addPostEventAction( new Interaction::SetCursorEvent(target, empty));
			}
		}
		else if (m->name()->itemOrChildHasFocus() && switchHorizontal)
		{
			processed = true;

			if (m->node()->arguments()->size() > 0)
			{
				target->scene()->addPostEventAction( new Interaction::SetCursorEvent(target,
						m->node()->arguments()->at(0)));
			}
		}
		else if ( (m->name()->itemOrChildHasFocus()) && createRight)
		{
			processed = true;
			createNewArgument(m, 0);
		}
	}

	if (!processed) GenericHandler::keyPressEvent(target, event);
}
开发者ID:JurajKubelka,项目名称:Envision,代码行数:52,代码来源:HMethod.cpp

示例15: value

void QgsDateTimeSearchWidgetWrapper::dateTimeChanged( const QDateTime& dt )
{
  if ( mDateTimeEdit )
  {
    QString exp = value().toString();
    setExpression( exp );
    if ( dt.isValid() && !dt.isNull() )
      emit valueChanged();
    else
      emit valueCleared();
    emit expressionChanged( mExpression );
  }
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:13,代码来源:qgsdatetimesearchwidgetwrapper.cpp


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