mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-27 14:20:52 +01:00
folio report properties widget: add two buttons:
first see the edited report, second see the linked report (if the edited report is already linked) git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2742 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -20,7 +20,10 @@ FolioReportProperties::FolioReportProperties(Element *elmt, QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
unlink = false;
|
||||
if(element_->isFree()) buildRadioList();
|
||||
if(element_->isFree()) {
|
||||
buildRadioList();
|
||||
ui->button_linked->setDisabled(true);
|
||||
}
|
||||
else buildUnlinkButton();
|
||||
}
|
||||
|
||||
@@ -39,7 +42,7 @@ void FolioReportProperties::buildRadioList() {
|
||||
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 @@ void FolioReportProperties::unlinkClicked() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @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());
|
||||
}
|
||||
|
||||
@@ -15,16 +15,20 @@ class FolioReportProperties : public QWidget
|
||||
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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user