Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QT signal/slot interface #21

Closed
newsages opened this issue Mar 25, 2016 · 15 comments
Closed

QT signal/slot interface #21

newsages opened this issue Mar 25, 2016 · 15 comments

Comments

@newsages
Copy link
Contributor

We can make slot interface same like to: ??

void setValue(int &recNo, QString &paramName, QVariant &paramValue, int reportPage)
{

if (paramName == "Name")
{
if (ui->tableWidget->item(recNo,0) == 0) return;
paramValue = ui->tableWidget->item(recNo,0)->text();
}
if (paramName == "Category") {..... blablabla

And connect:
QObject::connect(report, SIGNAL(setValue(int&, QString&, QVariant&, int)), this, SLOT(setValue(int&, QString&, QVariant&, int)));

QObject::connect(report, SIGNAL(setValueImage(int&, QString&, QImage&, int)), this, SLOT(setValueImage(int&, QString&, QImage&, int)));

For simple implementing lib?
Contruct report engi.
Load template.
conect values for template.
exec report embeded or preview or direct print.

Interest?

@fralx
Copy link
Owner

fralx commented Mar 25, 2016

Do you mean something like QtRpt's method data delivery ?

@newsages
Copy link
Contributor Author

Yes. For simple interface on embedded

@fralx
Copy link
Owner

fralx commented Mar 25, 2016

Do you know about limereport`s callback datasource ? In my opinion is rather close to this, isn't it ?

@newsages
Copy link
Contributor Author

Yes i know and it better and have more features . But callback not its qt philosophy. For widget and for qml better work w signal/slots and qproperties. We can try to make qml demo a test if can use callback fine., for example making report template, qml properties and parse to liblimereport

@fralx
Copy link
Owner

fralx commented Mar 26, 2016

Callback it's only name as a matter of fact this method uses signal and slot mechanism :). I can simplify this interface to example in data delivery method i would request row count and wouldn't call second slot method that move datasource position.

@newsages
Copy link
Contributor Author

itś right, w this .

@fralx
Copy link
Owner

fralx commented Mar 27, 2016

Callback interface has been simplified
From now on if slot getCallbackData(const LimeReport::CallbackInfo& info, QVariant& data) returns row count then there is no more need to implement second slot changePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
example:

callbackDatasource = m_report->dataManager()->createCallbackDatasouce("simple_data");
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
            this, SLOT(slotSimpleCallbackGetData(LimeReport::CallbackInfo,QVariant&)));

void MainWindow::slotSimpleCallbackGetData(LimeReport::CallbackInfo info, QVariant &data)
{
    switch (info.dataType) {
    case LimeReport::CallbackInfo::ColumnCount:
        data = 1;
        break;
    case LimeReport::CallbackInfo::RowCount:
        data = 3;
        break;
    case LimeReport::CallbackInfo::IsEmpty:
        data = false;
        break;
    case LimeReport::CallbackInfo::ColumnHeaderData:
        if (info.index<1)
            data = QString::number(info.index);
        break;
    case LimeReport::CallbackInfo::ColumnData:
        data =  m_list.at(info.index);
        break;
    }
}

@newsages
Copy link
Contributor Author

Fine. Now im testing , making examples and documenting.

@newsages
Copy link
Contributor Author

and how to paint embedded preview?

@fralx
Copy link
Owner

fralx commented Mar 27, 2016

report->previewReport()

@newsages
Copy link
Contributor Author

but can embeded in ui->widget->layout()->addWidget(report)?
?
i try cast as QWidget, but is QMainWindow (previweReport())

@fralx
Copy link
Owner

fralx commented Mar 28, 2016

Ok, i will make Qwidget preview soon

@fralx
Copy link
Owner

fralx commented Mar 31, 2016

I have added LimeReport::PreviewReportWidget.
report->createPreviewWidget(QWidget *parent = 0) returns it.

@newsages
Copy link
Contributor Author

perfect, im making test app for createPreviewWidget and
Im making now travis-ci .travis.yml integration for this repository.
i push soon .travis.yml and build status on README.

@newsages
Copy link
Contributor Author

ln -s liblimereport.so.1.0.0 liblimereport.so

ln -s liblimereport.so.1.0.0 liblimereport.so.1

ln -s liblimereport.so.1.0.0 liblimereport.so.1.0

rm -f ../build/5.6.0/release/lib/liblimereport.so.1.0.0

mv -f liblimereport.so.1.0.0 ../build/5.6.0/release/lib/

rm -f ../build/5.6.0/release/lib/liblimereport.so

rm -f ../build/5.6.0/release/lib/liblimereport.so.1

rm -f ../build/5.6.0/release/lib/liblimereport.so.1.0

mv -f liblimereport.so ../build/5.6.0/release/lib/

mv -f liblimereport.so.1 ../build/5.6.0/release/lib/

mv -f liblimereport.so.1.0 ../build/5.6.0/release/lib/

cp -f /home/travis/build/newsages/LimeReport/limereport/lrglobal.cpp /home/travis/build/newsages/LimeReport/include/

cp -f /home/travis/build/newsages/LimeReport/limereport/lrglobal.h /home/travis/build/newsages/LimeReport/include/

cp -f /home/travis/build/newsages/LimeReport/limereport/lrdatasourcemanagerintf.h /home/travis/build/newsages/LimeReport/include/

cp -f /home/travis/build/newsages/LimeReport/limereport/lrreportengine.h /home/travis/build/newsages/LimeReport/include/

cp -f /home/travis/build/newsages/LimeReport/limereport/lrscriptenginemanagerintf.h /home/travis/build/newsages/LimeReport/include/

cp -f /home/travis/build/newsages/LimeReport/limereport/lrcallbackdatasourceintf.h /home/travis/build/newsages/LimeReport/include/

cp -f /home/travis/build/newsages/LimeReport/limereport/lrpreviewreportwidget.h /home/travis/build/newsages/LimeReport/include/

cp -f -R /home/travis/build/newsages/LimeReport/include/* /home/travis/build/newsages/LimeReport/build/5.6.0/release/lib/include/

cp: target ‘/home/travis/build/newsages/LimeReport/build/5.6.0/release/lib/include/’ is not a directory

make[1]: *** [../build/5.6.0/release/lib/liblimereport.so.1.0.0] Error 1

make[1]: Leaving directory `/home/travis/build/newsages/LimeReport/limereport'

make: *** [sub-limereport-check_ordered] Error 2

now i push :
unix {
DESTDIR = $${BUILD_DIR}/$${BUILD_TYPE}/lib
linux{
for(FILE,EXTRA_FILES){
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DESTDIR}/include) $$escape_expand(\n\t) # inside of libs make /include/files
}
QMAKE_POST_LINK += mkdir -p $$quote($${DESTDIR}/include) $$escape_expand(\n\t) # qmake need make mkdir -p on subdirs more than root/
}
macx{
for(FILE,EXTRA_FILES){
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\n\t)
}
QMAKE_POST_LINK += mkdir -p $$quote($${DESTDIR}/include) $$escape_expand(\n\t)
}
QMAKE_POST_LINK += $(COPY_DIR) $$quote($${DEST_INCLUDE_DIR}*) $$quote($${DESTDIR}/include)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants