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

Author Topic: QTreeWidget and SpinBox  (Read 323 times)

JAVH

  • Newbie
  • *
  • Posts: 10
    • View Profile
QTreeWidget and SpinBox
« on: January 07, 2019, 02:20:52 am »
Hi!!, sorry for this question that is newbie, recently i'm learning this Report generator and is amazing.

I have a QTreeWidget with a QDoubleSpinBox inside



In this topic topic i did learn how to send data from Widget to the report, I can send all, except the last field (SpinBox)

I did try with a casting sending value of SpinBox to a QAbstractItemModel

Code: [Select]
    LimeReport::ReportEngine *Ticket =new LimeReport::ReportEngine(this);
    Ticket->dataManager()->addModel("treeWidget",ui->TrWVenta->model(),false);
    QAbstractItemModel *ModCant;
    ModCant=dynamic_cast<QAbstractItemModel*>(ui->TrWVenta->itemWidget(Item,3));
    Ticket->dataManager()->addModel("Cantidad",ModCant,true);
    Ticket->designReport();

But in data manager I get only this (with red circle) and I cannot view any data



How can send data from QDoubleSpinBox to the report??

Thanks and sorry for my bad english!!

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 718
    • View Profile
Re: QTreeWidget and SpinBox
« Reply #1 on: January 07, 2019, 07:09:26 pm »
Hi!
Quote
Thanks and sorry for my bad english!!
I am not native speaker too :) If we can understand each other in my opinion this is enough :)
 
As i can see the field "Candidad" is present in the model that you sent to limereport.
As i guess you don't see the value of this field, isn't it?
I think the problem in your delegate item that represent field value as spinbox in the treewidget.
Possible it does not sending the value to the treewidget model.
 

JAVH

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: QTreeWidget and SpinBox
« Reply #2 on: January 12, 2019, 02:17:13 am »
Thanks, I can't sent value, SpinBox haven't model property and QTreeWidgetItem value (QSpinBox delegate) is in blank, only QSpinBox save the value but cannot send to report.

I did create another QTreeWidget and did copy all values to this, including SpinBox value, and sent this to LimeReport.

If there are a better way to do this I will be grateful.

Best regards.
« Last Edit: January 12, 2019, 02:19:53 am by JAVH »

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 718
    • View Profile
Re: QTreeWidget and SpinBox
« Reply #3 on: January 22, 2019, 12:28:04 am »
Just for example

solomon78

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: QTreeWidget and SpinBox
« Reply #4 on: January 24, 2019, 09:39:30 pm »
@Arin Alex, please is there any way I can run the report direct to PDF without going through the process of adding data band, headers on Lime Report Designer?

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 718
    • View Profile
Re: QTreeWidget and SpinBox
« Reply #5 on: January 24, 2019, 10:20:38 pm »
solomon78
I don't clearly understand what do you mean?
You can create a report pattern in the designer than save it to disk and print it to the pdf file. 

JAVH

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: QTreeWidget and SpinBox
« Reply #6 on: March 30, 2019, 09:18:16 pm »
Just for example

Thanks and sorry for the late answer, in my case I must did to create other QtreeWidget in memory and did copy all values of first QtreeWidget (and passing it the qspin value) and I did send last TreeWidget to LimeReport like in your example. But if there are another way less dirty for send delegate values I will be grateful.

Thanks!!

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 718
    • View Profile
Re: QTreeWidget and SpinBox
« Reply #7 on: March 30, 2019, 10:42:58 pm »
JAVH
Hi.
The spinbox delegate is needed for putting data to the treeview model.
It is the standard qt way for organizing editing data in the treeview.
Why you don't like it?

JAVH

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: QTreeWidget and SpinBox
« Reply #8 on: April 01, 2019, 07:22:55 am »
Hi Alex, I'm entering manually data in this, in this case I'm not using data of a database.

Thanks for the suggestion!!

Best reggards.