本文整理汇总了C++中enabled函数的典型用法代码示例。如果您正苦于以下问题:C++ enabled函数的具体用法?C++ enabled怎么用?C++ enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了enabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ADD_INTERFACE_IMPL
BugzillaModule::BugzillaModule()
{
ADD_INTERFACE_IMPL(BugzillaNoteAddin);
ADD_INTERFACE_IMPL(BugzillaPreferencesFactory);
enabled(false);
}
示例2: render
void QgsDecorationNorthArrow::render( const QgsMapSettings &mapSettings, QgsRenderContext &context )
{
if ( !enabled() )
return;
double maxLength = mSize * mapSettings.outputDpi() / 25.4;
QSvgRenderer svg;
const QByteArray &svgContent = QgsApplication::svgCache()->svgContent( svgPath(), maxLength, mColor, mOutlineColor, 1.0, 1.0 );
svg.load( svgContent );
if ( svg.isValid() )
{
QSize size( maxLength, maxLength );
QRectF viewBox = svg.viewBoxF();
if ( viewBox.height() > viewBox.width() )
{
size.setWidth( maxLength * viewBox.width() / viewBox.height() );
}
else
{
size.setHeight( maxLength * viewBox.height() / viewBox.width() );
}
double centerXDouble = size.width() / 2.0;
double centerYDouble = size.height() / 2.0;
//save the current canvas rotation
context.painter()->save();
//
//work out how to shift the image so that it rotates
// properly about its center
//(x cos a + y sin a - x, -x sin a + y cos a - y)
//
// could move this call to somewhere else so that it is only
// called when the projection or map extent changes
if ( mAutomatic )
{
try
{
mRotationInt = QgsBearingUtils:: bearingTrueNorth( mapSettings.destinationCrs(), mapSettings.transformContext(), context.extent().center() );
}
catch ( QgsException & )
{
mRotationInt = 0.0;
}
mRotationInt += mapSettings.rotation();
}
double radiansDouble = mRotationInt * M_PI / 180.0;
int xShift = static_cast<int>( (
( centerXDouble * std::cos( radiansDouble ) ) +
( centerYDouble * std::sin( radiansDouble ) )
) - centerXDouble );
int yShift = static_cast<int>( (
( -centerXDouble * std::sin( radiansDouble ) ) +
( centerYDouble * std::cos( radiansDouble ) )
) - centerYDouble );
// need width/height of paint device
int deviceHeight = context.painter()->device()->height();
int deviceWidth = context.painter()->device()->width();
// Set margin according to selected units
int xOffset = 0;
int yOffset = 0;
switch ( mMarginUnit )
{
case QgsUnitTypes::RenderMillimeters:
{
int pixelsInchX = context.painter()->device()->logicalDpiX();
int pixelsInchY = context.painter()->device()->logicalDpiY();
xOffset = pixelsInchX * INCHES_TO_MM * mMarginHorizontal;
yOffset = pixelsInchY * INCHES_TO_MM * mMarginVertical;
break;
}
case QgsUnitTypes::RenderPixels:
xOffset = mMarginHorizontal - 5; // Minus 5 to shift tight into corner
yOffset = mMarginVertical - 5;
break;
case QgsUnitTypes::RenderPercentage:
xOffset = ( ( deviceWidth - size.width() ) / 100. ) * mMarginHorizontal;
yOffset = ( ( deviceHeight - size.width() ) / 100. ) * mMarginVertical;
break;
case QgsUnitTypes::RenderMapUnits:
case QgsUnitTypes::RenderPoints:
case QgsUnitTypes::RenderInches:
case QgsUnitTypes::RenderUnknownUnit:
case QgsUnitTypes::RenderMetersInMapUnits:
break;
}
//Determine placement of label from form combo box
switch ( mPlacement )
{
case BottomLeft:
context.painter()->translate( xOffset, deviceHeight - yOffset - maxLength + ( maxLength - size.height() ) / 2 );
break;
case TopLeft:
context.painter()->translate( xOffset, yOffset );
//.........这里部分代码省略.........
示例3: setCount
void setCount(const Counter counter) {
if (enabled()) {
mCount = counter;
mHasCount = true;
}
}
示例4: enabledChanged
void LayerThicknessVariation::updateEnabled()
{
emit enabledChanged(enabled());
}
示例5: is_enabled
bool is_enabled() const {
data::read enabled(m_enabled);
return enabled.use();
}
示例7: on_create
void on_create( const value_type& v ) {
if( !enabled() ) return;
auto& head = _stack.back();
head.new_ids.insert( v.id );
}
示例8: dprintf
void
OfflineCollectorPlugin::update (
int command,
ClassAd &ad )
{
dprintf (
D_FULLDEBUG,
"In OfflineCollectorPlugin::update ( %d )\n",
command );
/* bail out if the plug-in is not enabled */
if ( !enabled () ) {
return;
}
/* make sure the command is relevant to us */
if ( UPDATE_STARTD_AD_WITH_ACK != command &&
UPDATE_STARTD_AD != command &&
MERGE_STARTD_AD != command ) {
return;
}
MyString s;
const char *key = makeOfflineKey(ad,s);
if (!key) return;
/* report whether this ad is "off-line" or not and update
the ad accordingly. */
int offline = FALSE,
lifetime = 0;
bool offline_explicit = false;
if( ad.EvalBool( ATTR_OFFLINE, NULL, offline ) ) {
offline_explicit = true;
}
if ( MERGE_STARTD_AD == command ) {
mergeClassAd( ad, key );
return;
}
// Rewrite the ad if it is going offline
if ( UPDATE_STARTD_AD_WITH_ACK == command && !offline_explicit ) {
/* set the off-line state of the machine */
offline = TRUE;
/* get the off-line expiry time (default to INT_MAX) */
lifetime = param_integer (
"OFFLINE_EXPIRE_ADS_AFTER",
INT_MAX );
/* reset any values in the ad that may interfere with
a match in the future */
/* Reset Condor state */
ad.Assign ( ATTR_STATE, state_to_string ( unclaimed_state ) );
ad.Assign ( ATTR_ACTIVITY, activity_to_string ( idle_act ) );
ad.Assign ( ATTR_ENTERED_CURRENT_STATE, 0 );
ad.Assign ( ATTR_ENTERED_CURRENT_ACTIVITY, 0 );
/* Set the heart-beat time */
int now = static_cast<int> ( time ( NULL ) );
ad.Assign ( ATTR_MY_CURRENT_TIME, now );
ad.Assign ( ATTR_LAST_HEARD_FROM, now );
/* Reset machine load */
ad.Assign ( ATTR_LOAD_AVG, 0.0 );
ad.Assign ( ATTR_CONDOR_LOAD_AVG, 0.0 );
ad.Assign ( ATTR_TOTAL_LOAD_AVG, 0.0 );
ad.Assign ( ATTR_TOTAL_CONDOR_LOAD_AVG, 0.0 );
/* Reset CPU load */
ad.Assign ( ATTR_CPU_IS_BUSY, false );
ad.Assign ( ATTR_CPU_BUSY_TIME, 0 );
/* Reset keyboard and mouse times */
ad.Assign ( ATTR_KEYBOARD_IDLE, INT_MAX );
ad.Assign ( ATTR_CONSOLE_IDLE, INT_MAX );
/* any others? */
dprintf (
D_FULLDEBUG,
"Machine ad lifetime: %d\n",
lifetime );
/* record the new values as specified above */
ad.Assign ( ATTR_OFFLINE, (bool)offline );
if ( lifetime > 0 ) {
ad.Assign ( ATTR_CLASSAD_LIFETIME, lifetime );
}
}
/* if it is off-line then add it to the list; otherwise,
remove it. */
if ( offline > 0 ) {
persistentStoreAd(key,ad);
//.........这里部分代码省略.........
示例9: squash
/**
* This method works similar to git squash, it merges the change set from the two most
* recent revision numbers into one revision number (reducing the head revision number)
*
* This method does not change the state of the index, only the state of the undo buffer.
*/
void squash()
{
if( !enabled() ) return;
if( _stack.size() == 1 ) {
_stack.pop_front();
return;
}
auto& state = _stack.back();
auto& prev_state = _stack[_stack.size()-2];
// An object's relationship to a state can be:
// in new_ids : new
// in old_values (was=X) : upd(was=X)
// in removed (was=X) : del(was=X)
// not in any of above : nop
//
// When merging A=prev_state and B=state we have a 4x4 matrix of all possibilities:
//
// |--------------------- B ----------------------|
//
// +------------+------------+------------+------------+
// | new | upd(was=Y) | del(was=Y) | nop |
// +------------+------------+------------+------------+------------+
// / | new | N/A | new A| nop C| new A|
// | +------------+------------+------------+------------+------------+
// | | upd(was=X) | N/A | upd(was=X)A| del(was=X)C| upd(was=X)A|
// A +------------+------------+------------+------------+------------+
// | | del(was=X) | N/A | N/A | N/A | del(was=X)A|
// | +------------+------------+------------+------------+------------+
// \ | nop | new B| upd(was=Y)B| del(was=Y)B| nop AB|
// +------------+------------+------------+------------+------------+
//
// Each entry was composed by labelling what should occur in the given case.
//
// Type A means the composition of states contains the same entry as the first of the two merged states for that object.
// Type B means the composition of states contains the same entry as the second of the two merged states for that object.
// Type C means the composition of states contains an entry different from either of the merged states for that object.
// Type N/A means the composition of states violates causal timing.
// Type AB means both type A and type B simultaneously.
//
// The merge() operation is defined as modifying prev_state in-place to be the state object which represents the composition of
// state A and B.
//
// Type A (and AB) can be implemented as a no-op; prev_state already contains the correct value for the merged state.
// Type B (and AB) can be implemented by copying from state to prev_state.
// Type C needs special case-by-case logic.
// Type N/A can be ignored or assert(false) as it can only occur if prev_state and state have illegal values
// (a serious logic error which should never happen).
//
// We can only be outside type A/AB (the nop path) if B is not nop, so it suffices to iterate through B's three containers.
for( const auto& item : state.old_values )
{
if( prev_state.new_ids.find( item.second.id ) != prev_state.new_ids.end() )
{
// new+upd -> new, type A
continue;
}
if( prev_state.old_values.find( item.second.id ) != prev_state.old_values.end() )
{
// upd(was=X) + upd(was=Y) -> upd(was=X), type A
continue;
}
// del+upd -> N/A
assert( prev_state.removed_values.find(item.second.id) == prev_state.removed_values.end() );
// nop+upd(was=Y) -> upd(was=Y), type B
prev_state.old_values.emplace( std::move(item) );
}
// *+new, but we assume the N/A cases don't happen, leaving type B nop+new -> new
for( auto id : state.new_ids )
prev_state.new_ids.insert(id);
// *+del
for( auto& obj : state.removed_values )
{
if( prev_state.new_ids.find(obj.second.id) != prev_state.new_ids.end() )
{
// new + del -> nop (type C)
prev_state.new_ids.erase(obj.second.id);
continue;
}
auto it = prev_state.old_values.find(obj.second.id);
if( it != prev_state.old_values.end() )
{
// upd(was=X) + del(was=Y) -> del(was=X)
prev_state.removed_values.emplace( std::move(*it) );
prev_state.old_values.erase(obj.second.id);
continue;
}
// del + del -> N/A
assert( prev_state.removed_values.find( obj.second.id ) == prev_state.removed_values.end() );
//.........这里部分代码省略.........
示例10: undo_all
/**
* Unwinds all undo states
*/
void undo_all()
{
while( enabled() )
undo();
}
示例11: enabled
void Download::setEnabled(bool e)
{
m_enabled = e;
emit enabled(e);
}
示例12: switch
//___________________________________________________________________
bool LabelData::eventFilter( QObject* object, QEvent* event ) {
if ( object != target_.data() ) return TransitionData::eventFilter( object, event );
switch ( event->type() ) {
case QEvent::Show:
/*
at show event, on set the old text to current
to avoid animate the "first" paint event.
text mnemonic is always removed to avoid triggering the animation when only the
latter is changed
*/
text_ = target_.data()->text().remove( '&' );
break;
case QEvent::Paint: {
if ( enabled() && target_ ) {
// remove showMnemonic from text before comparing
QString text( target_.data()->text().remove( '&' ) );
if ( text == text_ ) {
if ( transition().data()->isAnimated() && TransitionWidget::paintEnabled() ) return true;
else break;
}
// update text and pixmap
text_ = text;
if ( !(transition() && target_.data()->isVisible() ) ) break;
if ( transition().data()->isAnimated() ) {
transition().data()->endAnimation();
}
// check whether animations are locked
if ( isLocked() ) {
// hide transition widget
transition().data()->hide();
// restart the lock timer
// and abort transition
lockAnimations();
break;
}
// restart the lock timer
// and prepare transition
lockAnimations();
initializeAnimation();
timer_.start( 0, this );
if ( !transition().data()->startPixmap().isNull() && TransitionWidget::paintEnabled() ) {
// show the transition widget
// and disable this event painting
transition().data()->show();
transition().data()->raise();
return true;
}
else {
// hide transition widget and abort transition
transition().data()->hide();
break;
}
}
else if ( transition().data()->isAnimated() && TransitionWidget::paintEnabled() ) {
// disable painting when transition is running
// since label is obscured by transition widget
return true;
}
else break;
}
default:
break;
}
return TransitionData::eventFilter( object, event );
}
示例13: file_name
// Return commands to restore this breakpoint, using the dummy number
// NR. If AS_DUMMY is set, delete the breakpoint immediately in order
// to increase the breakpoint number. If ADDR is set, use ADDR as
// (fake) address. If COND is set, use COND as (fake) condition.
// Return true iff successful.
bool BreakPoint::get_state(std::ostream& os, int nr, bool as_dummy,
string pos, string cond)
{
if (pos.empty())
{
if (line_nr() > 0)
pos = file_name() + ":" + itostring(line_nr());
else
pos = string('*') + address();
}
if (cond == char(-1))
cond = real_condition();
const string num = "@" + itostring(nr) + "@";
switch (gdb->type())
{
case BASH:
case GDB:
case MAKE:
case PYDB:
case DBG:
{
switch (type())
{
case BREAKPOINT:
{
switch (dispo())
{
case BPKEEP:
case BPDIS:
os << "break " << pos << "\n";
break;
case BPDEL:
os << "tbreak " << pos << "\n";
break;
}
break;
}
case WATCHPOINT:
{
os << gdb->watch_command(expr(), watch_mode()) << "\n";
break;
}
case TRACEPOINT:
case ACTIONPOINT:
{
// Not handled - FIXME
break;
}
}
if (!as_dummy)
{
// Extra infos
if (!enabled() && gdb->has_disable_command())
os << gdb->disable_command(num) << "\n";
int ignore = ignore_count();
if (ignore > 0 && gdb->has_ignore_command())
os << gdb->ignore_command(num, ignore) << "\n";
if (!cond.empty() && gdb->has_condition_command())
os << gdb->condition_command(num, cond) << "\n";
if (commands().size() != 0)
{
os << "commands " << num << "\n";
for (int i = 0; i < commands().size(); i++)
os << commands()[i] << "\n";
os << "end\n";
}
}
break;
}
case DBX:
{
string cond_suffix = "";
if (!cond.empty())
{
if (gdb->has_handler_command())
cond_suffix = " -if " + cond;
else
cond_suffix = " if " + cond;
}
switch (type())
{
case BREAKPOINT:
if (!func().empty())
{
os << "stop in " << func() << "\n";
}
//.........这里部分代码省略.........
示例14: onDraw
void LightComponent::onDraw(render::RenderQueue *ops)
{
if (enabled())
ops->lights.push_back(this);
}
示例15: linger
// Construct with specific option values.
linger(bool e, int t)
{
enabled(e);
timeout BOOST_PREVENT_MACRO_SUBSTITUTION(t);
}