[qet] [2742] folio report properties widget: add two buttons: |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2742
Author: blacksun
Date: 2014-01-15 00:09:07 +0100 (Wed, 15 Jan 2014)
Log Message:
-----------
folio report properties widget: add two buttons:
first see the edited report,
second see the linked report (if the edited report is already linked)
Modified Paths:
--------------
trunk/sources/ui/folioreportproperties.cpp
trunk/sources/ui/folioreportproperties.h
trunk/sources/ui/folioreportproperties.ui
Modified: trunk/sources/ui/folioreportproperties.cpp
===================================================================
--- trunk/sources/ui/folioreportproperties.cpp 2014-01-13 20:26:04 UTC (rev 2741)
+++ trunk/sources/ui/folioreportproperties.cpp 2014-01-14 23:09:07 UTC (rev 2742)
@@ -20,7 +20,10 @@
{
ui->setupUi(this);
unlink = false;
- if(element_->isFree()) buildRadioList();
+ if(element_->isFree()) {
+ buildRadioList();
+ ui->button_linked->setDisabled(true);
+ }
else buildUnlinkButton();
}
@@ -39,7 +42,7 @@
sm_ = new QSignalMapper(this);
connect(sm_, SIGNAL(mapped(int)), this, SLOT(linkToElement(int)));
sm_show_ = new QSignalMapper(this);
- connect(sm_show_, SIGNAL(mapped(int)), this, SLOT(showDiagram(int)));
+ connect(sm_show_, SIGNAL(mapped(int)), this, SLOT(showElementFromList(int)));
//Research the invert report of @element_
int rep = element_->linkType() == Element::NextReport? Element::PreviousReport : Element::NextReport;
@@ -118,13 +121,39 @@
}
/**
- * @brief FolioReportProperties::showDiagram
- * Show the wanted report element
- * @param i position of wanted element in element_list
+ * @brief FolioReportProperties::showElement
+ * Show the required element
+ * @param elmt: element to be displayed
*/
-void FolioReportProperties::showDiagram(const int i) {
- Element *elmt = element_list.at(i);
+void FolioReportProperties::showElement(Element *elmt) {
elmt->diagram()->showMe();
foreach (QGraphicsItem *qgi, elmt->diagram()->selectedItems()) qgi->setSelected(false);
elmt->setSelected(true);
}
+
+/**
+ * @brief FolioReportProperties::showElementFromList
+ * Show element at the position @i from @element_list
+ * @param i position of element to be displayed
+ */
+void FolioReportProperties::showElementFromList(const int i) {
+ if (element_list.size() > i)
+ showElement(element_list.at(i));
+}
+
+/**
+ * @brief FolioReportProperties::on_button_this_clicked
+ * Action when push button "this report" is clicked
+ */
+void FolioReportProperties::on_button_this_clicked() {
+ showElement(element_);
+}
+
+/**
+ * @brief FolioReportProperties::on_button_linked_clicked
+ * Action when push button "linked report" is clicked
+ */
+void FolioReportProperties::on_button_linked_clicked() {
+ if (element_->isFree()) return;
+ showElement(element_->linkedElements().first());
+}
Modified: trunk/sources/ui/folioreportproperties.h
===================================================================
--- trunk/sources/ui/folioreportproperties.h 2014-01-13 20:26:04 UTC (rev 2741)
+++ trunk/sources/ui/folioreportproperties.h 2014-01-14 23:09:07 UTC (rev 2742)
@@ -15,16 +15,20 @@
public:
explicit FolioReportProperties(Element *elmt, QWidget *parent = 0);
~FolioReportProperties();
- void buildRadioList();
- void buildUnlinkButton();
void Apply();
private slots:
void linkToElement(const int i) {element_to_link = element_list.at(i);}
void unlinkClicked();
- void showDiagram(const int i);
+ void showElement(Element *elmt);
+ void showElementFromList (const int i);
+ void on_button_this_clicked();
+ void on_button_linked_clicked();
private:
+ void buildRadioList();
+ void buildUnlinkButton();
+
Element *element_, *element_to_link;
QList <Element *> element_list;
Ui::FolioReportProperties *ui;
Modified: trunk/sources/ui/folioreportproperties.ui
===================================================================
--- trunk/sources/ui/folioreportproperties.ui 2014-01-13 20:26:04 UTC (rev 2741)
+++ trunk/sources/ui/folioreportproperties.ui 2014-01-14 23:09:07 UTC (rev 2742)
@@ -57,7 +57,7 @@
<x>0</x>
<y>0</y>
<width>370</width>
- <height>258</height>
+ <height>224</height>
</rect>
</property>
<layout class="QVBoxLayout" name="available_report_layout">
@@ -74,6 +74,24 @@
</layout>
</widget>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QPushButton" name="button_this">
+ <property name="text">
+ <string>Voir ce report</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="button_linked">
+ <property name="text">
+ <string>Voir le report lié</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</item>
</layout>