Coder Social home page Coder Social logo

kdab / kdreports Goto Github PK

View Code? Open in Web Editor NEW
127.0 54.0 42.0 6.17 MB

Qt library for generating printable and exportable reports from code and from XML descriptions.

Home Page: https://www.kdab.com/kd-reports/

License: Other

CMake 17.65% Python 6.63% Makefile 0.04% C++ 74.67% QMake 0.45% C 0.47% Batchfile 0.06% Ruby 0.02%
kdab reports qt

kdreports's Introduction

Introduction

KD Reports is a Qt tool that lets you easily create printable reports by providing all of the necessary features for a variety of applications. Reports can be created programmatically, using an easy to use C++ API, or they can be data-driven, creating reports from XML or SQL data sources complete with watermarks, headers and footers. Reports can be previewed manually, sent directly to a printer, or saved as PDF files.

Additionally, using KDAB's KD Chart package together with KD Reports allows reports to be garnished with the myriad of chart types supported by KD Chart.

KD Reports targets C++ programmers who use Qt in their applications.

For more information, see https://www.kdab.com/development-resources/qt-tools/kd-reports

Try KD Reports in your web browser! visit https://demos.kdab.com/wasm/kdreports

Using KD Reports

KD Reports requires Qt 5.9.0 or newer, and a compiler with C++11 support. Qt6 support is added starting with KD Reports version 2.0, and requires a compiler with C++17 support.

See INSTALL.txt for installation instructions using CMake.

Learn more at our:

The starting point for using KD Reports is the KDReports::Report class.

Contact

Stay up-to-date with KDAB product announcements:

Get Involved

KDAB will happily accept external contributions.

Please submit your contributions or issue reports from our GitHub space at https://github.com/KDAB/KDReports.

License

The KD Reports Software is © 2007 Klarälvdalens Datakonsult AB (KDAB), and is available under the terms of the MIT license.

Contact KDAB at [email protected] for any licensing queries.

About KDAB

KD Reports is supported and maintained by Klarälvdalens Datakonsult AB (KDAB).

The KDAB Group is the global No.1 software consultancy for Qt, C++ and OpenGL applications across desktop, embedded and mobile platforms.

The KDAB Group provides consulting and mentoring for developing Qt applications from scratch and in porting from all popular and legacy frameworks to Qt. We continue to help develop parts of Qt and are one of the major contributors to the Qt Project. We can give advanced or standard trainings anywhere around the globe on Qt as well as C++, OpenGL, 3D and more.

Please visit https://www.kdab.com to meet the people who write code like this.

KD REPORTS and the KD REPORTS logo are registered trademarks of Klaralvdalens Datakonsult AB in the European Union, the United States, and/or other countries. Other product and company names and logos may be trademarks or registered trademarks of their respective companies.

kdreports's People

Contributors

albert-astals-cid-kdab avatar correa avatar dantti avatar dfaure-kdab avatar er-vin avatar frankosterfeld avatar kpales avatar krf avatar montel avatar pasnox avatar pre-commit-ci[bot] avatar renatofilho avatar sengels avatar winterz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kdreports's Issues

Add barcode support

Using the same mechanism as KDChart It should be possible to add barcode support using KDE Framework's Prison library.

Would such patches be acceptable?

qmake produce error

qmake produce error (both on linux and win):
Cannot find file: /myprojects/KDReports-kdreports-1.7.1/include/include.pro

-> In kdreports.pro, line 2, there is the word "include" appearing in SUBDIRS.
Removing it make qmake works.

KDReports::Frame need setMargin functions

QTextFrameFormat class support setMargin functions; Top, Bottom, Right, Left or entire margins.

I implemented new functions to Frame class,

    KDReports::Frame& setTopMargin( qreal topMargin );

    KDReports::Frame& setBottomMargin( qreal bottomMargin );

    KDReports::Frame& setLeftMargin( qreal leftMargin );

    KDReports::Frame& setRightMargin( qreal rightMargin );


    qreal topMargin() const;
    qreal bottomMargin() const;
    qreal leftMargin() const;
    qreal rightMargin() const;

now we can place to element to anywhere at the page.

image

qt5 pics.qrc compilation issue

#myproject/CMakeLists.txt
...
add_subdirectory(KDReports)
...
target_link_libraries(${PROJECT_NAME} kdreports)
Scanning dependencies of target kdreports
make[2]: *** No rule to make target 'third_party/KDReports/src/qrc_pics.cpp', needed by 'third_party/KDReports/src/CMakeFiles/kdreports.dir/qrc_pics.cpp.o'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:2455: third_party/KDReports/src/CMakeFiles/kdreports.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
14:59:08: The process "/usr/bin/cmake" exited with code 2.
Error while building/deploying project myproject (kit: Desktop)
When executing step "CMake Build"

Building master d8cbadf under up-to-date archlinux

$ qmake --version
QMake version 3.1
Using Qt version 5.12.3 in /usr/lib
$ cmake --version
cmake version 3.14.3

can save to TIFF ?

Now, only save report to PDF. But PDF is easy to modify , image format seems is better.

KDReport 2.2.1 and Qt 6.7.0

Hi,
until installing Qt's 6.7.0, I was able to print and preview any report. Now the program hangs in exporttoFile or creationg a preview with the report as a parameter

Dietmar

specifing report header for first page, an empty space (equals to header) appears on all pages of report

I found a bug on KD Report (may be a miss use of API), and I want to report it, or at least some one help me fixed it .

The issue is when you specify report header only for first page, an empty space
(equals to header) appears on all pages of report.

attaching you an image that specify problem much clearly.
note: i have header on first page only, and footer on last page only

KD reports 1.4
Qt 5.3.0 mingw32
win7 x64
kdreport

Qt deprecation warnings

Hi,

I use your library in my project and since Qt 5.15 I start getting deprecation warnings. Do you have plans to start preparations for future release Qt 6?

Library doesn't build with Qt 5.7

Maybe I'm missing something, but I'm trying to build KDReports (together with our project), against Qt 5.7 and this fails (on Kubuntu 16.04).

Qt 5.7 mandates C++11, but g++.pri adds -ansi. These are not compatible C++ flags, and so the compilation fails once it enters the Qt headers.

I don't see a non-intrusive way to fix this on my side.

watermark image

am I right, the watermark image is a little bit blurred out?
Is there a chance to have the original picture as watermark. I have to print a diploma and so the "background" image should be as sharp as possible.

Thanks

Build/install kdreports like a Qt module

Nicolas: "We may want to simplify [the installation/deployment] a bit, and create a sort of Qt module, with make install putting everything in the Qt directory."

How to set a fixed width for a table?

I want to divide the width of the page into three parts and put an element in each one.
I decided to use TableElement but I could not figure out how to have a fixed width.
could you please point me the right direction to set a fixed width in a table or use another element to solve my problem?
thanks in advance.

PreviewWidget rendering ugly(blurry) on Windows 11 and Qt 6.7 - fix included

First of all, thank you very much for this easy to use library - it really saved my day!
I am using a PreviewDialog in my Qt6 app to display the rendered report. I found that on my Windows 11 laptop (1920x1080 resolution, 125% scaling) the rendered content looked really blurry:
preview_bad_laptop

After some research I figured that the used QImage and QPixmap do not automatically take the device scaling into account. I modified void KDReports::PreviewWidgetPrivate::paintItem(QListWidgetItem *item, int index) const and QPixmap KDReports::PreviewWidgetPrivate::paintPreview(int index) const to fix the rendering and now it looks like this:
preview_final_really_good

I tested the modification solely on Windows 11, both on the laptop screen and an external 4K screen with positive outcome.

I haven't found any info here on how to contribute to this project therefore I am just posting here the modified two functions in the hope you will integrate them in the future - the modifications aren't worth any contribution agreement:

void KDReports::PreviewWidgetPrivate::paintItem(QListWidgetItem *item, int index) const
{
    // qDebug() << "paintItem" << index;

    // Use a QImage so that the raster paint engine is used.
    // Gives a 7.7 times speedup (!) compared to X11.
    const qreal dpr = q->devicePixelRatioF();
    QImage img(PreviewSize*dpr, PreviewSize*dpr, QImage::Format_ARGB32_Premultiplied);
    img.setDevicePixelRatio(dpr);
    const QSizeF paperSize = m_report->paperSize();
    const qreal paperWidth = paperSize.width() * dpr;
    const qreal paperHeight = paperSize.height() * dpr;
    const qreal longestSide = qMax(paperWidth, paperHeight);
    const qreal width = img.width() * paperWidth / longestSide;
    const qreal height = img.height() * paperHeight / longestSide;
    // img.fill( QColor( Qt::white ).rgb() );
    img.fill(Qt::transparent);
    QPainter painter(&img);
    painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform, true);
    painter.translate((img.width() - width) / 2, (img.height() - height) / 2);
    painter.fillRect(QRectF(0, 0, width/dpr, height/dpr), QBrush(Qt::white));
    painter.scale(img.width() / longestSide, img.height() / longestSide);
    m_report->paintPage(index, painter);
    painter.setPen(QPen(1));
    painter.drawRect(QRectF(0, 0, paperWidth, paperHeight));

    item->setIcon(QIcon(QPixmap::fromImage(img)));
}

QPixmap KDReports::PreviewWidgetPrivate::paintPreview(int index) const
{
    const QSizeF paperSize = m_report->paperSize();
    const int width = qCeil(paperSize.width() * m_zoomFactor);
    const int height = qCeil(paperSize.height() * m_zoomFactor);
    const qreal dpr = q->devicePixelRatioF();

    QPixmap pixmap(width*dpr, height*dpr);
    pixmap.setDevicePixelRatio(dpr);
    pixmap.fill(Qt::transparent);
    // qDebug() << width << "," << height;

    // qDebug() << "paintPreview " << index;

    QPainter painter(&pixmap);
    painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform, true);
    
    painter.fillRect(QRectF(0, 0, width, height), QBrush(Qt::white));
    painter.scale(m_zoomFactor, m_zoomFactor);
    m_report->paintPage(index, painter);
    painter.setPen(QPen(1));
    painter.drawRect(QRectF(0, 0, paperSize.width(), paperSize.height()));

    return pixmap;
}

Can't install to prefix containing spaces

./autogen.py -prefix "~/opt/kd reports"
-- Using source directory: /home/kfunk/devel/src/kdab/KDReports
-- Using repository information: revision=907e4c7c isTagged=False
-- Auto-generation done.
-- License marked as accepted.
-- Wrote build files to: /home/kfunk/devel/src/kdab/KDReports
-- Now running configure script.

KD Reports v1.7.50 configuration:
  Install Prefix.............: ~/opt/kd reports
    (default: /usr/local/KDAB/KDReports-1.7.50)
  Debug......................: no (default: no)
  Release....................: yes (default: yes)
  Shared build...............: yes (default: yes)
  Compiled-In Unit Tests.....: no (default: no)
  Restricted symbol export
    (shared build only)......: yes (default: yes)

Project MESSAGE: Install prefix is ~/opt/kd
Project MESSAGE: This is KD Reports version 1.7.50
Reading /home/kfunk/devel/src/kdab/KDReports/src/src.pro
Project MESSAGE: WARNING: kdchart not found. Please set KDCHARTDIR either as an environment variable or on the qmake command line if you want kdchart support
Reading /home/kfunk/devel/src/kdab/KDReports/examples/examples.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/tools/tools.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/Letter/Letter.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/HelloWorld/HelloWorld.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/ReferenceReport/ReferenceReport.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/PriceList/PriceList.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/Database/Database.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/HelloWorldXML/HelloWorldXML.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/PriceListXML/PriceListXML.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/DatabaseXML/DatabaseXML.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/LongReport/LongReport.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/LongTextReport/LongTextReport.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/BigImage/BigImage.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/MailMergeXML/MailMergeXML.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/ReportSection/ReportSection.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/examples/Labels/Labels.pro
Reading /home/kfunk/devel/src/kdab/KDReports/include/include.pro
 Reading /home/kfunk/devel/src/kdab/KDReports/include/KDReports/KDReports.pro
Cannot find file: reports.
qmake failed

Same for Windows. Same for all other KDAB products using autogen I presume.

This is a bug in the generated configure.{sh,bat}, using too simplistic command-line arg parsing.

Designer

Any report designer for KDReports??

KD src compile errors in Qt Creator 6

I create a widget project in Qt Creator and added the source code modules to the .pro file. I'm getting 4 errors, all the same issue:
C:\dev\VIDS-6001\Projects\cpp\apps\qKD\build-kdtest-Desktop_Qt_6_2_3_MSVC2019_64bit-Debug\debug\moc_KDReportsReport.cpp:89: error: C2491: 'KDReports::Report::staticMetaObject': definition of dllimport static data member not allowed -
This is the code:
const QMetaObject KDReports::Report::staticMetaObject = { {
QMetaObject::SuperData::linkQObject::staticMetaObject(),
qt_meta_stringdata_KDReports__Report.offsetsAndSize,
qt_meta_data_KDReports__Report,
qt_static_metacall,
nullptr,
qt_incomplete_metaTypeArray<qt_meta_stringdata_KDReports__Report_t
, QtPrivate::TypeAndForceComplete<QString, std::true_type>, QtPrivate::TypeAndForceComplete<Report, std::true_type>

KDReports::PreviewDialog::Result codes are not exposed

Header comment suggests the following to get the result:

/**
     * The Result enum describes result code accessible with QDialog::result()
     */

However for example void KDReports::PreviewDialogPrivate::slotSave() sets the result to KDReports::PreviewDialog::SavedSuccessfully but then calls q->accept() which resets the value to Qt::Accepted. Im am not able without code modification to retrieve the Result value.

Is there another way to get the information for the dialog´s result?

clickable text

whether kdreport can take action to click on a particular section of text, so that we could listen on signal handler to trigger another form report view?

thanks

Tablecell border with can not set 1px

before I used to 1.9 version and I can make cell border too close to 1px but now I can't.

1.9.0 with tableElement.setBorder (.25);
image

2.2.0 with tableElement.setBorder (.25);
image

2.2.0 with tableElement.setBorder (1);
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.