mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-17 16:59:59 +01:00
element master widget property: improve gui.
add slave element class. element class: replace diagramcontext informations by elementInformations because informations is already used in xml file for element. minor improvement. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2869 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -29,7 +29,7 @@ ElementInfoWidget::ElementInfoWidget(Element *elmt, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ElementInfoWidget),
|
||||
element_(elmt),
|
||||
elmt_info(elmt->informations())
|
||||
elmt_info(elmt->elementInformations())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
buildInterface();
|
||||
@@ -59,7 +59,7 @@ void ElementInfoWidget::apply() {
|
||||
eipw->text(),
|
||||
eipw->mustShow());
|
||||
}
|
||||
element_->setInformations(dc);
|
||||
element_->setElementInformations(dc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,14 +122,12 @@ void elementpropertieswidget::buildInterface() {
|
||||
tab_ -> addTab(frp_, tr("Report de folio"));
|
||||
break;
|
||||
case Element::Master:
|
||||
mpw_ = new MasterPropertiesWidget(this);
|
||||
tab_ -> addTab(mpw_, tr("R\351f\351rence crois\351 (maitre)"));
|
||||
mpw_ = new MasterPropertiesWidget(element_, this);
|
||||
tab_ -> addTab(mpw_, tr("R\351f\351rence crois\351e (maitre)"));
|
||||
eiw_ = new ElementInfoWidget(element_, this);
|
||||
tab_ -> addTab(eiw_, tr("Information"));
|
||||
break;
|
||||
case Element::SlaveNC:
|
||||
break;
|
||||
case Element::SlaveNO:
|
||||
case Element::Slave:
|
||||
break;
|
||||
case Element::Bornier:
|
||||
break;
|
||||
|
||||
@@ -1,14 +1,70 @@
|
||||
/*
|
||||
Copyright 2006-2014 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "masterpropertieswidget.h"
|
||||
#include "ui_masterpropertieswidget.h"
|
||||
#include <QListWidgetItem>
|
||||
#include <diagramposition.h>
|
||||
#include <elementprovider.h>
|
||||
|
||||
MasterPropertiesWidget::MasterPropertiesWidget(QWidget *parent) :
|
||||
MasterPropertiesWidget::MasterPropertiesWidget(Element *elmt, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::MasterPropertiesWidget)
|
||||
ui(new Ui::MasterPropertiesWidget),
|
||||
element_(elmt)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
buildInterface();
|
||||
}
|
||||
|
||||
MasterPropertiesWidget::~MasterPropertiesWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MasterPropertiesWidget::buildInterface() {
|
||||
ElementProvider elmt_prov(element_->diagram()->project());
|
||||
|
||||
foreach(Element *elmt, elmt_prov.freeElement(Element::Slave)) {
|
||||
//label for list widget
|
||||
QString widget_text;
|
||||
QString title = elmt->diagram()->title();
|
||||
if (title.isEmpty()) title = tr("Sans titre");
|
||||
widget_text += QString(tr("Folio\240 %1 (%2), position %3.")).arg(elmt->diagram()->folioIndex() + 1)
|
||||
.arg(title)
|
||||
.arg(elmt->diagram() -> convertPosition(elmt -> scenePos()).toString());
|
||||
QListWidgetItem *lwi_ = new QListWidgetItem(elmt->pixmap(), widget_text);
|
||||
ui->free_list->addItem(lwi_);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MasterPropertiesWidget::on_link_button_clicked
|
||||
* move curent item in the free_list to linked_list
|
||||
*/
|
||||
void MasterPropertiesWidget::on_link_button_clicked() {
|
||||
//take the curent item from free_list and push it to linked_list
|
||||
ui->linked_list->addItem(
|
||||
ui->free_list->takeItem(
|
||||
ui->free_list->currentRow()));
|
||||
}
|
||||
|
||||
void MasterPropertiesWidget::on_unlink_button_clicked() {
|
||||
//take the curent item from linked_list and push it to free_list
|
||||
ui->free_list->addItem(
|
||||
ui->linked_list->takeItem(
|
||||
ui->linked_list->currentRow()));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,25 @@
|
||||
/*
|
||||
Copyright 2006-2014 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef MASTERPROPERTIESWIDGET_H
|
||||
#define MASTERPROPERTIESWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <qetgraphicsitem/element.h>
|
||||
|
||||
namespace Ui {
|
||||
class MasterPropertiesWidget;
|
||||
@@ -12,11 +30,19 @@ class MasterPropertiesWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MasterPropertiesWidget(QWidget *parent = 0);
|
||||
explicit MasterPropertiesWidget(Element *elmt, QWidget *parent = 0);
|
||||
~MasterPropertiesWidget();
|
||||
|
||||
private:
|
||||
void buildInterface();
|
||||
|
||||
private slots:
|
||||
void on_link_button_clicked();
|
||||
void on_unlink_button_clicked();
|
||||
|
||||
private:
|
||||
Ui::MasterPropertiesWidget *ui;
|
||||
Element *element_;
|
||||
};
|
||||
|
||||
#endif // MASTERPROPERTIESWIDGET_H
|
||||
|
||||
@@ -1,21 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>MasterPropertiesWidget</class>
|
||||
<widget class="QWidget" name="MasterPropertiesWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>564</width>
|
||||
<height>318</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="1" rowspan="5">
|
||||
<widget class="QListWidget" name="free_list"/>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="unlink_button">
|
||||
<property name="toolTip">
|
||||
<string>Délier l'élément séléctionné</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/arrow-left.png</normaloff>:/ico/16x16/arrow-left.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" rowspan="5">
|
||||
<widget class="QListWidget" name="linked_list"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="link_button">
|
||||
<property name="toolTip">
|
||||
<string>Lier l'élément séléctionné</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/arrow-right.png</normaloff>:/ico/16x16/arrow-right.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Éléments disponibles</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Éléments liés</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<resources>
|
||||
<include location="../../qelectrotech.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user