示例#1
0
ReportItem::PrintResult ReportItemDetail::printMetaPaint(ReportItemMetaPaint *out, const ReportItem::Rect &bounding_rect)
{
	qfLogFuncFrame();
	QF_TIME_SCOPE("ReportItemDetail::printMetaPaint");
	ReportItemBand *band = qobject_cast<ReportItemBand*>(parent());
	BandDataModel *model = nullptr;
	if(band) {
		model = band->model();
		if(model) {
			if(currentIndex() < 0) {
				//qfWarning() << "emit rowCountChanged()";
				//emit rowCountChanged();
				setCurrentIndex(0);
			}
		}
	}
	/*--
	PrintResult res;
	bool design_mode = processor()->isDesignMode(); /// true znamena, zobraz prvni radek, i kdyz tam nejsou data.
	//qfInfo() << "design mode:" << design_mode;
	if(!design_mode && (data_table.isNull() || dataRow().isNull())) {
		/// prazdnej detail vubec netiskni
		res.value = PrintOk;
		return res;
	}
	--*/
	PrintResult res = Super::printMetaPaint(out, bounding_rect);
	if(res.isPrintFinished()) {
		if(model) {
			/// take next data row
			int ix = currentIndex() + 1;
			qfDebug() << currentIndex() << "/" << model->rowCount();
			//qfDebug() << model->dump();
			if(ix < model->rowCount()) {
				QF_TIME_SCOPE("ReportItemDetail::printMetaPaint 3");
				setCurrentIndex(ix);
				resetIndexToPrintRecursively(ReportItem::IncludingParaTexts);
				res.setNextDetailRowExists(true);
			}
			else {
				resetCurrentIndex();
			}
		}
	}
	return res;
}