Welcome, Guest. Please login or register.
Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - svvord

Pages: [1]
1
Discussion | Обсуждение / Вопросы по 1.3.9
« on: February 29, 2016, 09:07:21 AM »
Полагаю пора создать такую ветку и перенести обсуждение проблем сюда.

На данный момент у меня есть проблема, о которой я уже упоминал. При вызове printToPDF из кода, предварительно подгрузив шаблон и установив нужные переменные:
Code: [Select]
report->loadFromFile(QDir::toNativeSeparators(Core::profile->path() + QString("/reps/itog-f3.lrxml")));
report->dataManager()->setReportVariable("GRPID", monitor->item(monitor->selectedItems()[i]->row(), 0)->text());
report->printToPDF("~/test.pdf");

Сохранения в файл PDF не происходит. При этом в консоль валятся такие вот ошибки:

Code: [Select]
QPainter::begin(): Returned false
QPainter::save: Painter not active
QPainter::setClipRect: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::setBrushOrigin: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::opacity: Painter not active
QPainter::worldTransform: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::setOpacity: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::setOpacity: Painter not active
QPainter::setFont: Painter not active
QPainter::setPen: Painter not active
QPainter::save: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::restore: Unbalanced save/restore
QPainter::save: Painter not active
QPainter::setClipRect: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::setOpacity: Painter not active
QPainter::save: Painter not active
QPainter::setFont: Painter not active
QPainter::setPen: Painter not active
QPainter::save: Painter not active
QPainter::setOpacity: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::clipRegion: Painter not active
QPainter::setClipRect: Painter not active

И таковых более 5000.

Если вместо printToPDF вызвать:

Code: [Select]
report->previewReport();, то всё нормально рендерится и уже из диалогового окна можно без проблем сохранить в PFD файл. Но мне надо таким образом несколько десятков файлов сохранять, что меня лично напрягает =)

Я пробежался дебагером от вызова printToPDF и дошёл до вызова
Code: [Select]
renderPage.render(painter) в методе void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, const PrintRange& printRange).

Т.к. renderPage является объектом наследуемым от QGraphicsScene, то дальше рыть смыла в общем-то не было. Очевидно что имеется какая-то проблема и инициализацией объекта printer, передаваемого параметром в указанный метод. Но что именно не так с его инициализацией до меня так и не дошло =(

Вся эта вакханалия, напомню, происходит под FreeBSD. При этом мне долго не удавалось при отладке попасть в функцию printToPDF, не смотря на то, что я собирал библиотеку в debug режиме. Оказалось что сборка происходит без отладочной инфы (не смотря на указание в pro файле на сборку с отладкой). Тогда я решил попробовать собрать её с помошью cmake и мне удалось собрать её как надо.

Пользователям Linux и BSD систем может пригодиться CMakeLists.txt файл для сборки limereport 1.3.9 с помощью cmake. Пользователям windows он может оказаться бесполезным. Но его можно довести до ума =) Предполагается что zint в системе уже установлена. Файл CMakeLists.txt нужно положить в директорию limereport, туда же, где лежит limereport.pro.


[вложение удалено администратором]

Pages: [1]