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

C++ QMIN函数代码示例

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

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



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

示例1: QSize

void QPEApplication::showWidget( QWidget* wg, bool nomax ) {
    if ( wg->isVisible() ) {
        wg->show();
        return;
    }

    if ( !isSaveWindowsPos() || (!nomax
         && ( qApp->desktop()->width() <= 320 )) ){
        wg->showMaximized();
    } else {
#ifdef Q_WS_QWS
        QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() );
#else
        QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() );
#endif

        QSize sh = wg->sizeHint();
        int w = QMAX( sh.width(), wg->width() );
        int h = QMAX( sh.height(), wg->height() );
//              desktop                              widget-frame                      taskbar
        w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) );
        h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) );
        wg->resize( w, h );
        wg->show();
    }
}
开发者ID:opieproject,项目名称:opie,代码行数:26,代码来源:widget_showing.cpp


示例2: set

static QDateTime set(QDateTime dt, PeriodType::Base b, const Duration &dur = Duration())
{
	switch(b)
	{
	case PeriodType::Min:
		dt.setTime(QTime(dt.time().hour(), dt.time().minute(), dur.time.second()));
		break;
	case PeriodType::Hour:
		if(dt.time().minute() || dt.time().second())
			dt.setTime(QTime(dt.time().hour(), dur.time.minute(), dur.time.second()));
		break;
	case PeriodType::Day:
		dt.setTime(dur.time);
		break;
	case PeriodType::Month:
		dt.setDate(QDate(dt.date().year(), dt.date().month(),
			QMIN(QDate(dt.date().year(), dt.date().month(), 1).daysInMonth(), dur.days)));
		dt.setTime(dur.time);
		break;
	case PeriodType::Year:
		dt.setDate(QDate(dt.date().year(), dur.months,
			QMIN(QDate(dt.date().year(), dur.months, 1).daysInMonth(), dur.days)));
		dt.setTime(dur.time);
		break;
	default:;
	}
	return dt;
}
开发者ID:obrpasha,项目名称:votlis_krizh_gaz_nas,代码行数:28,代码来源:period.cpp


示例3: dock_extent

static int dock_extent( QDockWindow *w, Qt::Orientation o, int maxsize )
{
    if ( o == Qt::Horizontal )
	return QMIN( maxsize, QMAX( w->sizeHint().width(), w->fixedExtent().width() ) );
    else
	return QMIN( maxsize, QMAX( w->sizeHint().height(), w->fixedExtent().height() ) );
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:7,代码来源:qdockarea.cpp


示例4: p

void Spacer::paintEvent( QPaintEvent * )
{
    QPainter p( this );
    p.setPen( Qt::blue );

    if ( orient == Horizontal ) {
	const int dist = 3;
	const int amplitude = QMIN( 3, height() / 3 );
	const int base = height() / 2;
	int i = 0;
	p.setPen( white );
	for ( i = 0; i < width() / 3 +2; ++i )
	    p.drawLine( i * dist, base - amplitude, i * dist + dist / 2, base + amplitude );
	p.setPen( blue );
	for ( i = 0; i < width() / 3 +2; ++i )
	    p.drawLine( i * dist + dist / 2, base + amplitude, i * dist + dist, base - amplitude );
	p.drawLine( 0, 0, 0, height() );
	p.drawLine( width() - 1, 0, width() - 1, height());
    } else {
	const int dist = 3;
	const int amplitude = QMIN( 3, width() / 3 );
	const int base = width() / 2;
	int i = 0;
	p.setPen( white );
	for ( i = 0; i < height() / 3 +2; ++i )
	    p.drawLine( base - amplitude, i * dist, base + amplitude,i * dist + dist / 2 );
	p.setPen( blue );
	for ( i = 0; i < height() / 3 +2; ++i )
	    p.drawLine( base + amplitude, i * dist + dist / 2, base - amplitude, i * dist + dist );
	p.drawLine( 0, 0, width(), 0 );
	p.drawLine( 0, height() - 1, width(), height() - 1 );
    }
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:33,代码来源:layout.cpp


示例5: portable_fseek

void Store::dumpBlock(portable_off_t s,portable_off_t e)
{
  portable_fseek(m_file,s,SEEK_SET);
  int size = (int)(e-s);
  uchar *buf = new uchar[size];
  if (fread(buf,size,1,m_file)==(size_t)size)
  {
    int i,j;
    for (i=0;i<size;i+=16)
    {
      printf("%08x: ",(int)s+i);
      for (j=i;j<QMIN(size,i+16);j++)
      {
        printf("%02x ",buf[i+j]);
      }
      printf("  ");
      for (j=i;j<QMIN(size,i+16);j++)
      {
        printf("%c",(buf[i+j]>=32 && buf[i+j]<128)?buf[i+j]:'.');
      }
      printf("\n");
    }
  }
  delete[] buf;
  portable_fseek(m_file,m_cur,SEEK_SET);
}
开发者ID:Acidburn0zzz,项目名称:doxygen,代码行数:26,代码来源:store.cpp


示例6: smartMaxSize

/*!
  Sets the geometry of this item's widget to be contained within \a r,
  taking alignment and maximum size into account.
*/
void QWidgetItem::setGeometry( const QRect &r )
{
    QSize s = r.size().boundedTo( smartMaxSize( wid ) );
    int x = r.x();
    int y = r.y();
    if ( align & (HorAlign|VerAlign) ) {
	QSize pref = wid->sizeHint().expandedTo( wid->minimumSize() ); //###
	if ( align & HorAlign )
	    s.setWidth( QMIN( s.width(), pref.width() ) );
	if ( align & VerAlign ) {
	    if ( hasHeightForWidth() )
		s.setHeight( QMIN( s.height(), heightForWidth(s.width()) ) );
	    else
		s.setHeight( QMIN( s.height(), pref.height() ) );
	}
    }
    if ( align & Qt::AlignRight )
	x = x + ( r.width() - s.width() );
    else if ( !(align & Qt::AlignLeft) )
	x = x + ( r.width() - s.width() ) / 2;

    if ( align & Qt::AlignBottom )
	y = y + ( r.height() - s.height() );
    else if ( !(align & Qt::AlignTop) )
	y = y + ( r.height() - s.height() ) / 2;

    if ( !wid->isHidden() && !wid->isTopLevel() )
	wid->setGeometry( x, y, s.width(), s.height() );
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:33,代码来源:qabstractlayout.cpp


示例7: QMIN

double LineMarker::dist(int x, int y)
{
const QwtScaleMap &xMap = d_plot->canvasMap(xAxis());
const QwtScaleMap &yMap = d_plot->canvasMap(yAxis());

const int x0 = xMap.transform(d_rect.left());
const int y0 = yMap.transform(d_rect.top());
const int x1 = xMap.transform(d_rect.right());
const int y1 = yMap.transform(d_rect.bottom());

int xmin=QMIN(x0,x1);
int xmax=QMAX(x0,x1);
int ymin=QMIN(y0,y1);
int ymax=QMAX(y0,y1);
	
if ( (x>xmax || x<xmin || xmin==xmax) && (ymax<y || ymin>y || ymin==ymax))
	//return the shortest distance to one of the ends
	return QMIN(sqrt(double((x-x0)*(x-x0)+(y-y0)*(y-y0))),
				sqrt(double((x-x1)*(x-x1)+(y-y1)*(y-y1))));
	
double d;
if (x0==x1)
	d=abs(x-x0);
else
	{
	double a=(double)(y1-y0)/(double)(x1-x0);
	double b=y0-a*x0;
	d=(a*x-y+b)/sqrt(a*a+1);
	}	
return fabs(d);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:31,代码来源:LineMarker.cpp


示例8: defined

void QWidget::setMaximumSize( int maxw, int maxh )
{
#if defined(QT_CHECK_RANGE)
    if ( maxw > QWIDGETSIZE_MAX || maxh > QWIDGETSIZE_MAX ) {
	qWarning("QWidget::setMaximumSize: (%s/%s) "
		"The largest allowed size is (%d,%d)",
		 name( "unnamed" ), className(), QWIDGETSIZE_MAX,
		QWIDGETSIZE_MAX );
	maxw = QMIN( maxw, QWIDGETSIZE_MAX );
	maxh = QMIN( maxh, QWIDGETSIZE_MAX );
    }
    if ( maxw < 0 || maxh < 0 ) {
	qWarning("QWidget::setMaximumSize: (%s/%s) Negative sizes (%d,%d) "
		"are not possible",
		name( "unnamed" ), className(), maxw, maxh );
	maxw = QMAX( maxw, 0 );
	maxh = QMAX( maxh, 0 );
    }
#endif
    createExtra();
    if ( extra->maxw == maxw && extra->maxh == maxh )
	return;
    extra->maxw = maxw;
    extra->maxh = maxh;
    if ( maxw < width() || maxh < height() )
	resize( QMIN(maxw,width()), QMIN(maxh,height()) );
    if ( testWFlags(WType_TopLevel) ) {
	// XXX
    }
    updateGeometry();
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:31,代码来源:qwidget_qws.cpp


示例9: strlen

void QLineEdit::end( bool mark )
{
    int tlen = strlen( tbuf );
    if ( cursorPos != tlen || (!mark && hasMarkedText()) ) {
	int mo = showLastPartOffset( &tbuf[offset], fontMetrics(),
				     width() - (frame() ? 8 : 4) );
	int markStart = cursorPos;
	cursorPos = tlen;
	cursorOn = FALSE;
	blinkSlot();
	if ( mark ) {
	    markStart = QMIN( markStart, markDrag );
	    newMark( cursorPos );
	} else {
	    markStart = QMIN( markStart, minMark() );
	    markAnchor = markDrag = cursorPos;
	}
	d->pmDirty = TRUE;
	if ( mo > 0 ) {
	    offset += mo;
	    repaint( FALSE );
	} else {
	    repaintArea( markStart, tlen );
	}
    }
}
开发者ID:kthxbyte,项目名称:Qt1.45-Linaro,代码行数:26,代码来源:qlineedit.cpp


示例10: QMIN

void MineField::setCellSize( int cellsize )
{
    int b = 2;

    int w2 = cellsize*numCols;
    int h2 = cellsize*numRows;

    int w = QMIN( availableRect.width(), w2+b );
    int h = QMIN( availableRect.height(), h2+b );

    //
    // Don't rely on the change in cellsize to force a resize,
    // as it's possible to have the same size cells when going
    // from a large play area to a small one.
    //
    resizeContents(w2, h2);

    if ( availableRect.height() < h2 &&
	 availableRect.width() - w > style().scrollBarExtent().width() ) {
	w += style().scrollBarExtent().width();
    }

    setGeometry( availableRect.x() + (availableRect.width()-w)/2,
	    availableRect.y() + (availableRect.height()-h)/2, w, h );
    cellSize = cellsize;
}
开发者ID:opieproject,项目名称:opie,代码行数:26,代码来源:minefield.cpp


示例11: place_line

static void place_line( QValueList<DockData> &lastLine, Qt::Orientation o, int linestrut, int fullextent, int tbstrut, int maxsize, QDockAreaLayout * )
{
    QDockWindow *last = 0;
    QRect lastRect;
    for ( QValueList<DockData>::Iterator it = lastLine.begin(); it != lastLine.end(); ++it ) {
	if ( tbstrut != -1 && ::qt_cast<QToolBar*>((*it).w) )
	    (*it).rect.setHeight( tbstrut );
	if ( !last ) {
	    last = (*it).w;
	    lastRect = (*it).rect;
	    continue;
	}
	if ( !last->isStretchable() ) {
	    int w = QMIN( lastRect.width(), maxsize );
	    set_geometry( last, lastRect.x(), lastRect.y(), w, lastRect.height(), o );
	} else {
	    int w = QMIN( (*it).rect.x() - lastRect.x(), maxsize );
	    set_geometry( last, lastRect.x(), lastRect.y(), w,
			  last->isResizeEnabled() ? linestrut : lastRect.height(), o );
	}
	last = (*it).w;
	lastRect = (*it).rect;
    }
    if ( !last )
	return;
    if ( !last->isStretchable() ) {
	int w = QMIN( lastRect.width(), maxsize );
	set_geometry( last, lastRect.x(), lastRect.y(), w, lastRect.height(), o );
    } else {
	int w = QMIN( fullextent - lastRect.x() - ( o == Qt::Vertical ? 1 : 0 ), maxsize );
	set_geometry( last, lastRect.x(), lastRect.y(), w,
		      last->isResizeEnabled() ? linestrut : lastRect.height(), o );
    }
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:34,代码来源:qdockarea.cpp


示例12:

void k9MenuEditor::resizeEvent ( QResizeEvent * e ) {
    QWMatrix m;
    double scalex=(e->size().width()-4.0)/720.0;
    double scaley=(e->size().height()-4.0)/576.0;
    m.scale(QMIN(scalex,scaley),QMIN(scalex,scaley));
    this->setWorldMatrix(m);

}
开发者ID:mitch000001,项目名称:k9copy,代码行数:8,代码来源:k9menueditor.cpp


示例13: QMIN

void FillTool::setInterpolatedPixel(int x, int y)
{
    int fillRed = QMIN(QMAX(qRed(m_fillRgb) + qRed(m_image.pixel(x, y)) - qRed(m_oldRgb), 0), 255);
    int fillGreen = QMIN(QMAX(qGreen(m_fillRgb) + qGreen(m_image.pixel(x, y)) - qGreen(m_oldRgb), 0), 255);
    int fillBlue = QMIN(QMAX(qBlue(m_fillRgb) + qBlue(m_image.pixel(x, y)) - qBlue(m_oldRgb), 0), 255);

    m_image.setPixel(x, y, qRgb(fillRed, fillGreen, fillBlue));
}
开发者ID:opieproject,项目名称:opie,代码行数:8,代码来源:filltool.cpp


示例14: QMAX

QRect QRect::operator&( const QRect &r ) const
{
    QRect tmp;
    tmp.x1 = QMAX( x1, r.x1 );
    tmp.x2 = QMIN( x2, r.x2 );
    tmp.y1 = QMAX( y1, r.y1 );
    tmp.y2 = QMIN( y2, r.y2 );
    return tmp;
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:9,代码来源:qrect.cpp


示例15: QMIN

void Interface::DisegnaRect( QPoint topLeft ,  QPoint bottomRight )
{
                 Top_startX = QMIN(topLeft.x(), bottomRight.x());
                 Top_startY = QMIN(topLeft.y(), bottomRight.y()) ;
      
                 int Bot_endX = QMAX(topLeft.x(), bottomRight.x());
                 int Bot_endY = QMAX(topLeft.y(), bottomRight.y());
    
    
      QPoint topLefta( Top_startX , Top_startY );
      QPoint bottomRighta( Bot_endX , Bot_endY );  
      QRect areaplace( topLefta, bottomRighta );
    
      /*
      
      */
    
                TagliaPoi = areaplace;
                
                 /////////////////qDebug() << "####### TagliaPoi.width()  " << TagliaPoi.height(); 
    
                if (areaplace.width() > 9 ) {
                TagliaPoi = areaplace;
                QPen pen;
                pen.setStyle( Qt::SolidLine );
                    
                pen.setWidth( 2 );
                if (ratio > 80 && ratio < 110) {                    
                pen.setWidth( 2 );
                } 
                if (ratio < 81) {
                pen.setWidth( 4 ); 
                }
                if (ratio < 50) {
                pen.setWidth( 6 ); 
                }
                if (ratio > 130) {
                pen.setWidth( 1 ); 
                }
           
                pen.setColor( color1 );
                QPixmap nuovo(original2.width(),original2.height());
                QPainter painter;
                painter.begin(&nuovo); 
                painter.setRenderHint(QPainter::Antialiasing);
                painter.drawPixmap(0,0,original2);
                painter.setPen( pen);    /* penna */
                painter.drawRect(areaplace);  /* disegna */
                painter.end();  
                display = nuovo;
                int newlarge = (original2.width()/cento)*ratio;
                wrapper->paint(QPixmap(display.scaledToWidth(newlarge,Qt::FastTransformation)));
                setCursor(Qt::CrossCursor);
                UpdateNow();
                }
}
开发者ID:martamius,项目名称:mushi,代码行数:56,代码来源:interface.cpp


示例16: numRows

QwtDoubleRect Matrix::boundingRect()
{
    int rows = numRows();
    int cols = numCols();
    double dx = fabs(x_end - x_start)/(double)(cols - 1);
    double dy = fabs(y_end - y_start)/(double)(rows - 1);

    return QwtDoubleRect(QMIN(x_start, x_end) - 0.5*dx, QMIN(y_start, y_end) - 0.5*dy,
						 fabs(x_end - x_start) + dx, fabs(y_end - y_start) + dy).normalized();
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:10,代码来源:Matrix.cpp


示例17: QMIN

void QLineEdit::setSelection( int start, int length )
{
    int b, e;
    b = QMIN( markAnchor, markDrag );
    e = QMAX( markAnchor, markDrag );
    b = QMIN( b, start );
    e = QMAX( e, start + length );
    markAnchor = start;
    markDrag = start + length;
    repaintArea( b, e );
}
开发者ID:kthxbyte,项目名称:Qt1.45-Linaro,代码行数:11,代码来源:qlineedit.cpp


示例18: QMIN

QPoint SubWindow::forceInside( const QRect &enclosure, const QRect &prisoner )
{
    int new_x, new_y;

    new_x = QMIN( enclosure.right(), prisoner.right() ) - prisoner.width() + 1;
    new_x = QMAX( enclosure.left(), new_x );
    new_y = QMIN( enclosure.bottom(), prisoner.bottom() ) - prisoner.height() + 1;
    new_y = QMAX( enclosure.top(), new_y );

    return QPoint( new_x, new_y );
}
开发者ID:DirtYiCE,项目名称:uim,代码行数:11,代码来源:subwindow.cpp


示例19: initGlobals

void Matrix::initTable(int rows, int cols)
{
    initGlobals();
	d_view_type = TableView;

    d_matrix_model = new MatrixModel(rows, cols, this);
    initTableView();

	// resize the table
	setGeometry(50, 50, QMIN(_Matrix_initial_columns_, cols)*d_table_view->horizontalHeader()->sectionSize(0) + 55,
                (QMIN(_Matrix_initial_rows_,rows)+1)*d_table_view->verticalHeader()->sectionSize(0));
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:12,代码来源:Matrix.cpp


示例20: zoomTo

// private slot
void kpMainWindow::slotFitToPage ()
{
    if (!m_scrollView || !m_document)
        return;

    // doc_width * zoom / 100 <= view_width &&
    // doc_height * zoom / 100 <= view_height &&
    // 1 <= zoom <= 3200

    zoomTo (QMIN (3200, QMAX (1, QMIN (m_scrollView->visibleWidth () * 100 / m_document->width (),
                              m_scrollView->visibleHeight () * 100 / m_document->height ()))));
}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:13,代码来源:kpmainwindow_view.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ QM_CHECK函数代码示例发布时间:2022-05-30
下一篇:
C++ QMAX函数代码示例发布时间: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