24 setWindowTitle(tr(
"Report parameters"));
26 QGridLayout*
layout =
new QGridLayout(
this);
28 myList =
new QListWidget(
this);
31 QPushButton* add =
new QPushButton(tr(
"Add"),
this);
33 layout->addWidget(add, 10, 0, 1, 1);
35 QPushButton* del =
new QPushButton(tr(
"Remove"),
this);
37 layout->addWidget(del, 10, 1, 1, 1);
39 layout->addWidget(
new QLabel(tr(
"Name:"),
this), 0, 2, 1, 3);
41 myName =
new QLineEdit(
this);
44 layout->addWidget(
new QLabel(tr(
"Header:"),
this), 2, 2, 1, 3);
48 myHeader->setWhatsThis(tr(
"Text to display at the top of the report."));
50 layout->addWidget(
new QLabel(tr(
"Footer:"),
this), 4, 2, 1, 3);
54 myFooter->setWhatsThis(tr(
"Text to display at the bottom of the report."));
56 layout->addWidget(
new QLabel(tr(
"Item sort:"),
this), 6, 2, 1, 3);
58 mySort =
new QTextEdit(
this);
60 mySort->setWhatsThis(tr(
"Expression used to sort items. The items to be compared are 'left' and 'right', and the expression should be true if left < right, false else."));
62 layout->addWidget(
new QLabel(tr(
"Item display:"),
this), 8, 2, 1, 3);
66 myDisplay->setWhatsThis(tr(
"Expression used to display one item. The current item is 'item', and the expression should be a string value."));
68 QDialogButtonBox* buttons =
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Close | QDialogButtonBox::Help, Qt::Horizontal,
this);
71 connect(buttons, SIGNAL(helpRequested()),
this, SLOT(
onHelp()));
73 layout->addWidget(buttons, 10, 2, 3, 1);
90 if (QMessageBox::question(
this, tr(
"Discard changes?"), tr(
"You are about to discard all changes!\nAre you sure?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
98 QMessageBox::information(
this, tr(
"Report help"), tr(
100 This dialog allows to define a report.<br />
102 A report consists of an optional header, a line for each item of the view optionally sorted, an optional footer.
105 'Item sort' contains an optional script expression used to sort items. The items to be compared are 'left' and 'right', and the expression should be true if left < right, false else.
107 <b>Example: </b><i>left.name.toLowerCase() < right.name.toLowerCase()</i> will sort by ascending item's name (case unsensitive).
110 'Item display' is the expression used to display one item. The current item is 'item', and the expression should be a string value.
112 <b>Example: </b><i>item.name + " " + item.level</i> will display for each item its name and level.
120 report->setName(tr(
"<new Report>"));
132 if (QMessageBox::question(
this, tr(
"Delete Report?"), tr(
"Really delete Report '%1'?").arg(
report->name()), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)