Esempio n. 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;
}
Esempio n. 2
0
int ReportItemDetail::rowCount()
{
	int ret = 0;
	ReportItemBand *band = parentBand();
	if(band && band->isModelLoaded()) {
		BandDataModel *m = band->model();
		if(m) {
			ret = m->rowCount();
		}
	}
	return ret;
}
Esempio n. 3
0
//===================================================================
//                           ReportItemDetail
//===================================================================
ReportItem::PrintResult ReportItemDetail::printHtml(HTMLElement & out)
{
	qfLogFuncFrame();
	ReportItemBand *band = qobject_cast<ReportItemBand*>(parent());
	BandDataModel *model = nullptr;
	if(band) {
		model = band->model();
		if(model) {
			if(currentIndex() < 0) {
				/// kdyz neni f_dataRow, vezmi prvni radek dat
				setCurrentIndex(0);
			}
		}
	}
	PrintResult res;
	/*--
	bool design_mode = processor->isDesignMode();
	if(!design_mode && (data_table.isNull() || dataRow().isNull())) {
		/// prazdnej detail vubec netiskni
		res.value = PrintOk;
		return res;
	}
	--*/
	res = Super::printHtml(out);
	if(res.value == PrintOk) {
		if(model) {
			/// take next data row
			setCurrentIndex(currentIndex() + 1);
			if(currentIndex() < model->rowCount()) {
				resetIndexToPrintRecursively(ReportItem::IncludingParaTexts);
				res.flags |= FlagPrintAgain;
			}
		}
	}
	return res;
}