• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QMAX函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: switch

QwtDoubleRect VectorCurve::boundingRect() const
{
QwtDoubleRect rect = QwtPlotCurve::boundingRect();
QwtDoubleRect vrect = vectorEnd->boundingRect();

if (d_style == XYXY){
	rect.setTop(QMIN((double)rect.top(), (double)vrect.top()));
	rect.setBottom(QMAX((double)rect.bottom(), (double)vrect.bottom()));
	rect.setLeft(QMIN((double)rect.left(), (double)vrect.left()));
	rect.setRight(QMAX((double)rect.right(), (double)vrect.right()));
} else {
	const double angle = vectorEnd->x(0);
	double mag = vectorEnd->y(0);
	switch(d_position)
		{
		case Tail:
			rect.setTop(QMIN((double)rect.top(), (double)(rect.top()+mag*sin(angle))));
			rect.setBottom(QMAX((double)rect.bottom(), (double)(rect.bottom()+mag*sin(angle))));
			rect.setLeft(QMIN((double)rect.left(), (double)(rect.left()+mag*cos(angle))));
			rect.setRight(QMAX((double)rect.right(), (double)(rect.right()+mag*cos(angle))));
		break;

		case Middle:
			{
			mag *= 0.5;
			rect.setTop(QMIN((double)rect.top(), (double)(rect.top() - fabs(mag*sin(angle)))));
			rect.setBottom(QMAX((double)rect.bottom(), (double)(rect.bottom() + fabs(mag*sin(angle)))));
			rect.setLeft(QMIN((double)rect.left(), (double)(rect.left() - fabs(mag*cos(angle)))));
			rect.setRight(QMAX((double)rect.right(), (double)(rect.right() + fabs(mag*cos(angle)))));
			}
		break;

		case Head:
			rect.setTop(QMIN((double)rect.top(), (double)(rect.top() - mag*sin(angle))));
			rect.setBottom(QMAX((double)rect.bottom(), (double)(rect.bottom() - mag*sin(angle))));
			rect.setLeft(QMIN((double)rect.left(), (double)(rect.left() - mag*cos(angle))));
			rect.setRight(QMAX((double)rect.right(), (double)(rect.right() - mag*cos(angle))));
		break;
		}
	}
return rect;
}
开发者ID:jkrueger1,项目名称:mantid,代码行数:42,代码来源:VectorCurve.cpp


示例2: it

/** Executes the simulation of this component */
void FloatMax::calculate()
{
	FloatXIn1Out::calculate();

	QPtrListIterator<ConnectorBase> it(*getInputConnectorPack()->getConnList());
	
	// Hint: Gate has min 2 inputs !!! No check is required.
	double result = ((ConnectorFloatIn*)it.current())->getInput();
	++it;
		
	while (it.current())		
	{
		result = QMAX(result, ((ConnectorFloatIn*)it.current())->getInput());
		++it;
	}
		
	setValue(result);
}
开发者ID:BackupTheBerlios,项目名称:ksimus,代码行数:19,代码来源:floatmax.cpp


示例3: ASSERT

QSize KWQFileButton::sizeForCharacterWidth(int characters) const
{
    ASSERT(characters > 0);

    GtkWidget *w;
    GtkRequisition req, req2;

    // get the size from input
    w = getGtkEntryWidget();    
    gtk_entry_set_width_chars( GTK_ENTRY(w), characters );        
    gtk_widget_size_request( w, &req );

    // get the size from button
    w = getGtkButtonWidget();
    gtk_widget_size_request( w, &req2 );    
   
    return QSize( req.width + req2.width + 10, QMAX(req.height, req2.height) );
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:18,代码来源:KWQFileButton.cpp


示例4: initGlobals

void Matrix::initImage(const QImage& image)
{
    initGlobals();
	d_view_type = ImageView;

    d_matrix_model = new MatrixModel(image, this);
    initImageView();

	int w = image.width();
	int h = image.height();
	if (w <= 500 && h <= 400){
		int size = QMAX(w, h);
        imageLabel->resize(size, size);
    } else
		imageLabel->resize(500, 500);

	displayImage(image);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:18,代码来源:Matrix.cpp


示例5: b

void KateFileListItem::paintCell(QPainter *painter, const QColorGroup &cg, int column, int width, int align)
{
    KateFileList *fl = (KateFileList *)listView();
    if(!fl)
        return;

    if(column == 0)
    {
        QColorGroup cgNew = cg;

        // replace the base color with a different shading if necessary...
        if(fl->shadingEnabled() && m_viewhistpos > 1)
        {
            QColor b(cg.base());

            QColor shade = fl->viewShade();
            QColor eshade = fl->editShade();
            int hc = fl->histCount();
            // If this file is in the edit history, blend in the eshade
            // color. The blend is weighted by the position in the editing history
            if(fl->shadingEnabled() && m_edithistpos > 0)
            {
                int ec = fl->editHistCount();
                int v = hc - m_viewhistpos;
                int e = ec - m_edithistpos + 1;
                e = e * e;
                int n = QMAX(v + e, 1);
                shade.setRgb(((shade.red() * v) + (eshade.red() * e)) / n, ((shade.green() * v) + (eshade.green() * e)) / n,
                             ((shade.blue() * v) + (eshade.blue() * e)) / n);
            }
            // blend in the shade color.
            // max transperancy < .5, latest is most colored.
            float t = (0.5 / hc) * (hc - m_viewhistpos + 1);
            b.setRgb((int)((b.red() * (1 - t)) + (shade.red() * t)), (int)((b.green() * (1 - t)) + (shade.green() * t)),
                     (int)((b.blue() * (1 - t)) + (shade.blue() * t)));

            cgNew.setColor(QColorGroup::Base, b);
        }

        QListViewItem::paintCell(painter, cgNew, column, width, align);
    }
    else
        QListViewItem::paintCell(painter, cg, column, width, align);
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:44,代码来源:katefilelist.cpp


示例6: p1

/*!
  Draw a needle looking like a ray
*/
void QwtDialSimpleNeedle::drawRayNeedle(
    QPainter *painter, const QColorGroup &cg,
    const QPoint &center, int length, int width, double direction, 
    bool hasKnob)
{
    if ( width <= 0 )
        width = 5;

    direction *= M_PI / 180.0;

    painter->save();

    const QPoint p1(center.x() + 1, center.y() + 2);
    const QPoint p2 = qwtPolar2Pos(p1, length, direction);

    if ( width == 1 )
    {
        painter->setPen(QPen(cg.mid(), 1));
        painter->drawLine(p1, p2);
    }
    else
    {
        QPointArray pa(4);
        pa.setPoint(0, qwtPolar2Pos(p1, width / 2, direction + M_PI_2));
        pa.setPoint(1, qwtPolar2Pos(p2, width / 2, direction + M_PI_2));
        pa.setPoint(2, qwtPolar2Pos(p2, width / 2, direction - M_PI_2));
        pa.setPoint(3, qwtPolar2Pos(p1, width / 2, direction - M_PI_2));

        painter->setPen(Qt::NoPen);
        painter->setBrush(cg.brush(QColorGroup::Mid));
        painter->drawPolygon(pa);
    }
    if ( hasKnob )
    {
        int knobWidth = QMAX(qRound(width * 0.7), 5);
        if ( knobWidth % 2 == 0 )
            knobWidth++;

        drawKnob(painter, center, knobWidth, 
            cg.brush(QColorGroup::Base), FALSE);
    }

    painter->restore();
}
开发者ID:jiajw0426,项目名称:easyscada,代码行数:47,代码来源:qwt_dial_needle.cpp


示例7: QMAX

void ScheduleDialog::initCanvas()
{
    DrawProperties p;

    p.canvas = canvas;
    p.nameWidth = 0;        // name labels are on other canvas
    p.x = WIDGET_SPACING;
    p.y = 0;
    p.width = canvas->width();
    p.height = canvas->height();

    // calculate pix per ns (find block with highest clock to draw it
    // BLOCKS_PER_CANVAS times.
    unsigned int max_clock = 0;
    QValueList<BlockNode*>::Iterator it;
    for (it = blocks_.begin(); it != blocks_.end(); ++it) {
        max_clock = QMAX(max_clock, (*it)->clock());
    }
    p.pixPerNs = (max_clock > 0)
        ? (double)p.width / (max_clock * BLOCKS_PER_CANVAS)
        : 1.0;

    drawRuler(&p);
    for (it = blocks_.begin(); it != blocks_.end(); ++it) {
        drawTimings(&p, *it);
    }

    // create highlighter
    highlightCanvasRectangle = new QCanvasRectangle(canvas);
    highlightCanvasRectangle->setSize(canvas->width(),
                                      BOX_HEIGHT + BOX_YSPACING);
    highlightCanvasRectangle->setBrush(QBrush(qApp->palette().active().highlight()));
    highlightCanvasRectangle->setPen(QPen(white));
    highlightCanvasRectangle->move(0, RULER_HEIGHT - BOX_YSPACING / 2);
    highlightCanvasRectangle->setZ(0);
    highlightCanvasRectangle->show();

    connect(timingTable, SIGNAL(currentChanged(int, int)),
            this, SLOT(updateHighlighter(int, int)));

    canvas->update();
    labelCanvas->update();
}
开发者ID:BackupTheBerlios,项目名称:poa,代码行数:43,代码来源:scheduledialog.cpp


示例8: activateCurve

void fitDialog::activateCurve(int index)
{
    QwtPlotCurve *c = graph->curve(index);
    if (!c)
        return;

    if (graph->selectorsEnabled() && graph->selectedCurveID() == graph->curveKey(index))
    {
        double start = graph->selectedXStartValue();
        double end = graph->selectedXEndValue();
        boxFrom->setText(QString::number(QMIN(start, end), 'g', 15));
        boxTo->setText(QString::number(QMAX(start, end), 'g', 15));
    }
    else
    {
        boxFrom->setText(QString::number(c->minXValue(), 'g', 15));
        boxTo->setText(QString::number(c->maxXValue(), 'g', 15));
    }
};
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:19,代码来源:fitDialog.cpp


示例9: QMAX

int NADDirectSource::frameCount(const QString& field) const {
  if (!_valid) {
    return 0;
  }

  if (field.isEmpty() || _fieldList.contains(field)) {
    int maxLen = 0;
    for (QStringList::ConstIterator i = _fieldList.begin(); i != _fieldList.end(); ++i) {
//      assert(!(*i).isEmpty());
      QSize sz = _conn->range(*i);
      maxLen = QMAX(sz.height() - sz.width() + 1, maxLen);
    }
    kstdDebug() << "NAD::frameCount(" << field << ") = maxLen = " << maxLen << endl;
    return maxLen;
  }

  QSize sz = _conn->range(field);
  kstdDebug() << "NAD::frameCount(" << field << ") = " << sz.height() - sz.width() + 1 << endl;
  return sz.height() - sz.width() + 1;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:20,代码来源:naddirect.cpp


示例10: QMAX

void QCompletionEdit::placeListBox()
{
    if ( listbox->count() == 0 ) {
	popup->close();
	return;
    }

    popup->resize( QMAX( listbox->sizeHint().width() + listbox->verticalScrollBar()->width() + 4, width() ),
		   listbox->sizeHint().height() + listbox->horizontalScrollBar()->height() + 4 );

    QPoint p( mapToGlobal( QPoint( 0, 0 ) ) );
    if ( p.y() + height() + popup->height() <= QApplication::desktop()->height() )
	popup->move( p.x(), p.y() + height() );
    else
	popup->move( p.x(), p.y() - listbox->height() );
    popup->show();
    listbox->setCurrentItem( 0 );
    listbox->setSelected( 0, TRUE );
    setFocus();
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:20,代码来源:qcompletionedit.cpp


示例11: if

void QSplitter::getRange( int id, int *min, int *max )
{
    int minB = 0;	//before
    int maxB = 0;
    int minA = 0;
    int maxA = 0;	//after
    int n = data->list.count();
    if ( id < 0 || id >= n )
	return;
    int i;
    for ( i = 0; i < id; i++ ) {
	QSplitterLayoutStruct *s = data->list.at(i);
	if ( s->wid->isHidden() ) {
	    //ignore
	} else if ( s->isSplitter ) {
	    minB += s->sizer;
	    maxB += s->sizer;
	} else {
	    minB += pick( minSize(s->wid) );
	    maxB += pick( s->wid->maximumSize() );
	}
    }
    for ( i = id; i < n; i++ ) {
	QSplitterLayoutStruct *s = data->list.at(i);
	if ( s->wid->isHidden() ) {
	    //ignore
	} else 	if ( s->isSplitter ) {
	    minA += s->sizer;
	    maxA += s->sizer;
	} else {
	    minA += pick( minSize(s->wid) );
	    maxA += pick( s->wid->maximumSize() );
	}
    }
    QRect r = contentsRect();
    if ( min )
	*min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA );
    if ( max )
	*max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA );

}
开发者ID:opieproject,项目名称:opie,代码行数:41,代码来源:qsplitter.cpp


示例12: return

int QFontMetrics::charWidth( const QString &str, int pos ) const
{
    if ( pos < 0 || pos > (int)str.length() )
	return 0;

    const QChar &ch = str.unicode()[ pos ];
    if ( ch.unicode() < QFontEngineData::widthCacheSize &&
	 d->engineData && d->engineData->widthCache[ ch.unicode() ] )
	return (d->engineData->widthCache[ ch.unicode() ]*d->engineData->engine->scale)>>8;

    QFont::Script script;
    SCRIPT_FOR_CHAR( script, ch );

    int width;

    if ( script >= QFont::Arabic && script <= QFont::Khmer ) {
	// complex script shaping. Have to do some hard work
	int from = QMAX( 0,  pos - 8 );
	int to = QMIN( (int)str.length(), pos + 8 );
	QConstString cstr( str.unicode()+from, to-from);
	QTextEngine layout( cstr.string(), d );
	layout.itemize( QTextEngine::WidthOnly );
	width = layout.width( pos-from, 1 );
    } else if ( ::category( ch ) == QChar::Mark_NonSpacing || qIsZeroWidthChar(ch.unicode())) {
        width = 0;
    } else {
	QFontEngine *engine = d->engineForScript( script );
#ifdef QT_CHECK_STATE
	Q_ASSERT( engine != 0 );
#endif // QT_CHECK_STATE

	glyph_t glyphs[8];
	advance_t advances[8];
	int nglyphs = 7;
	engine->stringToCMap( &ch, 1, glyphs, advances, &nglyphs, FALSE );
	width = advances[0];
    }
    if ( ch.unicode() < QFontEngineData::widthCacheSize && width > 0 && width < 0x100 )
	d->engineData->widthCache[ ch.unicode() ] = width;
    return width;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:41,代码来源:qfont_qws.cpp


示例13: curveRange

int Filter::curveRange(QwtPlotCurve *c, double start, double end, int *iStart, int *iEnd)
{
    if (!c)
        return 0;

    int n = c->dataSize();
    int i_start = 0, i_end = n;

	if (c->x(0) < c->x(n-1)){
    	for (int i = 0; i < n; i++){
  	   	 if (c->x(i) >= start){
  	    	  i_start = i;
          	break;
        	}
		}
    	for (int i = n-1; i >= 0; i--){
  	    	if (c->x(i) <= end){
  	      		i_end = i;
          		break;
        	}
		}
	} else {
    	for (int i = 0; i < n; i++){
  	   	 if (c->x(i) <= end){
  	    	  i_start = i;
          	break;
        	}
		}
    	for (int i = n-1; i >= 0; i--){
  	    	if (c->x(i) >= start){
  	      		i_end = i;
          		break;
        	}
		}
	}

	*iStart = QMIN(i_start, i_end);
	*iEnd = QMAX(i_start, i_end);
    n = abs(i_end - i_start) + 1;
    return n;
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:41,代码来源:Filter.cpp


示例14: setMinimumSize

void SetTabFret::stringChanged(int n)
{
    if (oldst == n)
		return;

	if (defaultByString[n - 1] != 0)
		for (int i = 0; i < n; i++)
			tuner[i]->setValue(lib_tuning[defaultByString[n - 1]].shift[i]);

    if (oldst < n) {       // Need to add
		for (int i = oldst; i < n; i++)
			tuner[i]->show();
    } else {             // Need to delete
		for (int i = n; i < oldst; i++)
			tuner[i]->hide();
    }
    oldst = n;

    setMinimumSize(QMAX(330, 20 + RADTUNER_W * n), 90+RADTUNER_H);
    reposTuners();
}
开发者ID:fil4028,项目名称:TestGIT,代码行数:21,代码来源:settabfret.cpp


示例15: QMAX

/*!
  Draw a compass needle 
*/
void QwtCompassMagnetNeedle::drawThinNeedle(
    QPainter *painter, const QColorGroup &cg,
    const QPoint &center, int length, double direction) 
{
    const int colorOffset = 10;
    const int width = QMAX(qRound(length / 6.0), 3);

    painter->save();

    const QPoint arrowCenter(center.x() + 1, center.y() + 1);

    drawPointer(painter, cg.brush(QColorGroup::Dark), colorOffset, 
        arrowCenter, length, width, direction);
    drawPointer(painter, cg.brush(QColorGroup::Light), -colorOffset, 
        arrowCenter, length, width, direction + 180.0);
    
    drawKnob(painter, arrowCenter, width, 
        cg.brush(QColorGroup::Base), TRUE);

    painter->restore();
}
开发者ID:jiajw0426,项目名称:easyscada,代码行数:24,代码来源:qwt_dial_needle.cpp


示例16: QMAX

void GeometryTip::setGeometry(const QRect &geom)
{
    int w = geom.width();
    int h = geom.height();

    if(sizeHints)
    {
        if(sizeHints->flags & PResizeInc)
        {
            w = (w - sizeHints->base_width) / sizeHints->width_inc;
            h = (h - sizeHints->base_height) / sizeHints->height_inc;
        }
    }

    h = QMAX(h, 0); // in case of isShade() and PBaseSize
    QString pos;
    pos.sprintf("%+d,%+d<br>(<b>%d&nbsp;x&nbsp;%d</b>)", geom.x(), geom.y(), w, h);
    setText(pos);
    adjustSize();
    move(geom.x() + ((geom.width() - width()) / 2), geom.y() + ((geom.height() - height()) / 2));
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:21,代码来源:geometrytip.cpp


示例17: removeWidget

int QWidgetStack::addWidget( QWidget * w, int id )
{
    static int nseq_no = -2;
    static int pseq_no = 0;

    if ( !w || w == invisible )
	return -1;

    // prevent duplicates
    removeWidget( w );

    if ( id >= 0 && dict->find( id ) )
	id = -2;
    if ( id < -1 )
	id = nseq_no--;
    else if ( id == -1 )
	id = pseq_no++;
    else
	pseq_no = QMAX(pseq_no, id + 1);
	// use id >= 0 as-is

    dict->insert( id, w );

    // preserve existing focus
    QWidget * f = w->focusWidget();
    while( f && f != w )
	f = f->parentWidget();
    if ( f ) {
	if ( !focusWidgets )
	    focusWidgets = new QPtrDict<QWidget>( 17 );
	focusWidgets->replace( w, w->focusWidget() );
    }

    w->hide();
    if ( w->parent() != this )
	w->reparent( this, contentsRect().topLeft(), FALSE );
    w->setGeometry( contentsRect() );
    updateGeometry();
    return id;
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:40,代码来源:qwidgetstack.cpp


示例18: cursorRight

void QLineEdit::cursorLeft( bool mark, int steps )
{
    if ( steps < 0 ) {
	cursorRight( mark, -steps );
	return;
    }
    if ( cursorPos > 0 || (!mark && hasMarkedText()) ) {
	cursorPos -= steps;
	if ( cursorPos < 0 )
	    cursorPos = 0;
	cursorOn = FALSE;
	blinkSlot();
	int minP = QMIN( minMark(), cursorPos );
	int maxP = QMAX( maxMark(), cursorPos );
	if ( mark )
	    newMark( cursorPos );
	else
	    markAnchor = markDrag = cursorPos;
	d->pmDirty = TRUE;
	repaintArea( minP, maxP );
    }
}
开发者ID:kthxbyte,项目名称:Qt1.45-Linaro,代码行数:22,代码来源:qlineedit.cpp


示例19: pixmap

QSize
MenuItem::minimumSizeHint() const
{
	// Make the cell at least as high the pixmap or two lines of text one 
	// is being the smaller description + the 2 pixel offsets at top and bottom
	int pixmapHeight = pixmap()->height() + 2 * m_secOffset;

	// title itself
	int textHeight = QApplication::fontMetrics().height();

	// prepare description font
	QFont f = QApplication::font();
	f.setPointSize( f.pointSize() - m_descFontOffset ); // maybe this can be handled better ?
	textHeight += QFontMetrics( f ).height() * m_descLines;
	// Now use whichever is bigger, because we want it to fit always
	int height = QMAX( pixmapHeight, textHeight );
	// Add offsets
	height += 2 * m_offset;

	kdDebug() << k_funcinfo << "FIXME: really calculate min width" << endl;
	return QSize( 150, height );
}
开发者ID:engina,项目名称:xkmenu,代码行数:22,代码来源:menuitem.cpp


示例20: QMAX

void ListViewEditor::setupItems()
{
    itemColumn->setMinValue( 0 );
    itemColumn->setMaxValue( QMAX( numColumns - 1, 0 ) );
    int i = 0;
    QHeader *header = itemsPreview->header();
    for ( QListBoxItem *item = colPreview->firstItem(); item; item = item->next() ) {
	Column *col = findColumn( item );
	if ( !col )
	    continue;
	if ( i >= itemsPreview->columns() )
	    itemsPreview->addColumn( col->text );
	header->setLabel( i, col->pixmap, col->text );
	header->setResizeEnabled( col->resizable, i );
	header->setClickEnabled( col->clickable, i );
	++i;
    }
    while ( itemsPreview->columns() > i )
	itemsPreview->removeColumn( i );

    itemColumn->setValue( QMIN( numColumns - 1, itemColumn->value() ) );
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:22,代码来源:listvieweditorimpl.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QMIN函数代码示例发布时间:2022-05-30
下一篇:
C++ QLocale函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap