本文整理汇总了C++中Test::Number方法的典型用法代码示例。如果您正苦于以下问题:C++ Test::Number方法的具体用法?C++ Test::Number怎么用?C++ Test::Number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test
的用法示例。
在下文中一共展示了Test::Number方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawResults
//.........这里部分代码省略.........
auto DrawRowLeft = [ &painter, &free_rect ]( QFont font, QColor color1, QString label, double spase = 1 )
{
painter.save();
QFontMetrics metrix( font );
QRect place;
AllocatePlace( place, metrix.height()*spase, free_rect );
QPoint start_point( place.left() , place.center().y()+metrix.height()/2 );
painter.setFont( font );
painter.setPen( color1 );
painter.drawText( start_point, label );
painter.restore();
};
auto DrawRowLeft3 = [ &painter, &free_rect ]( QFont const& font,
QColor const& color1,
QString const& label,
QColor const& color2 = Qt::black,
QString const& value = "",
QColor const& color3 = Qt::black,
QString const& value2 = "",
double spase = 1)
{
painter.save();
QFontMetrics metrix( font );
QRect place;
AllocatePlace( place, metrix.height()*spase, free_rect );
QPoint start_point( place.left() , place.center().y()+metrix.height()/2 );
QPoint start_point2( start_point.x() + metrix.width(label), place.center().y() +metrix.height()/2);
QPoint start_point3( start_point2.x() + metrix.width(value), place.center().y() +metrix.height()/2);
painter.setFont( font );
painter.setPen( color1 );
painter.drawText( start_point, label );
painter.setPen( color2 );
painter.drawText( start_point2, value );
painter.setPen( color3 );
painter.drawText( start_point3, value2 );
painter.restore();
};
DrawRowCenter( title_font, Qt::black, "", 7 );
DrawRowCenter( title_font, Qt::black, "Результаты испытаний", 1 );
DrawRowCenter2( title_font, Qt::black, "дискретного аппарата ", Qt::red, mGsType, 2 );
QString header = "<html>"
"<head>"
"<meta charset='utf-8'>"
"<style type='text/css'>"
"td { text-align: center;}"
"th { font-weight: normal; padding: 2px;}"
"table {border-collapse: collapse; border-style: solid; vertical-align:middle;}"
"</style>"
"</head>"
"<body>"
"<table width='100%' border='1.5' cellspacing='-0.5' cellpadding='-0.5'>"
"<tr>"
"<th> Номер </th>"
"<th></th>"
"<th> Работоспособность </th>"
"</tr>";
QString footer = "</table>"
"</body>"
"</html>";
bool sucsess = true;
QString row;
for ( auto it = mTestCase.begin(), end = mTestCase.end(); it != end; ++it )
{
Test* ptr = *it;
row += "<tr>"
"<td>"+test::ToString( ptr->Number() )+"</td>"
"<td>"+ QString(ptr->Name()).replace("\n","<br>") +"</td>"
"<td style='font-size:28pt; color: \"red\"; font-weight:bold;'>"+ (ptr->Success() ? QString("+"):QString("-")) +"</td>"
"</tr>";
sucsess &= ptr->Success();
}
QTextDocument doc;
doc.setUndoRedoEnabled( false );
doc.setTextWidth( free_rect.width() );
doc.setUseDesignMetrics( true );
doc.setDefaultTextOption ( QTextOption (Qt::AlignHCenter ) );
doc.setHtml( header + row + footer );
auto h = doc.documentLayout()->documentSize().height();
QRect place;
AllocatePlace( place, h ,free_rect );
QRectF r( 0, 0, place.width(), place.height() );
painter.save();
painter.translate( place.topLeft() );
doc.drawContents( &painter, r);
painter.restore();
DrawRowLeft( text_font, Qt::black, "ИТОГ:", 3 );
DrawRowLeft3( text_font, Qt::black, "Гидроаппарат ",
Qt::red, mGsType + (sucsess? " годен": " не годен"),
Qt::black, " к эксплуатации", 1 );
return true;
}