mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-04-10 16:49:59 +02:00
Table can be splitted and and row number limited
1.Table can have a name. 2.User can define the maximum row to display. 3.Table can be linked together, this is useful when there is a large data to display in a single table. Point 1, 2 and 3 work like this : -Name a table (point 1). -Limit the number of row to display to fit the table into a diagram (point 2). -Create a second table in a new folio. -Link the second table to first table, you can search by table name (point 3). -the new table start to display where the first table end. The number of linked table is unlimited.
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
#include "qetgraphicsitem/element.h"
|
#include "qetgraphicsitem/element.h"
|
||||||
|
#include "qetgraphicstableitem.h"
|
||||||
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ElementProvider::ElementProvider Constructor
|
* @brief ElementProvider::ElementProvider Constructor
|
||||||
@@ -27,8 +29,8 @@
|
|||||||
*/
|
*/
|
||||||
ElementProvider::ElementProvider(QETProject *prj, Diagram *diagram)
|
ElementProvider::ElementProvider(QETProject *prj, Diagram *diagram)
|
||||||
{
|
{
|
||||||
diag_list = prj->diagrams();
|
m_diagram_list = prj->diagrams();
|
||||||
diag_list.removeOne(diagram);
|
m_diagram_list.removeOne(diagram);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +38,7 @@ ElementProvider::ElementProvider(QETProject *prj, Diagram *diagram)
|
|||||||
* @param diag Diagram to search
|
* @param diag Diagram to search
|
||||||
*/
|
*/
|
||||||
ElementProvider::ElementProvider(Diagram *diag) {
|
ElementProvider::ElementProvider(Diagram *diag) {
|
||||||
diag_list << diag;
|
m_diagram_list << diag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +54,7 @@ QList <Element *> ElementProvider::freeElement(const int filter) const{
|
|||||||
QList <Element *> free_elmt;
|
QList <Element *> free_elmt;
|
||||||
|
|
||||||
//serch in all diagram
|
//serch in all diagram
|
||||||
foreach (Diagram *d, diag_list) {
|
foreach (Diagram *d, m_diagram_list) {
|
||||||
//get all element in diagram d
|
//get all element in diagram d
|
||||||
QList <Element *> elmt_list;
|
QList <Element *> elmt_list;
|
||||||
elmt_list = d->elements();
|
elmt_list = d->elements();
|
||||||
@@ -72,7 +74,7 @@ QList <Element *> ElementProvider::freeElement(const int filter) const{
|
|||||||
QList <Element *> ElementProvider::fromUuids(QList<QUuid> uuid_list) const {
|
QList <Element *> ElementProvider::fromUuids(QList<QUuid> uuid_list) const {
|
||||||
QList <Element *> found_element;
|
QList <Element *> found_element;
|
||||||
|
|
||||||
foreach (Diagram *d, diag_list) {
|
foreach (Diagram *d, m_diagram_list) {
|
||||||
foreach(Element *elmt, d->elements()) {
|
foreach(Element *elmt, d->elements()) {
|
||||||
if (uuid_list.contains(elmt->uuid())) {
|
if (uuid_list.contains(elmt->uuid())) {
|
||||||
found_element << elmt;
|
found_element << elmt;
|
||||||
@@ -94,7 +96,7 @@ QList <Element *> ElementProvider::find(const int filter) const {
|
|||||||
QList <Element *> elmt_;
|
QList <Element *> elmt_;
|
||||||
|
|
||||||
//serch in all diagram
|
//serch in all diagram
|
||||||
foreach (Diagram *d, diag_list) {
|
foreach (Diagram *d, m_diagram_list) {
|
||||||
//get all element in diagram d
|
//get all element in diagram d
|
||||||
QList <Element *> elmt_list;
|
QList <Element *> elmt_list;
|
||||||
elmt_list = d->elements();
|
elmt_list = d->elements();
|
||||||
@@ -105,3 +107,52 @@ QList <Element *> ElementProvider::find(const int filter) const {
|
|||||||
}
|
}
|
||||||
return (elmt_);
|
return (elmt_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ElementProvider::table
|
||||||
|
* @param table
|
||||||
|
* @param model
|
||||||
|
* @return All tables wich display the derivated class of @model (if set) and not already in all the chain of next/previous table of @table (if set)
|
||||||
|
* If table and model are nullptr, return every tables
|
||||||
|
*/
|
||||||
|
QVector<QetGraphicsTableItem *> ElementProvider::table(QetGraphicsTableItem *table, QAbstractItemModel *model)
|
||||||
|
{
|
||||||
|
QVector<QetGraphicsTableItem *> v_;
|
||||||
|
QVector<QetGraphicsTableItem *> linked_vector;
|
||||||
|
|
||||||
|
if (table)
|
||||||
|
{
|
||||||
|
auto linked_table = table->previousTable() ? table->previousTable() : table->nextTable(); //table can be inside a chain, at the head of a chain or alone
|
||||||
|
while (linked_table) { //Go to the first table
|
||||||
|
if (linked_table->previousTable())
|
||||||
|
linked_table = linked_table->previousTable();
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (linked_table) { //Store each linked table in linked_vector
|
||||||
|
linked_vector.append(linked_table);
|
||||||
|
linked_table = linked_table->nextTable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto d : m_diagram_list) {
|
||||||
|
for (auto item_ : d->items())
|
||||||
|
{
|
||||||
|
if(item_->type() == QetGraphicsTableItem::Type)
|
||||||
|
{
|
||||||
|
auto found_table = static_cast<QetGraphicsTableItem *>(item_);
|
||||||
|
|
||||||
|
if (linked_vector.contains(found_table)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!model ||
|
||||||
|
(found_table->model() &&
|
||||||
|
model->metaObject()->className() == found_table->model()->metaObject()->className()))
|
||||||
|
{v_.append(found_table);}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return v_;
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,10 +20,12 @@
|
|||||||
|
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QAbstractTableModel>
|
||||||
|
|
||||||
class QETProject;
|
class QETProject;
|
||||||
class Diagram;
|
class Diagram;
|
||||||
class Element;
|
class Element;
|
||||||
|
class QetGraphicsTableItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
this class can search in the given diagram or project some kind of element
|
this class can search in the given diagram or project some kind of element
|
||||||
@@ -34,14 +36,15 @@ class Element;
|
|||||||
class ElementProvider
|
class ElementProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElementProvider(QETProject *prj, Diagram *diagram=nullptr);
|
ElementProvider(QETProject *prj, Diagram *diagram=nullptr);
|
||||||
ElementProvider(Diagram *diag);
|
ElementProvider(Diagram *diag);
|
||||||
QList <Element *> freeElement(const int filter) const;
|
QList <Element *> freeElement(const int filter) const;
|
||||||
QList <Element *> fromUuids(QList <QUuid>) const;
|
QList <Element *> fromUuids(QList <QUuid>) const;
|
||||||
QList <Element *> find(const int filter) const;
|
QList <Element *> find(const int filter) const;
|
||||||
|
QVector <QetGraphicsTableItem *> table(QetGraphicsTableItem *table = nullptr, QAbstractItemModel *model = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList <Diagram *> diag_list;
|
QList <Diagram *> m_diagram_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ELEMENTPROVIDER_H
|
#endif // ELEMENTPROVIDER_H
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
static int no_model_height = 20;
|
||||||
|
static int no_model_width = 40;
|
||||||
/**
|
/**
|
||||||
* @brief QetGraphicsHeaderItem::QetGraphicsHeaderItem
|
* @brief QetGraphicsHeaderItem::QetGraphicsHeaderItem
|
||||||
* @param parent
|
* @param parent
|
||||||
@@ -47,12 +49,18 @@ void QetGraphicsHeaderItem::setModel(QAbstractItemModel *model)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_model = model;
|
m_model = model;
|
||||||
connect(m_model, &QAbstractItemModel::headerDataChanged, this, &QetGraphicsHeaderItem::headerDataChanged);
|
if (m_model)
|
||||||
connect(m_model, &QAbstractItemModel::modelReset, this, &QetGraphicsHeaderItem::modelReseted);
|
{
|
||||||
connect(m_model, &QAbstractItemModel::columnsInserted, this, &QetGraphicsHeaderItem::modelReseted);
|
connect(m_model, &QAbstractItemModel::headerDataChanged, this, &QetGraphicsHeaderItem::headerDataChanged);
|
||||||
setUpMinimumSectionsSize();
|
connect(m_model, &QAbstractItemModel::modelReset, this, &QetGraphicsHeaderItem::modelReseted);
|
||||||
m_current_sections_width.clear();
|
connect(m_model, &QAbstractItemModel::columnsInserted, this, &QetGraphicsHeaderItem::modelReseted);
|
||||||
m_current_sections_width.resize(m_sections_minimum_width.size());
|
setUpMinimumSectionsSize();
|
||||||
|
m_current_sections_width.clear();
|
||||||
|
m_current_sections_width.resize(m_sections_minimum_width.size());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
setUpMinimumSectionsSize();
|
||||||
|
}
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +105,6 @@ void QetGraphicsHeaderItem::paint(QPainter *painter, const QStyleOptionGraphicsI
|
|||||||
painter->setBrush(brush);
|
painter->setBrush(brush);
|
||||||
|
|
||||||
painter->setPen(pen);
|
painter->setPen(pen);
|
||||||
painter->setFont(m_model->headerData(0, Qt::Horizontal, Qt::FontRole).value<QFont>());
|
|
||||||
painter->drawRect(m_current_rect);
|
painter->drawRect(m_current_rect);
|
||||||
|
|
||||||
if (!m_model)
|
if (!m_model)
|
||||||
@@ -105,6 +112,7 @@ void QetGraphicsHeaderItem::paint(QPainter *painter, const QStyleOptionGraphicsI
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
painter->setFont(m_model->headerData(0, Qt::Horizontal, Qt::FontRole).value<QFont>());
|
||||||
|
|
||||||
//Draw vertical lines
|
//Draw vertical lines
|
||||||
auto offset= 0;
|
auto offset= 0;
|
||||||
@@ -145,7 +153,20 @@ QRect QetGraphicsHeaderItem::rect() const {
|
|||||||
* @param size
|
* @param size
|
||||||
*/
|
*/
|
||||||
void QetGraphicsHeaderItem::resizeSection(int logicalIndex, int size)
|
void QetGraphicsHeaderItem::resizeSection(int logicalIndex, int size)
|
||||||
{
|
{
|
||||||
|
if (!m_model)
|
||||||
|
{
|
||||||
|
m_current_sections_width.clear();
|
||||||
|
m_current_sections_width.append(no_model_width);
|
||||||
|
m_sections_minimum_width.clear();
|
||||||
|
m_sections_minimum_width.append(no_model_width);
|
||||||
|
m_current_rect.setWidth(no_model_width);
|
||||||
|
setUpBoundingRect();
|
||||||
|
update();
|
||||||
|
emit sectionResized(0, no_model_width);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (logicalIndex >= m_current_sections_width.size() ||
|
if (logicalIndex >= m_current_sections_width.size() ||
|
||||||
m_current_sections_width.at(logicalIndex) == size) {
|
m_current_sections_width.at(logicalIndex) == size) {
|
||||||
return;
|
return;
|
||||||
@@ -195,7 +216,12 @@ void QetGraphicsHeaderItem::setMargins(const QMargins &margins)
|
|||||||
*/
|
*/
|
||||||
void QetGraphicsHeaderItem::setUpMinimumSectionsSize()
|
void QetGraphicsHeaderItem::setUpMinimumSectionsSize()
|
||||||
{
|
{
|
||||||
if (!m_model) {
|
if (!m_model)
|
||||||
|
{
|
||||||
|
m_minimum_section_height = no_model_height;
|
||||||
|
m_sections_minimum_width.clear();
|
||||||
|
m_sections_minimum_width.append(no_model_width);
|
||||||
|
m_minimum_width = no_model_width;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class QetGraphicsHeaderItem : public QGraphicsObject
|
|||||||
enum { Type = UserType + 1301 };
|
enum { Type = UserType + 1301 };
|
||||||
int type() const override { return Type; }
|
int type() const override { return Type; }
|
||||||
|
|
||||||
void setModel(QAbstractItemModel *model);
|
void setModel(QAbstractItemModel *model = nullptr);
|
||||||
QAbstractItemModel *model() const;
|
QAbstractItemModel *model() const;
|
||||||
|
|
||||||
virtual QRectF boundingRect() const override;
|
virtual QRectF boundingRect() const override;
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
|
|
||||||
|
static int no_model_height = 20;
|
||||||
|
static int no_model_width = 40;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QetGraphicsTableItem::QetGraphicsTableItem
|
* @brief QetGraphicsTableItem::QetGraphicsTableItem
|
||||||
* Default constructor
|
* Default constructor
|
||||||
@@ -78,8 +81,11 @@ void QetGraphicsTableItem::setModel(QAbstractItemModel *model)
|
|||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
||||||
m_header_item->setPos(0, -m_header_item->rect().height());
|
m_header_item->setPos(0, -m_header_item->rect().height());
|
||||||
connect(m_model, &QAbstractItemModel::dataChanged, this, &QetGraphicsTableItem::dataChanged);
|
if (m_model)
|
||||||
connect(m_model, &QAbstractItemModel::modelReset, this, &QetGraphicsTableItem::modelReseted);
|
{
|
||||||
|
connect(m_model, &QAbstractItemModel::dataChanged, this, &QetGraphicsTableItem::dataChanged);
|
||||||
|
connect(m_model, &QAbstractItemModel::modelReset, this, &QetGraphicsTableItem::modelReseted);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,15 +123,25 @@ void QetGraphicsTableItem::paint(QPainter *painter, const QStyleOptionGraphicsIt
|
|||||||
pen.setWidthF(0.7);
|
pen.setWidthF(0.7);
|
||||||
pen.setColor(Qt::black);
|
pen.setColor(Qt::black);
|
||||||
painter->setPen(pen);
|
painter->setPen(pen);
|
||||||
painter->setFont(m_model->data(model()->index(0,0), Qt::FontRole).value<QFont>());
|
|
||||||
|
|
||||||
painter->drawRect(0,0, m_header_item->rect().width(), m_current_size.height());
|
painter->drawRect(0,0, m_header_item->rect().width(), m_current_size.height());
|
||||||
|
|
||||||
|
if (isSelected())
|
||||||
|
{
|
||||||
|
painter->save();
|
||||||
|
QColor color(Qt::darkBlue);
|
||||||
|
color.setAlpha(20);
|
||||||
|
painter->setBrush(QBrush (color));
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
|
painter->drawRect(0,0, m_header_item->rect().width(), m_current_size.height());
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
if(!m_model)
|
if(!m_model)
|
||||||
{
|
{
|
||||||
painter->restore();
|
painter->restore();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
painter->setFont(m_model->data(model()->index(0,0), Qt::FontRole).value<QFont>());
|
||||||
|
|
||||||
//Draw vertical lines
|
//Draw vertical lines
|
||||||
auto offset= 0;
|
auto offset= 0;
|
||||||
@@ -137,9 +153,18 @@ void QetGraphicsTableItem::paint(QPainter *painter, const QStyleOptionGraphicsIt
|
|||||||
offset += m_header_item->sectionSize(i);
|
offset += m_header_item->sectionSize(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Calcule the number of rows to display.
|
||||||
|
auto row_count = m_model->rowCount();
|
||||||
|
|
||||||
|
if (m_previous_table) //Remove the number of row already displayed by previous tables
|
||||||
|
row_count -= m_previous_table->displayNRowOffset();
|
||||||
|
|
||||||
|
if (m_number_of_displayed_row > 0) //User override the number of row to display
|
||||||
|
row_count = std::min(row_count, m_number_of_displayed_row);
|
||||||
|
|
||||||
//Draw horizontal lines
|
//Draw horizontal lines
|
||||||
auto cell_height = static_cast<double>(m_current_size.height())/static_cast<double>(m_model->rowCount());
|
auto cell_height = static_cast<double>(m_current_size.height())/static_cast<double>(row_count);
|
||||||
for(auto i= 1 ; i-1<m_model->rowCount() ; ++i)
|
for(auto i= 1 ; i-1<row_count ; ++i)
|
||||||
{
|
{
|
||||||
QPointF p1(m_header_item->rect().left(), cell_height*i);
|
QPointF p1(m_header_item->rect().left(), cell_height*i);
|
||||||
QPointF p2(m_header_item->rect().right(), cell_height*i);
|
QPointF p2(m_header_item->rect().right(), cell_height*i);
|
||||||
@@ -147,7 +172,7 @@ void QetGraphicsTableItem::paint(QPainter *painter, const QStyleOptionGraphicsIt
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Write text of each cell
|
//Write text of each cell
|
||||||
for (auto i= 0 ; i<m_model->rowCount() ; ++i)
|
for (auto i=0 ; i<row_count ; ++i)
|
||||||
{
|
{
|
||||||
QPointF top_left(m_margin.left(), i==0? m_margin.top() : cell_height*i + m_margin.top());
|
QPointF top_left(m_margin.left(), i==0? m_margin.top() : cell_height*i + m_margin.top());
|
||||||
|
|
||||||
@@ -159,9 +184,10 @@ void QetGraphicsTableItem::paint(QPainter *painter, const QStyleOptionGraphicsIt
|
|||||||
}
|
}
|
||||||
QSize size(m_header_item->sectionSize(j) - m_margin.left() - m_margin.right(),
|
QSize size(m_header_item->sectionSize(j) - m_margin.left() - m_margin.right(),
|
||||||
static_cast<int>(cell_height) - m_margin.top() - m_margin.bottom());
|
static_cast<int>(cell_height) - m_margin.top() - m_margin.bottom());
|
||||||
|
auto index_row = m_previous_table ? i + m_previous_table->displayNRowOffset() : i;
|
||||||
painter->drawText(QRectF(top_left, size),
|
painter->drawText(QRectF(top_left, size),
|
||||||
m_model->data(m_model->index(0,0), Qt::TextAlignmentRole).toInt(),
|
m_model->data(m_model->index(0,0), Qt::TextAlignmentRole).toInt(),
|
||||||
m_model->index(i, j).data().toString());
|
m_model->index(index_row, j).data().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,10 +244,155 @@ QSize QetGraphicsTableItem::size() const
|
|||||||
*/
|
*/
|
||||||
QSize QetGraphicsTableItem::minimumSize() const
|
QSize QetGraphicsTableItem::minimumSize() const
|
||||||
{
|
{
|
||||||
QSize s(std::accumulate(m_minimum_column_width.begin(), m_minimum_column_width.end(), 0), m_minimum_row_height*m_model->rowCount());
|
if (!m_model) {
|
||||||
|
return QSize(no_model_width, no_model_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto row_count = m_model->rowCount();
|
||||||
|
if (m_previous_table) {
|
||||||
|
row_count -= m_previous_table->displayNRowOffset();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_number_of_displayed_row > 0)
|
||||||
|
row_count = std::min(row_count, m_number_of_displayed_row);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QSize s(std::accumulate(m_minimum_column_width.begin(), m_minimum_column_width.end(), 0), m_minimum_row_height*row_count);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QetGraphicsTableItem::setDisplayNRow
|
||||||
|
* Limit the number of row to display
|
||||||
|
* @param number : set to 0 or less to disabled the limit of row to display
|
||||||
|
*/
|
||||||
|
void QetGraphicsTableItem::setDisplayNRow(const int &number) {
|
||||||
|
m_number_of_displayed_row = number;
|
||||||
|
setToMinimumHeight();
|
||||||
|
if (m_next_table)
|
||||||
|
m_next_table->previousTableDisplayRowChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QetGraphicsTableItem::displayNRow
|
||||||
|
* @return the number of row displayed.
|
||||||
|
* A value of 0 or less mean there is no limit
|
||||||
|
*/
|
||||||
|
int QetGraphicsTableItem::displayNRow() const {
|
||||||
|
return m_number_of_displayed_row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QetGraphicsTableItem::setPreviousTable
|
||||||
|
* Set the previous table to @table.
|
||||||
|
* If this table already have a previous table, the previous table will be replaced.
|
||||||
|
* Set new table to nullptr to remove an existing previous table.
|
||||||
|
* The table uses the model of the new previous table.
|
||||||
|
* Since the table does not take ownership of the model, it is your responsibility to manage the old model.
|
||||||
|
* Linked tables (table with next and/or previous table) share the same model, a table always take the model of the previous table..
|
||||||
|
* When remove a previous table (set to nullptr) from a table, the model is also removed, you need to set a new model
|
||||||
|
* @param table
|
||||||
|
*/
|
||||||
|
void QetGraphicsTableItem::setPreviousTable(QetGraphicsTableItem *table)
|
||||||
|
{
|
||||||
|
if (m_previous_table == table) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto old_previous_table = m_previous_table;
|
||||||
|
m_previous_table = table;
|
||||||
|
if (m_previous_table) //set previous table and get her model
|
||||||
|
{
|
||||||
|
m_previous_table->setNextTable(this);
|
||||||
|
setModel(m_previous_table->m_model);
|
||||||
|
}
|
||||||
|
else //Remove model
|
||||||
|
{
|
||||||
|
setModel(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (old_previous_table &&
|
||||||
|
old_previous_table->nextTable() == this) {
|
||||||
|
old_previous_table->setNextTable(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set the m_model to every next table
|
||||||
|
auto next_ = m_next_table;
|
||||||
|
while (next_) {
|
||||||
|
next_->setModel(m_model);
|
||||||
|
next_ = next_->nextTable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QetGraphicsTableItem::setNextTable
|
||||||
|
* Set the next table to @table
|
||||||
|
* nullptr will remove an existing next table.
|
||||||
|
* @param table
|
||||||
|
*/
|
||||||
|
void QetGraphicsTableItem::setNextTable(QetGraphicsTableItem *table)
|
||||||
|
{
|
||||||
|
if (m_next_table == table) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto old_next_table = m_next_table;
|
||||||
|
|
||||||
|
m_next_table = table;
|
||||||
|
if (m_next_table) {
|
||||||
|
m_next_table->setPreviousTable(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (old_next_table &&
|
||||||
|
old_next_table->previousTable() == this) {
|
||||||
|
old_next_table->setPreviousTable(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void QetGraphicsTableItem::setTableName(const QString &name) {
|
||||||
|
m_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QetGraphicsTableItem::tableName() const {
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QetGraphicsTableItem::displayNRowOffset
|
||||||
|
* @return the offset (aka the last displayed row) of displayed row.
|
||||||
|
* If this item have a previous table, the previous offset is added.
|
||||||
|
*/
|
||||||
|
int QetGraphicsTableItem::displayNRowOffset() const
|
||||||
|
{
|
||||||
|
auto offset_ = m_number_of_displayed_row;
|
||||||
|
if(m_previous_table)
|
||||||
|
offset_ += m_previous_table->displayNRowOffset();
|
||||||
|
|
||||||
|
return offset_;
|
||||||
|
}
|
||||||
|
|
||||||
|
QetGraphicsTableItem *QetGraphicsTableItem::previousTable() const {
|
||||||
|
return m_previous_table;
|
||||||
|
}
|
||||||
|
|
||||||
|
QetGraphicsTableItem *QetGraphicsTableItem::nextTable() const {
|
||||||
|
return m_next_table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QetGraphicsTableItem::setToMinimumHeight
|
||||||
|
* Set the height to the the minimum.
|
||||||
|
* The width stay unchanged.
|
||||||
|
*/
|
||||||
|
void QetGraphicsTableItem::setToMinimumHeight()
|
||||||
|
{
|
||||||
|
auto size_ = size();
|
||||||
|
size_.setHeight(1);
|
||||||
|
setSize(size_);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QetGraphicsTableItem::hoverEnterEvent
|
* @brief QetGraphicsTableItem::hoverEnterEvent
|
||||||
* Reimplemented from QetGraphicsItem
|
* Reimplemented from QetGraphicsItem
|
||||||
@@ -229,9 +400,12 @@ QSize QetGraphicsTableItem::minimumSize() const
|
|||||||
*/
|
*/
|
||||||
void QetGraphicsTableItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void QetGraphicsTableItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
adjustHandlerPos();
|
if (m_model)
|
||||||
this->scene()->addItem(&m_handler_item);
|
{
|
||||||
m_handler_item.installSceneEventFilter(this);
|
adjustHandlerPos();
|
||||||
|
this->scene()->addItem(&m_handler_item);
|
||||||
|
m_handler_item.installSceneEventFilter(this);
|
||||||
|
}
|
||||||
QGraphicsObject::hoverEnterEvent(event);
|
QGraphicsObject::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +416,9 @@ void QetGraphicsTableItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
*/
|
*/
|
||||||
void QetGraphicsTableItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void QetGraphicsTableItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
m_handler_item.scene()->removeItem(&m_handler_item);
|
if (m_model) {
|
||||||
|
m_handler_item.scene()->removeItem(&m_handler_item);
|
||||||
|
}
|
||||||
QGraphicsObject::hoverLeaveEvent(event);
|
QGraphicsObject::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,6 +455,7 @@ bool QetGraphicsTableItem::sceneEventFilter(QGraphicsItem *watched, QEvent *even
|
|||||||
|
|
||||||
void QetGraphicsTableItem::modelReseted() {
|
void QetGraphicsTableItem::modelReseted() {
|
||||||
dataChanged(m_model->index(0,0), m_model->index(0,0), QVector<int>());
|
dataChanged(m_model->index(0,0), m_model->index(0,0), QVector<int>());
|
||||||
|
setToMinimumHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -288,7 +465,10 @@ void QetGraphicsTableItem::modelReseted() {
|
|||||||
*/
|
*/
|
||||||
void QetGraphicsTableItem::setUpColumnAndRowMinimumSize()
|
void QetGraphicsTableItem::setUpColumnAndRowMinimumSize()
|
||||||
{
|
{
|
||||||
if (!m_model) {
|
if (!m_model)
|
||||||
|
{
|
||||||
|
m_minimum_row_height = no_model_height;
|
||||||
|
m_minimum_column_width = m_header_item->minimumSectionWidth();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,6 +520,8 @@ void QetGraphicsTableItem::setUpHandler()
|
|||||||
void QetGraphicsTableItem::handlerMousePressEvent(QGraphicsSceneMouseEvent *event)
|
void QetGraphicsTableItem::handlerMousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
|
diagram()->clearSelection();
|
||||||
|
this->setSelected(true);
|
||||||
m_old_size = size();
|
m_old_size = size();
|
||||||
//User start to resize the table, disconnect the signal to avoid double paint.
|
//User start to resize the table, disconnect the signal to avoid double paint.
|
||||||
disconnect(m_header_item, &QetGraphicsHeaderItem::sectionResized, this, &QetGraphicsTableItem::headerSectionResized);
|
disconnect(m_header_item, &QetGraphicsHeaderItem::sectionResized, this, &QetGraphicsTableItem::headerSectionResized);
|
||||||
@@ -380,6 +562,15 @@ void QetGraphicsTableItem::handlerMouseReleaseEvent(QGraphicsSceneMouseEvent *ev
|
|||||||
*/
|
*/
|
||||||
void QetGraphicsTableItem::adjustColumnsWidth()
|
void QetGraphicsTableItem::adjustColumnsWidth()
|
||||||
{
|
{
|
||||||
|
if (!m_model)
|
||||||
|
{
|
||||||
|
auto h_ = m_header_item->minimumSectionWidth();
|
||||||
|
for (auto i=0 ; i<h_.size() ; ++i) {
|
||||||
|
m_header_item->resizeSection(i, h_.at(i));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto a = m_current_size.width() - minimumSize().width();
|
auto a = m_current_size.width() - minimumSize().width();
|
||||||
auto b = a/std::max(1,m_model->columnCount()); //avoid divide by 0
|
auto b = a/std::max(1,m_model->columnCount()); //avoid divide by 0
|
||||||
|
|
||||||
@@ -423,6 +614,12 @@ void QetGraphicsTableItem::headerSectionResized()
|
|||||||
*/
|
*/
|
||||||
void QetGraphicsTableItem::adjustSize()
|
void QetGraphicsTableItem::adjustSize()
|
||||||
{
|
{
|
||||||
|
//If there is no model, set the size to minimum
|
||||||
|
if (!m_model) {
|
||||||
|
setSize(minimumSize());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_current_size.height() < minimumSize().height())
|
if (m_current_size.height() < minimumSize().height())
|
||||||
{
|
{
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
@@ -440,3 +637,10 @@ void QetGraphicsTableItem::adjustSize()
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QetGraphicsTableItem::previousTableDisplayRowChanged() {
|
||||||
|
setToMinimumHeight();
|
||||||
|
if (m_next_table) {
|
||||||
|
m_next_table->previousTableDisplayRowChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2006-2020 QElectroTech Team
|
Copyright 2006-2020 QElectroTech Team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
@@ -44,6 +44,7 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
|
|
||||||
Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
|
Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
|
||||||
Q_PROPERTY(QSize size READ size WRITE setSize)
|
Q_PROPERTY(QSize size READ size WRITE setSize)
|
||||||
|
Q_PROPERTY(int displayNRow READ displayNRow WRITE setDisplayNRow)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QetGraphicsTableItem(QGraphicsItem *parent= nullptr);
|
QetGraphicsTableItem(QGraphicsItem *parent= nullptr);
|
||||||
@@ -52,7 +53,7 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
enum { Type = UserType + 1300 };
|
enum { Type = UserType + 1300 };
|
||||||
int type() const override { return Type; }
|
int type() const override { return Type; }
|
||||||
|
|
||||||
void setModel(QAbstractItemModel *model);
|
void setModel(QAbstractItemModel *model = nullptr);
|
||||||
QAbstractItemModel *model() const;
|
QAbstractItemModel *model() const;
|
||||||
|
|
||||||
virtual QRectF boundingRect() const override;
|
virtual QRectF boundingRect() const override;
|
||||||
@@ -63,6 +64,16 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
void setSize(const QSize &size);
|
void setSize(const QSize &size);
|
||||||
QSize size() const;
|
QSize size() const;
|
||||||
QSize minimumSize() const;
|
QSize minimumSize() const;
|
||||||
|
void setDisplayNRow(const int &number);
|
||||||
|
int displayNRow() const;
|
||||||
|
void setPreviousTable(QetGraphicsTableItem *table = nullptr);
|
||||||
|
void setNextTable(QetGraphicsTableItem *table = nullptr);
|
||||||
|
void setTableName(const QString &name);
|
||||||
|
QString tableName() const;
|
||||||
|
int displayNRowOffset() const;
|
||||||
|
QetGraphicsTableItem *previousTable() const;
|
||||||
|
QetGraphicsTableItem *nextTable() const;
|
||||||
|
void setToMinimumHeight();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||||
@@ -82,6 +93,7 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
|
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
|
||||||
void headerSectionResized();
|
void headerSectionResized();
|
||||||
void adjustSize();
|
void adjustSize();
|
||||||
|
void previousTableDisplayRowChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QAbstractItemModel *m_model= nullptr;
|
QAbstractItemModel *m_model= nullptr;
|
||||||
@@ -89,6 +101,7 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
QMargins m_margin;
|
QMargins m_margin;
|
||||||
QVector<int> m_minimum_column_width;
|
QVector<int> m_minimum_column_width;
|
||||||
int m_minimum_row_height;
|
int m_minimum_row_height;
|
||||||
|
int m_number_of_displayed_row = 0;
|
||||||
QSize m_current_size,
|
QSize m_current_size,
|
||||||
m_old_size;
|
m_old_size;
|
||||||
|
|
||||||
@@ -97,6 +110,11 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
|
|
||||||
QetGraphicsHandlerItem m_handler_item;
|
QetGraphicsHandlerItem m_handler_item;
|
||||||
QetGraphicsHeaderItem *m_header_item = nullptr;
|
QetGraphicsHeaderItem *m_header_item = nullptr;
|
||||||
|
|
||||||
|
QetGraphicsTableItem *m_previous_table = nullptr,
|
||||||
|
*m_next_table = nullptr;
|
||||||
|
|
||||||
|
QString m_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QetGraphicsTableItem_H
|
#endif // QetGraphicsTableItem_H
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||||
#include "itemmodelcommand.h"
|
#include "itemmodelcommand.h"
|
||||||
#include "propertieseditorfactory.h"
|
#include "propertieseditorfactory.h"
|
||||||
|
#include "elementprovider.h"
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
@@ -74,6 +75,7 @@ void GraphicsTablePropertiesEditor::setTable(QetGraphicsTableItem *table)
|
|||||||
{
|
{
|
||||||
ui->m_content_layout->removeWidget(m_current_model_editor);
|
ui->m_content_layout->removeWidget(m_current_model_editor);
|
||||||
m_current_model_editor->deleteLater();
|
m_current_model_editor->deleteLater();
|
||||||
|
m_current_model_editor = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +131,12 @@ QUndoCommand *GraphicsTablePropertiesEditor::associatedUndo() const
|
|||||||
return undo;
|
return undo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ui->m_display_n_row_sb->value() != m_table_item->displayNRow()) {
|
||||||
|
auto undo = new QPropertyUndoCommand(m_table_item.data(), "displayNRow", m_table_item->displayNRow(), ui->m_display_n_row_sb->value());
|
||||||
|
undo->setText(tr("Modifier le nombre de ligne affiché par un tableau"));
|
||||||
|
return undo;
|
||||||
|
}
|
||||||
|
|
||||||
QMargins header_margins(ui->m_header_left_margin->value(),
|
QMargins header_margins(ui->m_header_left_margin->value(),
|
||||||
ui->m_header_top_margin->value(),
|
ui->m_header_top_margin->value(),
|
||||||
ui->m_header_right_margin->value(),
|
ui->m_header_right_margin->value(),
|
||||||
@@ -241,8 +249,33 @@ void GraphicsTablePropertiesEditor::updateUi()
|
|||||||
}
|
}
|
||||||
m_edit_connection.clear();
|
m_edit_connection.clear();
|
||||||
|
|
||||||
|
ui->m_table_name_le->setText(m_table_item->tableName());
|
||||||
ui->m_x_pos->setValue(m_table_item->pos().x());
|
ui->m_x_pos->setValue(m_table_item->pos().x());
|
||||||
ui->m_y_pos->setValue(m_table_item->pos().y());
|
ui->m_y_pos->setValue(m_table_item->pos().y());
|
||||||
|
ui->m_display_n_row_sb->setValue(m_table_item->displayNRow());
|
||||||
|
|
||||||
|
ui->m_previous_table_cb->clear();
|
||||||
|
m_other_table_vector.clear();
|
||||||
|
|
||||||
|
ui->m_previous_table_cb->addItem(tr("Aucun")); //Add no previous table
|
||||||
|
|
||||||
|
if (auto item_ = m_table_item->previousTable()) //Add the current previous table
|
||||||
|
{
|
||||||
|
m_other_table_vector.append(item_);
|
||||||
|
ui->m_previous_table_cb->addItem(item_->tableName(), m_other_table_vector.indexOf(item_));
|
||||||
|
ui->m_previous_table_cb->setCurrentIndex(ui->m_previous_table_cb->findData(m_other_table_vector.indexOf(item_)));
|
||||||
|
}
|
||||||
|
|
||||||
|
ElementProvider ep(m_table_item->diagram()->project());
|
||||||
|
for (auto item_ : ep.table(m_table_item, m_table_item->model())) //Add available tables
|
||||||
|
{
|
||||||
|
if (item_ != m_table_item &&
|
||||||
|
item_->nextTable() == nullptr)
|
||||||
|
{
|
||||||
|
m_other_table_vector.append(item_);
|
||||||
|
ui->m_previous_table_cb->addItem(item_->tableName(), m_other_table_vector.indexOf(item_));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto margin = m_table_item->headerItem()->margins();
|
auto margin = m_table_item->headerItem()->margins();
|
||||||
ui->m_header_top_margin ->setValue(margin.top());
|
ui->m_header_top_margin ->setValue(margin.top());
|
||||||
@@ -294,5 +327,19 @@ void GraphicsTablePropertiesEditor::setUpEditConnection()
|
|||||||
m_edit_connection << connect(ui->m_table_bottom_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(ui->m_table_bottom_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
|
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsTablePropertiesEditor::on_m_table_name_le_textEdited(const QString &arg1) {
|
||||||
|
m_table_item->setTableName(arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsTablePropertiesEditor::on_m_previous_table_cb_activated(int index)
|
||||||
|
{
|
||||||
|
if (index == 0) {
|
||||||
|
m_table_item->setPreviousTable();
|
||||||
|
} else {
|
||||||
|
m_table_item->setPreviousTable(m_other_table_vector.at(ui->m_previous_table_cb->currentData().toInt()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2006-2020 The QElectroTech Team
|
Copyright 2006-2020 The QElectroTech Team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
@@ -51,8 +51,10 @@ class GraphicsTablePropertiesEditor : public PropertiesEditorWidget
|
|||||||
void on_m_header_font_pb_clicked();
|
void on_m_header_font_pb_clicked();
|
||||||
void on_m_table_font_pb_clicked();
|
void on_m_table_font_pb_clicked();
|
||||||
virtual void updateUi() override;
|
virtual void updateUi() override;
|
||||||
|
void on_m_table_name_le_textEdited(const QString &arg1);
|
||||||
|
void on_m_previous_table_cb_activated(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setUpEditConnection();
|
void setUpEditConnection();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -63,6 +65,7 @@ class GraphicsTablePropertiesEditor : public PropertiesEditorWidget
|
|||||||
QButtonGroup *m_header_button_group = nullptr,
|
QButtonGroup *m_header_button_group = nullptr,
|
||||||
*m_table_button_group = nullptr;
|
*m_table_button_group = nullptr;
|
||||||
QWidget *m_current_model_editor = nullptr;
|
QWidget *m_current_model_editor = nullptr;
|
||||||
|
QVector<QetGraphicsTableItem *> m_other_table_vector;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QMargins)
|
Q_DECLARE_METATYPE(QMargins)
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>353</width>
|
<width>467</width>
|
||||||
<height>534</height>
|
<height>672</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -24,30 +24,55 @@
|
|||||||
<string>Affichage</string>
|
<string>Affichage</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="m_table_name_le">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Nom du tableau</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Position</string>
|
<string>Position et lignes</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item>
|
<item row="1" column="4" colspan="2">
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QComboBox" name="m_previous_table_cb">
|
||||||
|
<property name="insertPolicy">
|
||||||
|
<enum>QComboBox::InsertAtBottom</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Aucun</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="6" colspan="2">
|
||||||
|
<widget class="QSpinBox" name="m_display_n_row_sb">
|
||||||
|
<property name="specialValueText">
|
||||||
|
<string>Toutes</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>999</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="5">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>X :</string>
|
<string>Lignes à afficher :</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="3">
|
||||||
<widget class="QSpinBox" name="m_x_pos">
|
|
||||||
<property name="maximum">
|
|
||||||
<number>10000</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Y :</string>
|
<string>Y :</string>
|
||||||
@@ -57,13 +82,124 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="7">
|
||||||
|
<widget class="QPushButton" name="m_next_pb">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Tableau suivant</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>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>X :</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="6">
|
||||||
|
<widget class="QPushButton" name="m_previous_cb">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Tableau précédent</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>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QSpinBox" name="m_x_pos">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="7">
|
||||||
|
<widget class="QWidget" name="widget_3" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
<widget class="QSpinBox" name="m_y_pos">
|
<widget class="QSpinBox" name="m_y_pos">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>10000</number>
|
<number>10000</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="8">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tableau précédent :</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -75,16 +211,33 @@
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="2" column="0">
|
<item row="2" column="4">
|
||||||
<widget class="QSpinBox" name="m_header_left_margin"/>
|
<spacer name="horizontalSpacer_4">
|
||||||
</item>
|
<property name="orientation">
|
||||||
<item row="3" column="1">
|
<enum>Qt::Horizontal</enum>
|
||||||
<widget class="QSpinBox" name="m_header_bottom_margin"/>
|
</property>
|
||||||
</item>
|
<property name="sizeHint" stdset="0">
|
||||||
<item row="1" column="1">
|
<size>
|
||||||
<widget class="QSpinBox" name="m_header_top_margin"/>
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
|
<widget class="QSpinBox" name="m_header_left_margin">
|
||||||
|
<property name="suffix">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="prefix">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QSpinBox" name="m_header_top_margin"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Marge</string>
|
<string>Marge</string>
|
||||||
@@ -94,9 +247,25 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="2" column="3">
|
||||||
<widget class="QSpinBox" name="m_header_right_margin"/>
|
<widget class="QSpinBox" name="m_header_right_margin"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QSpinBox" name="m_header_bottom_margin"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -114,6 +283,19 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_7">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -142,6 +324,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_8">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -150,6 +345,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Police</string>
|
<string>Police</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -163,19 +361,32 @@
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="1" column="2">
|
<item row="2" column="2">
|
||||||
<widget class="QSpinBox" name="m_table_right_margin"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QSpinBox" name="m_table_top_margin"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QSpinBox" name="m_table_bottom_margin"/>
|
<widget class="QSpinBox" name="m_table_bottom_margin"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QSpinBox" name="m_table_left_margin"/>
|
<widget class="QSpinBox" name="m_table_left_margin"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="2">
|
||||||
|
<widget class="QSpinBox" name="m_table_top_margin"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QSpinBox" name="m_table_right_margin"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Marge</string>
|
<string>Marge</string>
|
||||||
@@ -185,6 +396,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -202,6 +426,19 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_9">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -230,6 +467,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_10">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -238,6 +488,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Police</string>
|
<string>Police</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -282,6 +535,8 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="../../../../qelectrotech.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ NomenclatureModelPropertiesWidget::NomenclatureModelPropertiesWidget(Nomenclatur
|
|||||||
ui(new Ui::NomenclatureModelPropertiesWidget)
|
ui(new Ui::NomenclatureModelPropertiesWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
if (model) {
|
setModel(model);
|
||||||
setModel(model);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,6 +49,8 @@ NomenclatureModelPropertiesWidget::~NomenclatureModelPropertiesWidget() {
|
|||||||
*/
|
*/
|
||||||
void NomenclatureModelPropertiesWidget::setModel(NomenclatureModel *model) {
|
void NomenclatureModelPropertiesWidget::setModel(NomenclatureModel *model) {
|
||||||
m_model = model;
|
m_model = model;
|
||||||
|
ui->m_edit_query_pb->setEnabled(m_model);
|
||||||
|
ui->m_refresh_pb->setEnabled(m_model);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user