这篇教程C++ testAttribute函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中testAttribute函数的典型用法代码示例。如果您正苦于以下问题:C++ testAttribute函数的具体用法?C++ testAttribute怎么用?C++ testAttribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了testAttribute函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: newScaleEngineQwtScaleDiv ScaleEngine::divideScale(double x1, double x2, int maxMajSteps, int maxMinSteps, double stepSize) const{ QwtScaleEngine *engine; if (!hasBreak()){ engine = newScaleEngine(); QwtScaleDiv div = engine->divideScale(x1, x2, maxMajSteps, maxMinSteps, stepSize); delete engine; return div; } double lb = d_break_left; double rb = d_break_right; double step1 = d_step_before; double step2 = d_step_after; if (x1 > x2){ lb = d_break_right; rb = d_break_left; step1 = d_step_after; step2 = d_step_before; if (d_log10_scale_after) engine = new QwtLog10ScaleEngine(); else engine = new QwtLinearScaleEngine(); } else engine = newScaleEngine(); int max_min_intervals = d_minor_ticks_before; if (d_minor_ticks_before == 1) max_min_intervals = 3; if (d_minor_ticks_before > 1) max_min_intervals = d_minor_ticks_before + 1; QwtScaleDiv div1 = engine->divideScale(x1, lb, maxMajSteps/2, max_min_intervals, step1); max_min_intervals = d_minor_ticks_after; if (d_minor_ticks_after == 1) max_min_intervals = 3; if (d_minor_ticks_after > 1) max_min_intervals = d_minor_ticks_after + 1; delete engine; if (testAttribute(QwtScaleEngine::Inverted)) engine = newScaleEngine(); else if (d_log10_scale_after) engine = new QwtLog10ScaleEngine(); else engine = new QwtLinearScaleEngine(); QwtScaleDiv div2 = engine->divideScale(rb, x2, maxMajSteps/2, max_min_intervals, step2); QwtValueList ticks[QwtScaleDiv::NTickTypes]; ticks[QwtScaleDiv::MinorTick] = div1.ticks(QwtScaleDiv::MinorTick) + div2.ticks(QwtScaleDiv::MinorTick); ticks[QwtScaleDiv::MediumTick] = div1.ticks(QwtScaleDiv::MediumTick) + div2.ticks(QwtScaleDiv::MediumTick); ticks[QwtScaleDiv::MajorTick] = div1.ticks(QwtScaleDiv::MajorTick) + div2.ticks(QwtScaleDiv::MajorTick); delete engine; return QwtScaleDiv(x1, x2, ticks);}
开发者ID:kuzavas,项目名称:qtiplot,代码行数:59,
示例2: addvoid NifBlockEditor::add( NifEditBox * box ){ editors.append( box ); if ( layouts.count() == 1 && testAttribute( Qt::WA_DeleteOnClose ) ) layouts.top()->insertWidget( layouts.top()->count() - 1, box ); else layouts.top()->addWidget( box );}
开发者ID:CobaltBlues,项目名称:nifskope,代码行数:8,
示例3: setVisible/*! /reimp*/void QFontDialog::setVisible(bool visible){ if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden) != visible) return; Q_D(QFontDialog); if (d->canBeNativeDialog()) d->setNativeDialogVisible(visible); if (d->nativeDialogInUse) { // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below // updates the state correctly, but skips showing the non-native version: setAttribute(Qt::WA_DontShowOnScreen, true); } else { d->nativeDialogInUse = false; setAttribute(Qt::WA_DontShowOnScreen, false); } QDialog::setVisible(visible);}
开发者ID:ghjinlei,项目名称:qt5,代码行数:20,
示例4: Q_Dvoid QWidget::destroy(bool destroyWindow, bool destroySubWindows){ Q_D(QWidget); d->aboutToDestroy(); if (!isWindow() && parentWidget()) parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry())); d->deactivateWidgetCleanup(); if (testAttribute(Qt::WA_WState_Created)) { setAttribute(Qt::WA_WState_Created, false); QObjectList childObjects = children(); for (int i = 0; i < childObjects.size(); ++i) { QObject *obj = childObjects.at(i); if (obj->isWidgetType()) static_cast<QWidget*>(obj)->destroy(destroySubWindows, destroySubWindows); } releaseMouse(); if (qt_pressGrab == this) qt_pressGrab = 0; if (keyboardGrb == this) releaseKeyboard(); if (testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal QApplicationPrivate::leaveModal(this); else if ((windowType() == Qt::Popup)) qApp->d_func()->closePopup(this);#ifndef QT_NO_IM if (d->ic) { delete d->ic; d->ic =0; } else { // release previous focus information participating with // preedit preservation of qic -- while we still have a winId QInputContext *qic = QApplicationPrivate::inputContext; if (qic) qic->widgetDestroyed(this); }#endif //QT_NO_IM if ((windowType() == Qt::Desktop)) { } else { if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) { d->hide_sys(); } if (destroyWindow && isWindow()) { if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) d->extra->topextra->backingStore->windowSurface->setGeometry(QRect()); qwsDisplay()->destroyRegion(internalWinId()); } } QT_TRY { d->setWinId(0); } QT_CATCH (const std::bad_alloc &) { // swallow - destructors must not throw } }}
开发者ID:Afreeca,项目名称:qt,代码行数:58,
示例5: testAttributevoid PreviewReportWindow::exec(){ bool deleteOnClose = testAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose,false); setAttribute(Qt::WA_ShowModal,true); show(); m_eventLoop.exec(); if (deleteOnClose) delete this;}
开发者ID:fralx,项目名称:LimeReport,代码行数:9,
示例6: pvoid BoxContent::paintEvent(QPaintEvent *e) { Painter p(this); if (testAttribute(Qt::WA_OpaquePaintEvent)) { for (auto rect : e->region().rects()) { p.fillRect(rect, st::boxBg); } }}
开发者ID:Emadpres,项目名称:tdesktop,代码行数:9,
示例7: interval/*! Align and divide an interval /param maxNumSteps Max. number of steps /param x1 First limit of the interval (In/Out) /param x2 Second limit of the interval (In/Out) /param stepSize Step size (Out) /sa QwtScaleEngine::setAttribute()*/void QwtLog10ScaleEngine::autoScale(int maxNumSteps, double &x1, double &x2, double &stepSize) const{ if ( x1 > x2 ) qSwap(x1, x2); QwtDoubleInterval interval(x1 / pow(10.0, lowerMargin()), x2 * pow(10.0, upperMargin()) ); double logRef = 1.0; if (reference() > LOG_MIN / 2) logRef = qwtMin(reference(), LOG_MAX / 2); if (testAttribute(QwtScaleEngine::Symmetric)) { const double delta = qwtMax(interval.maxValue() / logRef, logRef / interval.minValue()); interval.setInterval(logRef / delta, logRef * delta); } if (testAttribute(QwtScaleEngine::IncludeReference)) interval = interval.extend(logRef); interval = interval.limited(LOG_MIN, LOG_MAX); if (interval.width() == 0.0) interval = buildInterval(interval.minValue()); stepSize = divideInterval(log10(interval).width(), qwtMax(maxNumSteps, 1)); if ( stepSize < 1.0 ) stepSize = 1.0; if (!testAttribute(QwtScaleEngine::Floating)) interval = align(interval, stepSize); x1 = interval.minValue(); x2 = interval.maxValue(); if (testAttribute(QwtScaleEngine::Inverted)) { qSwap(x1, x2); stepSize = -stepSize; }}
开发者ID:376473984,项目名称:pvb,代码行数:54,
示例8: hasTrough/*! En/Disable the trough The slider can be cutomized by showing a trough for the handle. /param on When true, the groove is visible /sa hasTrough(), setGroove() */void QwtSlider::setTrough( bool on ){ if ( d_data->hasTrough != on ) { d_data->hasTrough = on; if ( testAttribute( Qt::WA_WState_Polished ) ) layoutSlider( true ); }}
开发者ID:151706061,项目名称:sofa,代码行数:19,
示例9: hasGroove/*! En/Disable the groove The slider can be cutomized by showing a groove for the handle. /param on When true, the groove is visible /sa hasGroove(), setThrough() */void QwtSlider::setGroove( bool on ){ if ( d_data->hasGroove != on ) { d_data->hasGroove = on; if ( testAttribute( Qt::WA_WState_Polished ) ) layoutSlider( true ); }}
开发者ID:151706061,项目名称:sofa,代码行数:19,
示例10: scalePosition/*! /brief Change the position of the scale /param scalePosition Position of the scale. /sa ScalePosition, scalePosition()*/void QwtThermo::setScalePosition( ScalePosition scalePosition ){ if ( d_data->scalePosition == scalePosition ) return; d_data->scalePosition = scalePosition; if ( testAttribute( Qt::WA_WState_Polished ) ) layoutThermo( true );}
开发者ID:151706061,项目名称:sofa,代码行数:16,
示例11: orientation/*! /brief Set the slider's handle size When the size is empty the slider handle will be painted with a default size depending on its orientation() and backgroundStyle(). /param size New size /sa handleSize()*/void QwtSlider::setHandleSize( const QSize &size ){ if ( size != d_data->handleSize ) { d_data->handleSize = size; if ( testAttribute( Qt::WA_WState_Polished ) ) layoutSlider( true ); }}
开发者ID:151706061,项目名称:sofa,代码行数:20,
示例12: AssertMsgReturnQDialog::DialogCode QIMainDialog::exec(bool fApplicationModal /* = true */){ /* Check for the recursive run: */ AssertMsgReturn(!m_pEventLoop, ("QIMainDialog::exec() is called recursively!/n"), QDialog::Rejected); /* Reset the result code: */ setResult(QDialog::Rejected); /* Should we delete ourself on close in theory? */ const bool fOldDeleteOnClose = testAttribute(Qt::WA_DeleteOnClose); /* For the exec() time, set this attribute to 'false': */ setAttribute(Qt::WA_DeleteOnClose, false); /* Which is the current window-modality? */ const Qt::WindowModality oldModality = windowModality(); /* For the exec() time, set this attribute to 'window-modal' or 'application-modal': */ setWindowModality(!fApplicationModal ? Qt::WindowModal : Qt::ApplicationModal); /* Show ourself: */ show(); /* Create a local event-loop: */ { QEventLoop eventLoop; m_pEventLoop = &eventLoop; /* Guard ourself for the case * we destroyed ourself in our event-loop: */ QPointer<QIMainDialog> guard = this; /* Start the blocking event-loop: */ eventLoop.exec(); /* Are we still valid? */ if (guard.isNull()) return QDialog::Rejected; m_pEventLoop = 0; } /* Save the result code early (we can delete ourself on close): */ const QDialog::DialogCode enmResultCode = result(); /* Return old modality: */ setWindowModality(oldModality); /* Reset attribute to previous value: */ setAttribute(Qt::WA_DeleteOnClose, fOldDeleteOnClose); /* Delete ourself if we should do that on close: */ if (fOldDeleteOnClose) delete this; /* Return the result code: */ return enmResultCode;}
开发者ID:miguelinux,项目名称:vbox,代码行数:55,
示例13: changeEvent/*! Handles QEvent::StyleChange and QEvent::FontChange events /param event Change event*/void QwtSlider::changeEvent( QEvent *event ){ if ( event->type() == QEvent::StyleChange || event->type() == QEvent::FontChange ) { if ( testAttribute( Qt::WA_WState_Polished ) ) layoutSlider( true ); } QwtAbstractSlider::changeEvent( event );}
开发者ID:151706061,项目名称:sofa,代码行数:15,
示例14: QPixmapvoid MediaView::showPhoto(PhotoData *photo) { _photo = photo; MTP::clearLoaderPriorities(); _photo->full->load(); _full = false; _current = QPixmap(); _w = photo->full->width(); _down = OverNone; int h = photo->full->height(); switch (cScale()) { case dbisOneAndQuarter: _w = qRound(float64(_w) * 1.25 - 0.01); h = qRound(float64(h) * 1.25 - 0.01); break; case dbisOneAndHalf: _w = qRound(float64(_w) * 1.5 - 0.01); h = qRound(float64(h) * 1.5 - 0.01); break; case dbisTwo: _w *= 2; h *= 2; break; } if (_w > _maxWidth) { h = qRound(h * _maxWidth / float64(_w)); _w = _maxWidth; } if (h > _maxHeight) { _w = qRound(_w * _maxHeight / float64(h)); h = _maxHeight; } _x = _avail.x() + (_avail.width() - _w) / 2; _y = _avail.y() + (_avail.height() - h) / 2; _from = App::user(_photo->user); updateControls(); if (isHidden()) { moveToScreen();#ifdef Q_OS_WIN bool wm = testAttribute(Qt::WA_Mapped), wv = testAttribute(Qt::WA_WState_Visible); if (!wm) setAttribute(Qt::WA_Mapped, true); if (!wv) setAttribute(Qt::WA_WState_Visible, true); update(); QEvent e(QEvent::UpdateRequest); event(&e); if (!wm) setAttribute(Qt::WA_Mapped, false); if (!wv) setAttribute(Qt::WA_WState_Visible, false);#endif show(); }}
开发者ID:CapnRat,项目名称:tdesktop,代码行数:41,
示例15: setAttributevoid QcCanvas::setBackground( const QColor &c ){ if(_bkg == c) return; _bkg = c; setAttribute( Qt::WA_OpaquePaintEvent, c.isValid() && c.alpha() == 255 ); setAttribute( Qt::WA_TranslucentBackground, c.isValid() ); if( !testAttribute(Qt::WA_WState_InPaintEvent) ) update();}
开发者ID:acamari,项目名称:supercollider,代码行数:12,
示例16: scalePosition/*! /brief Change the position of the scale /param scalePosition Position of the scale. /sa ScalePosition, scalePosition()*/void QwtSlider::setScalePosition( ScalePosition scalePosition ){ if ( d_data->scalePosition == scalePosition ) return; d_data->scalePosition = scalePosition; scaleDraw()->setAlignment( qwtScaleDrawAlignment( d_data->orientation, scalePosition ) ); if ( testAttribute( Qt::WA_WState_Polished ) ) layoutSlider( true );}
开发者ID:151706061,项目名称:sofa,代码行数:18,
示例17: ifvoid GtkFileDialog::setVisible(bool visible) { if (visible) { if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden)) { return; } } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) { return; } if (visible) { showHelper(windowFlags(), windowModality(), parentWidget() ? parentWidget()->windowHandle() : nullptr); } else { hideHelper(); } // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below // updates the state correctly, but skips showing the non-native version: setAttribute(Qt::WA_DontShowOnScreen); QDialog::setVisible(visible);}
开发者ID:2asoft,项目名称:tdesktop,代码行数:21,
示例18: testAttributeint GtkFileDialog::exec() { d->setModality(windowModality()); bool deleteOnClose = testAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose, false); bool wasShowModal = testAttribute(Qt::WA_ShowModal); setAttribute(Qt::WA_ShowModal, true); setResult(0); show(); QPointer<QDialog> guard = this; d->exec(); if (guard.isNull()) return QDialog::Rejected; setAttribute(Qt::WA_ShowModal, wasShowModal); return result();}
开发者ID:2asoft,项目名称:tdesktop,代码行数:21,
示例19: spacing/*! /brief Change the spacing between trough and scale A spacing of 0 means, that the backbone of the scale is covered by the trough. The default setting is 4 pixels. /param spacing Number of pixels /sa spacing();*/void QwtSlider::setSpacing( int spacing ){ if ( spacing <= 0 ) spacing = 0; if ( spacing != d_data->spacing ) { d_data->spacing = spacing; if ( testAttribute( Qt::WA_WState_Polished ) ) layoutSlider( true ); }}
开发者ID:151706061,项目名称:sofa,代码行数:24,
示例20: borderWidth/*! /brief Change the slider's border width The border width is used for drawing the slider handle and the trough. /param width Border width /sa borderWidth()*/void QwtSlider::setBorderWidth( int width ){ if ( width < 0 ) width = 0; if ( width != d_data->borderWidth ) { d_data->borderWidth = width; if ( testAttribute( Qt::WA_WState_Polished ) ) layoutSlider( true ); }}
开发者ID:151706061,项目名称:sofa,代码行数:22,
示例21: renderLegend/*! Render the legend into a given rectangle. /param painter Painter /param rect Bounding rectangle /param fillBackground When true, fill rect with the widget background /sa renderLegend() is used by QwtPlotRenderer - not by QwtLegend itself*/void QwtLegend::renderLegend( QPainter *painter, const QRectF &rect, bool fillBackground ) const{ if ( d_data->itemMap.isEmpty() ) return; if ( fillBackground ) { if ( autoFillBackground() || testAttribute( Qt::WA_StyledBackground ) ) { QwtPainter::drawBackgound( painter, rect, this ); } } const QwtDynGridLayout *legendLayout = qobject_cast<QwtDynGridLayout *>( contentsWidget()->layout() ); if ( legendLayout == NULL ) return; int left, right, top, bottom; getContentsMargins( &left, &top, &right, &bottom ); QRect layoutRect; layoutRect.setLeft( qCeil( rect.left() ) + left ); layoutRect.setTop( qCeil( rect.top() ) + top ); layoutRect.setRight( qFloor( rect.right() ) - right ); layoutRect.setBottom( qFloor( rect.bottom() ) - bottom ); uint numCols = legendLayout->columnsForWidth( layoutRect.width() ); QList<QRect> itemRects = legendLayout->layoutItems( layoutRect, numCols ); int index = 0; for ( int i = 0; i < legendLayout->count(); i++ ) { QLayoutItem *item = legendLayout->itemAt( i ); QWidget *w = item->widget(); if ( w ) { painter->save(); painter->setClipRect( itemRects[index], Qt::IntersectClip ); renderItem( painter, w, itemRects[index], fillBackground ); index++; painter->restore(); } }}
开发者ID:151706061,项目名称:sofa,代码行数:60,
示例22: setScaleDraw/*! /brief Set a scale draw For changing the labels of the scales, it is necessary to derive from QwtScaleDraw and overload QwtScaleDraw::label(). /param scaleDraw ScaleDraw object, that has to be created with new and will be deleted in ~QwtSlider() or the next call of setScaleDraw(). /sa scaleDraw()*/void QwtSlider::setScaleDraw( QwtScaleDraw *scaleDraw ){ const QwtScaleDraw *previousScaleDraw = this->scaleDraw(); if ( scaleDraw == NULL || scaleDraw == previousScaleDraw ) return; if ( previousScaleDraw ) scaleDraw->setAlignment( previousScaleDraw->alignment() ); setAbstractScaleDraw( scaleDraw ); if ( testAttribute( Qt::WA_WState_Polished ) ) layoutSlider( true );}
开发者ID:151706061,项目名称:sofa,代码行数:27,
示例23: Q_UNUSED/*! Paint event /param event Paint event /sa QwtPlot::drawCanvas()*/void QwtPlotGLCanvas::paintEvent( QPaintEvent *event ){ Q_UNUSED( event ); QPainter painter( this ); drawBackground( &painter ); drawItems( &painter ); if ( !testAttribute( Qt::WA_StyledBackground ) ) { if ( frameWidth() > 0 ) drawBorder( &painter ); }}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:21,
示例24: pushLayoutvoid NifBlockEditor::pushLayout( QBoxLayout * lay, const QString & name ){ if ( name.isEmpty() ) { if ( layouts.count() == 1 && testAttribute( Qt::WA_DeleteOnClose ) ) layouts.top()->insertLayout( layouts.top()->count() - 1, lay ); else layouts.top()->addLayout( lay ); layouts.push( lay ); } else { QGroupBox * group = new QGroupBox; group->setTitle( name ); group->setLayout( lay ); if ( layouts.count() == 1 && testAttribute( Qt::WA_DeleteOnClose ) ) layouts.top()->insertWidget( layouts.top()->count() - 1, group ); else layouts.top()->addWidget( group ); layouts.push( lay ); }}
开发者ID:CobaltBlues,项目名称:nifskope,代码行数:24,
示例25: QPixmapvoid QcCanvas::paintEvent( QPaintEvent *e ){ if( _paint && _repaintNeeded ) { if( _resize ) { _pixmap = QPixmap( size() ); _resize = false; _clearOnce = true; } if( _clearOnRefresh || _clearOnce ) { _pixmap.fill( QColor(0,0,0,0) ); _clearOnce = false; } bool opaque_before = testAttribute(Qt::WA_OpaquePaintEvent); QPainter pixPainter( &_pixmap ); Q_EMIT( painting(&pixPainter) ); _repaintNeeded = false; bool opaque_after = testAttribute(Qt::WA_OpaquePaintEvent); if( opaque_before && !opaque_after ) { repaint(); return; } } QPainter p(this); QPalette plt(palette()); if( _bkg.isValid() ) p.fillRect( e->rect(), _bkg ); if( _paint ) p.drawPixmap( e->rect(), _pixmap, e->rect() );}
开发者ID:acamari,项目名称:supercollider,代码行数:36,
注:本文中的testAttribute函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ testDataFromFile函数代码示例 C++ testAssert函数代码示例 |