mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Add QetGraphicsTableItem + entry "add nomenclature" in project menu
This commit is contained in:
parent
336887b394
commit
fd2c210f49
@ -77,7 +77,9 @@ TEMPLATE = app
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += sources \
|
||||
sources/titleblock \
|
||||
sources/ui sources/qetgraphicsitem \
|
||||
sources/ui \
|
||||
sources/qetgraphicsitem \
|
||||
sources/qetgraphicsitem/ViewItem \
|
||||
sources/richtext \
|
||||
sources/factory \
|
||||
sources/properties \
|
||||
@ -85,7 +87,7 @@ INCLUDEPATH += sources \
|
||||
sources/editor \
|
||||
sources/editor/esevent \
|
||||
sources/editor/graphicspart \
|
||||
sources/editor/ui \
|
||||
sources/editor/ui \
|
||||
sources/undocommand \
|
||||
sources/diagramevent \
|
||||
sources/ElementsCollection \
|
||||
@ -93,12 +95,12 @@ INCLUDEPATH += sources \
|
||||
sources/autoNum \
|
||||
sources/autoNum/ui \
|
||||
sources/ui/configpage \
|
||||
sources/SearchAndReplace \
|
||||
sources/SearchAndReplace/ui \
|
||||
sources/NameList \
|
||||
sources/NameList/ui \
|
||||
sources/utils \
|
||||
sources/pugixml
|
||||
sources/SearchAndReplace \
|
||||
sources/SearchAndReplace/ui \
|
||||
sources/NameList \
|
||||
sources/NameList/ui \
|
||||
sources/utils \
|
||||
sources/pugixml \
|
||||
|
||||
|
||||
# Fichiers sources
|
||||
@ -107,6 +109,7 @@ HEADERS += $$files(sources/*.h) $$files(sources/ui/*.h) \
|
||||
$$files(sources/titleblock/*.h) \
|
||||
$$files(sources/richtext/*.h) \
|
||||
$$files(sources/qetgraphicsitem/*.h) \
|
||||
$$files(sources/qetgraphicsitem/ViewItem/*.h) \
|
||||
$$files(sources/factory/*.h) \
|
||||
$$files(sources/properties/*.h) \
|
||||
$$files(sources/editor/ui/*.h) \
|
||||
@ -133,6 +136,7 @@ SOURCES += $$files(sources/*.cpp) \
|
||||
$$files(sources/richtext/*.cpp) \
|
||||
$$files(sources/ui/*.cpp) \
|
||||
$$files(sources/qetgraphicsitem/*.cpp) \
|
||||
$$files(sources/qetgraphicsitem/ViewItem/*.cpp) \
|
||||
$$files(sources/factory/*.cpp) \
|
||||
$$files(sources/properties/*.cpp) \
|
||||
$$files(sources/editor/ui/*.cpp) \
|
||||
|
@ -59,8 +59,8 @@ void QetGraphicsHandlerItem::setColor(QColor color)
|
||||
*/
|
||||
void QetGraphicsHandlerItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
|
||||
painter->save();
|
||||
painter->setBrush(QBrush(m_color));
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "dialogwaiting.h"
|
||||
#include "addelementtextcommand.h"
|
||||
#include "conductornumexport.h"
|
||||
#include "qetgraphicstableitem.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QStandardPaths>
|
||||
@ -400,6 +401,14 @@ void QETDiagramEditor::setUpActions()
|
||||
bom.exec();
|
||||
});
|
||||
|
||||
//Add a nomenclature item
|
||||
m_add_nomenclature = new QAction(QET::Icons::TableOfContent, tr("Ajouter une nomenclature"),this);
|
||||
connect(m_add_nomenclature, &QAction::triggered, [this]() {
|
||||
if(this->currentDiagramView()) {
|
||||
this->currentDiagramView()->diagram()->addItem(new QetGraphicsTableItem());
|
||||
}
|
||||
});
|
||||
|
||||
//Lauch the plugin of terminal generator
|
||||
m_project_terminalBloc = new QAction(QET::Icons::TerminalStrip, tr("Lancer le plugin de création de borniers"), this);
|
||||
connect(m_project_terminalBloc, &QAction::triggered, this, &QETDiagramEditor::generateTerminalBlock);
|
||||
@ -755,6 +764,7 @@ void QETDiagramEditor::setUpMenu() {
|
||||
menu_project -> addAction(m_clean_project);
|
||||
menu_project -> addSeparator();
|
||||
menu_project -> addAction(m_project_folio_list);
|
||||
menu_project -> addAction(m_add_nomenclature);
|
||||
menu_project -> addAction(m_csv_export);
|
||||
menu_project -> addAction(m_project_export_conductor_num);
|
||||
menu_project -> addAction(m_project_terminalBloc);
|
||||
@ -1438,7 +1448,8 @@ void QETDiagramEditor::slot_updateActions()
|
||||
m_project_add_diagram -> setEnabled(editable_project);
|
||||
m_remove_diagram_from_project -> setEnabled(editable_project);
|
||||
m_clean_project -> setEnabled(editable_project);
|
||||
m_project_folio_list -> setEnabled(opened_project);
|
||||
m_project_folio_list -> setEnabled(editable_project);
|
||||
m_add_nomenclature->setEnabled(editable_project);
|
||||
m_csv_export -> setEnabled(editable_project);
|
||||
m_export_diagram -> setEnabled(opened_diagram);
|
||||
m_print -> setEnabled(opened_diagram);
|
||||
|
@ -184,6 +184,7 @@ class QETDiagramEditor : public QETMainWindow
|
||||
QAction *m_clean_project; ///< Clean the content of the curent project by removing useless items
|
||||
QAction *m_project_folio_list; ///< Sommaire des schemas
|
||||
QAction *m_csv_export; ///< generate nomenclature
|
||||
QAction *m_add_nomenclature; ///< Add nomenclature graphics item;
|
||||
QAction *m_project_terminalBloc; ///< generate terminal block
|
||||
QAction *m_project_export_conductor_num; ///<Export the wire num to csv
|
||||
QAction *m_tile_window; ///< Show MDI subwindows as tile
|
||||
|
360
sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp
Normal file
360
sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp
Normal file
@ -0,0 +1,360 @@
|
||||
/*
|
||||
Copyright 2006-2019 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 "qetgraphicstableitem.h"
|
||||
#include "diagram.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QFontMetrics>
|
||||
#include <algorithm>
|
||||
#include <QPainter>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::QetGraphicsTableItem
|
||||
* Default constructor
|
||||
* @param parent
|
||||
*/
|
||||
QetGraphicsTableItem::QetGraphicsTableItem(QGraphicsItem *parent) :
|
||||
QetGraphicsItem(parent)
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
setAcceptHoverEvents(true);
|
||||
setUpHandler();
|
||||
|
||||
m_margin = QMargins(5,3,15,3);
|
||||
//A litle bounding rect before model is set,
|
||||
//then user can already grab this item, even if model is not already set
|
||||
m_bounding_rect.setRect(m_br_margin/-2, m_br_margin/-2, 50, 50);
|
||||
|
||||
connect(this, &QetGraphicsTableItem::xChanged, this, &QetGraphicsTableItem::adjustHandlerPos);
|
||||
connect(this, &QetGraphicsTableItem::yChanged, this, &QetGraphicsTableItem::adjustHandlerPos);
|
||||
|
||||
|
||||
|
||||
/*******ONLY FOR TEST DURING DEVEL*********/
|
||||
auto model = new QStandardItemModel(this);
|
||||
int r = 10;
|
||||
int c = 5;
|
||||
|
||||
for (int row = 0; row < r; ++row)
|
||||
{
|
||||
for (int column = 0; column < c; ++column) {
|
||||
QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column));
|
||||
model->setItem(row, column, item);
|
||||
}
|
||||
}
|
||||
this->setModel(model);
|
||||
this->setPos(50,50);
|
||||
}
|
||||
|
||||
QetGraphicsTableItem::~QetGraphicsTableItem()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::setModel
|
||||
* Set the model presented by this item.
|
||||
* Since QetGraphicsTableItem don't take ownership of model,
|
||||
* if item already have a model, it's your responsibility to delete it.
|
||||
* @param model
|
||||
*/
|
||||
void QetGraphicsTableItem::setModel(QAbstractItemModel *model)
|
||||
{
|
||||
m_model = model;
|
||||
modelReseted();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::model
|
||||
* @return The model that this item is presenting
|
||||
*/
|
||||
QAbstractItemModel *QetGraphicsTableItem::model() const {
|
||||
return m_model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::boundingRect
|
||||
* Reimplemented from QGraphicsObject
|
||||
* @return
|
||||
*/
|
||||
QRectF QetGraphicsTableItem::boundingRect() const {
|
||||
return m_bounding_rect;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::paint
|
||||
* Draw the table
|
||||
* @param painter
|
||||
* @param option
|
||||
* @param widget
|
||||
*/
|
||||
void QetGraphicsTableItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
|
||||
painter->save();
|
||||
|
||||
QPen pen;
|
||||
pen.setWidthF(0.7);
|
||||
pen.setColor(Qt::black);
|
||||
painter->setPen(pen);
|
||||
painter->setFont(m_font);
|
||||
|
||||
painter->drawRect(m_current_rect);
|
||||
|
||||
if(!m_model)
|
||||
{
|
||||
painter->restore();
|
||||
return;
|
||||
}
|
||||
|
||||
//Draw vertical lines
|
||||
auto offset= 0;
|
||||
for(auto size : m_current_column_width)
|
||||
{
|
||||
QPointF p1(offset+size, m_current_rect.top());
|
||||
QPointF p2(offset+size, m_current_rect.bottom());
|
||||
painter->drawLine(p1, p2);
|
||||
offset += size;
|
||||
}
|
||||
|
||||
//Draw horizontal lines
|
||||
auto cell_height = m_current_rect.height()/m_model->rowCount();
|
||||
for(auto i= 1 ; i-1<m_model->rowCount() ; ++i)
|
||||
{
|
||||
QPointF p1(m_current_rect.left(), cell_height*i);
|
||||
QPointF p2(m_current_rect.right(), cell_height*i);
|
||||
painter->drawLine(p1, p2);
|
||||
}
|
||||
|
||||
//Write text of each cell
|
||||
for (auto i= 0 ; i<m_model->rowCount() ; ++i)
|
||||
{
|
||||
QPointF top_left(m_margin.left(), i==0? 0 : cell_height*i);
|
||||
|
||||
for(auto j= 0 ; j<m_model->columnCount() ; ++j)
|
||||
{
|
||||
//In first iteration the top left X is margin left, in all other iteration the top left X is stored in m_column_size
|
||||
if (j>0) {
|
||||
top_left.setX(top_left.x() + m_current_column_width.at(j-1));
|
||||
}
|
||||
QSize size(m_current_column_width.at(j)/* - m_margin.left() - m_margin.right()*/,
|
||||
cell_height - m_margin.top() - m_margin.bottom());
|
||||
painter->drawText(QRectF(top_left, size), Qt::AlignVCenter|Qt::AlignLeft, m_model->index(i, j).data().toString());
|
||||
}
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::hoverEnterEvent
|
||||
* Reimplemented from QetGraphicsItem
|
||||
* @param event
|
||||
*/
|
||||
void QetGraphicsTableItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
adjustHandlerPos();
|
||||
this->scene()->addItem(&m_handler_item);
|
||||
m_handler_item.installSceneEventFilter(this);
|
||||
QGraphicsObject::hoverEnterEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::hoverLeaveEvent
|
||||
* Reimplemented from QetGraphicsItem
|
||||
* @param event
|
||||
*/
|
||||
void QetGraphicsTableItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
m_handler_item.scene()->removeItem(&m_handler_item);
|
||||
QGraphicsObject::hoverLeaveEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::sceneEventFilter
|
||||
* Reimplemented from QetGraphicsItem
|
||||
* @param watched
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
bool QetGraphicsTableItem::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
||||
{
|
||||
if (watched == &m_handler_item)
|
||||
{
|
||||
if(event->type() == QEvent::GraphicsSceneMousePress) //Click
|
||||
{
|
||||
handlerMousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
|
||||
return true;
|
||||
}
|
||||
else if(event->type() == QEvent::GraphicsSceneMouseMove) //Move
|
||||
{
|
||||
handlerMouseMoveEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
|
||||
return true;
|
||||
}
|
||||
else if (event->type() == QEvent::GraphicsSceneMouseRelease) //Release
|
||||
{
|
||||
handlerMouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::modelReseted
|
||||
* Called when the model is reseted
|
||||
*/
|
||||
void QetGraphicsTableItem::modelReseted()
|
||||
{
|
||||
preProcess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::preProcess
|
||||
* Make all post process needed befor painting
|
||||
*/
|
||||
void QetGraphicsTableItem::preProcess()
|
||||
{
|
||||
setUpColumnAndRowMinimumSize();
|
||||
setUpBoundingRect();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::setUpColumnAndRowMinimumSize
|
||||
* Calcule the minimum row height and the minimum column width for each columns
|
||||
*/
|
||||
void QetGraphicsTableItem::setUpColumnAndRowMinimumSize()
|
||||
{
|
||||
if (!m_model) {
|
||||
return;
|
||||
}
|
||||
|
||||
QFontMetrics metrics(m_font);
|
||||
//Set the height of row;
|
||||
m_row_height = metrics.boundingRect("HEIGHT TEST").height() + m_margin.top() + m_margin.bottom();
|
||||
|
||||
m_minimum_column_width.clear();
|
||||
m_minimum_column_width.resize(m_model->columnCount());
|
||||
|
||||
//Get the maximum width of each columns
|
||||
for (auto i= 0 ; i<m_model->rowCount() ; ++i)
|
||||
{
|
||||
for(auto j= 0 ; j<m_model->columnCount() ; ++j)
|
||||
{
|
||||
auto index = m_model->index(i, j);
|
||||
auto width = metrics.boundingRect(index.data().toString()).width();
|
||||
m_minimum_column_width.replace(j, std::max(m_minimum_column_width.at(j), width+m_margin.left() + m_margin.right()));
|
||||
}
|
||||
}
|
||||
|
||||
//Set the minimum size of the table
|
||||
m_minimum_rect.setTopLeft(QPoint(0,0));
|
||||
m_minimum_rect.setWidth(0);
|
||||
for (auto cw : m_minimum_column_width) {
|
||||
m_minimum_rect.setWidth(m_minimum_rect.width()+cw);
|
||||
}
|
||||
m_minimum_rect.setHeight(m_row_height*m_model->rowCount());
|
||||
m_current_column_width = m_minimum_column_width;
|
||||
m_current_rect = m_minimum_rect;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::setUpBoundingRect
|
||||
*/
|
||||
void QetGraphicsTableItem::setUpBoundingRect() {
|
||||
m_bounding_rect = m_current_rect.adjusted(-m_br_margin, -m_br_margin, m_br_margin, m_br_margin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::adjustHandlerPos
|
||||
* Adjust the pos of the handler item
|
||||
*/
|
||||
void QetGraphicsTableItem::adjustHandlerPos()
|
||||
{
|
||||
if(m_handler_item.scene()) {
|
||||
m_handler_item.setPos(mapToScene(m_current_rect.bottomRight()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::setUpHandler
|
||||
*/
|
||||
void QetGraphicsTableItem::setUpHandler()
|
||||
{
|
||||
m_handler_item.setColor(Qt::blue);
|
||||
m_handler_item.setZValue(this->zValue() + 1);
|
||||
}
|
||||
|
||||
void QetGraphicsTableItem::handlerMousePressEvent(QGraphicsSceneMouseEvent *event) {
|
||||
Q_UNUSED(event)
|
||||
}
|
||||
|
||||
void QetGraphicsTableItem::handlerMouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
QPointF new_handler_pos = event->scenePos();
|
||||
if (event->modifiers() != Qt::ControlModifier) {
|
||||
new_handler_pos = Diagram::snapToGrid(event->scenePos());
|
||||
}
|
||||
QSize size = QRectF(m_current_rect.topLeft(), mapFromScene(new_handler_pos)).size().toSize();
|
||||
|
||||
m_handler_item.setPos(mapToScene(std::max(m_minimum_rect.width(), size.width()),
|
||||
std::max(m_minimum_rect.height(), size.height())));
|
||||
|
||||
QRect new_rect(QPoint(0,0), mapFromScene(m_handler_item.scenePos()).toPoint());
|
||||
|
||||
if (new_rect != m_current_rect)
|
||||
{
|
||||
m_current_rect = new_rect;
|
||||
adjustColumnsWidth();
|
||||
}
|
||||
}
|
||||
|
||||
void QetGraphicsTableItem::handlerMouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
m_current_rect.setBottomRight(mapFromScene(m_handler_item.scenePos()).toPoint());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsTableItem::adjustColumnsWidth
|
||||
* Adjust the size of each column according to the current table width
|
||||
*/
|
||||
void QetGraphicsTableItem::adjustColumnsWidth()
|
||||
{
|
||||
m_current_column_width = m_minimum_column_width;
|
||||
|
||||
//Get the minimum width of table
|
||||
auto minimum_width= 0;
|
||||
for(auto w : m_minimum_column_width) {
|
||||
minimum_width += w;
|
||||
}
|
||||
|
||||
auto a = m_current_rect.width() - minimum_width;
|
||||
auto b = a/m_model->columnCount();
|
||||
for(auto i= 0 ; i<m_current_column_width.size() ; ++i) {
|
||||
m_current_column_width.replace(i, m_current_column_width.at(i) + b);
|
||||
}
|
||||
|
||||
prepareGeometryChange();
|
||||
setUpBoundingRect();
|
||||
}
|
75
sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.h
Normal file
75
sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.h
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
Copyright 2006-2019 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 QetGraphicsTableItem_H
|
||||
#define QetGraphicsTableItem_H
|
||||
|
||||
#include <QFont>
|
||||
|
||||
#include "qetgraphicsitem.h"
|
||||
#include "qetapp.h"
|
||||
#include "QetGraphicsItemModeler/qetgraphicshandleritem.h"
|
||||
|
||||
class QAbstractItemModel;
|
||||
|
||||
class QetGraphicsTableItem : public QetGraphicsItem
|
||||
{
|
||||
public:
|
||||
QetGraphicsTableItem(QGraphicsItem *parent= nullptr);
|
||||
virtual ~QetGraphicsTableItem() override;
|
||||
|
||||
void setModel(QAbstractItemModel *model);
|
||||
QAbstractItemModel *model() const;
|
||||
virtual QRectF boundingRect() const override;
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||
|
||||
protected:
|
||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
void modelReseted();
|
||||
void preProcess();
|
||||
void setUpColumnAndRowMinimumSize();
|
||||
void setUpBoundingRect();
|
||||
void adjustHandlerPos();
|
||||
void setUpHandler();
|
||||
void handlerMousePressEvent (QGraphicsSceneMouseEvent *event);
|
||||
void handlerMouseMoveEvent (QGraphicsSceneMouseEvent *event);
|
||||
void handlerMouseReleaseEvent (QGraphicsSceneMouseEvent *event);
|
||||
void adjustColumnsWidth();
|
||||
|
||||
private:
|
||||
QAbstractItemModel *m_model= nullptr;
|
||||
QFont m_font = QETApp::diagramTextsFont();
|
||||
|
||||
QVector<int> m_minimum_column_width,
|
||||
m_current_column_width;
|
||||
|
||||
int m_row_height;
|
||||
QMargins m_margin;
|
||||
QRect m_minimum_rect,
|
||||
m_current_rect;
|
||||
|
||||
QRectF m_bounding_rect;
|
||||
int m_br_margin= 10;
|
||||
|
||||
QetGraphicsHandlerItem m_handler_item;
|
||||
};
|
||||
|
||||
#endif // QetGraphicsTableItem_H
|
@ -275,9 +275,6 @@ QPainterPath QetShapeItem::shape() const
|
||||
path.closeSubpath();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
QPainterPathStroker pps;
|
||||
@ -297,7 +294,8 @@ QPainterPath QetShapeItem::shape() const
|
||||
*/
|
||||
void QetShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option); Q_UNUSED(widget);
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
|
||||
painter->save();
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
@ -697,8 +695,8 @@ void QetShapeItem::removePoint()
|
||||
*/
|
||||
void QetShapeItem::handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(qghi);
|
||||
Q_UNUSED(event);
|
||||
Q_UNUSED(qghi)
|
||||
Q_UNUSED(event)
|
||||
|
||||
m_old_P1 = m_P1;
|
||||
m_old_P2 = m_P2;
|
||||
@ -717,7 +715,7 @@ void QetShapeItem::handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphic
|
||||
*/
|
||||
void QetShapeItem::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(qghi);
|
||||
Q_UNUSED(qghi)
|
||||
|
||||
QPointF new_pos = event->scenePos();
|
||||
if (event->modifiers() != Qt::ControlModifier)
|
||||
|
Loading…
x
Reference in New Issue
Block a user