add class ElementProvider and build small ui for the properties of folio report element

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2672 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2013-12-28 13:28:27 +00:00
parent c44f8704f9
commit 38e3e26ff8
10 changed files with 250 additions and 3 deletions

View File

@@ -93,8 +93,8 @@ void elementpropertieswidget::buildInterface() {
case Element::simple:
break;
case Element::report:
w = new QComboBox(this);
tab_ -> addTab(w, tr("Report de folio"));
frp_ = new FolioReportProperties(element_, this);
tab_ -> addTab(frp_, tr("Report de folio"));
break;
case Element::master:
break;

View File

@@ -4,6 +4,7 @@
#include <QtGui>
#include <qetgraphicsitem/element.h>
#include <diagram.h>
#include <folioreportproperties.h>
class elementpropertieswidget : public QDialog
{
@@ -27,7 +28,7 @@ class elementpropertieswidget : public QDialog
void editElement ();
private:
QWidget *w; ///this widget is only for test
FolioReportProperties *frp_;
QDialogButtonBox *dbb;
Element *element_;
Diagram *diagram_;

View File

@@ -0,0 +1,34 @@
#include "folioreportproperties.h"
#include "ui_folioreportproperties.h"
#include <diagramposition.h>
#include <elementprovider.h>
FolioReportProperties::FolioReportProperties(Element *elmt, QWidget *parent) :
QWidget(parent),
element_(elmt),
ui(new Ui::FolioReportProperties)
{
ui->setupUi(this);
ElementProvider ep(element_->diagram()->project(), element_->diagram());
QList <Element *> elmt_list = ep.FreeElement(Element::report);
foreach (Element *elmt, elmt_list) {
if (elmt != element_) {
QString button_text;
button_text += elmt->name();
button_text += QString(tr(" Folio\240: %1, ")).arg(elmt->diagram()->folioIndex() + 1);
button_text += QString(tr("Position\240: %1")).arg(elmt->diagram() -> convertPosition(elmt -> scenePos()).toString());
QRadioButton *rb = new QRadioButton(button_text , this);
ui->available_report_layout->addWidget(rb);
}
}
ui->available_report_layout->addStretch();
}
FolioReportProperties::~FolioReportProperties()
{
delete ui;
}

View File

@@ -0,0 +1,24 @@
#ifndef FOLIOREPORTPROPERTIES_H
#define FOLIOREPORTPROPERTIES_H
#include <QWidget>
#include <qetgraphicsitem/element.h>
namespace Ui {
class FolioReportProperties;
}
class FolioReportProperties : public QWidget
{
Q_OBJECT
public:
explicit FolioReportProperties(Element *elmt, QWidget *parent = 0);
~FolioReportProperties();
private:
Element *element_;
Ui::FolioReportProperties *ui;
};
#endif // FOLIOREPORTPROPERTIES_H

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FolioReportProperties</class>
<widget class="QWidget" name="FolioReportProperties">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="Report_gb">
<property name="toolTip">
<string extracomment="Report de folio pouvant être liée"/>
</property>
<property name="whatsThis">
<string extracomment="C'est ici que vous pouvez spécifier à quel autre report de folio doit être liée celui ci "/>
</property>
<property name="title">
<string>Report de folio disponible :</string>
</property>
<layout class="QVBoxLayout" name="_2">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scroll_area">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>370</width>
<height>258</height>
</rect>
</property>
<layout class="QVBoxLayout" name="available_report_layout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>