mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 18:50:52 +01:00
Apply clang-tidy's modernize-use-auto
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5449 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -47,9 +47,9 @@ ArcEditor::ArcEditor(QETElementEditor *editor, PartArc *arc, QWidget *parent) :
|
||||
h->setRange(-5000, 5000);
|
||||
v->setRange(-5000, 5000);
|
||||
|
||||
QVBoxLayout *v_layout = new QVBoxLayout(this);
|
||||
auto *v_layout = new QVBoxLayout(this);
|
||||
|
||||
QGridLayout *grid = new QGridLayout();
|
||||
auto *grid = new QGridLayout();
|
||||
grid -> addWidget(new QLabel(tr("Centre : ")), 0, 0);
|
||||
grid -> addWidget(new QLabel("x"), 1, 0, Qt::AlignRight);
|
||||
grid -> addWidget(x, 1, 1);
|
||||
@@ -99,7 +99,7 @@ bool ArcEditor::setPart(CustomElementPart *new_part)
|
||||
return(true);
|
||||
}
|
||||
|
||||
if (PartArc *part_arc = dynamic_cast<PartArc *>(new_part))
|
||||
if (auto *part_arc = dynamic_cast<PartArc *>(new_part))
|
||||
{
|
||||
if (part == part_arc) return true;
|
||||
if (part)
|
||||
|
||||
@@ -122,7 +122,7 @@ void ElementPrimitiveDecorator::setItems(const QList<QGraphicsItem *> &items)
|
||||
QList<CustomElementPart *> primitives;
|
||||
for(QGraphicsItem *item : items)
|
||||
{
|
||||
if (CustomElementPart *part_item = dynamic_cast<CustomElementPart *>(item))
|
||||
if (auto *part_item = dynamic_cast<CustomElementPart *>(item))
|
||||
{
|
||||
primitives << part_item;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ QList<CustomElementPart *> ElementPrimitiveDecorator::items() const {
|
||||
QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const {
|
||||
QList<QGraphicsItem *> list;
|
||||
foreach (CustomElementPart *part_item, decorated_items_) {
|
||||
if (QGraphicsItem *item = dynamic_cast<QGraphicsItem *>(part_item)) {
|
||||
if (auto *item = dynamic_cast<QGraphicsItem *>(part_item)) {
|
||||
list << item;
|
||||
}
|
||||
}
|
||||
@@ -555,7 +555,7 @@ void ElementPrimitiveDecorator::handlerMouseReleaseEvent(QetGraphicsHandlerItem
|
||||
ElementEditionCommand *command = nullptr;
|
||||
if (current_operation_square_ > QET::NoOperation)
|
||||
{
|
||||
ScalePartsCommand *scale_command = new ScalePartsCommand();
|
||||
auto *scale_command = new ScalePartsCommand();
|
||||
scale_command -> setScaledPrimitives(items());
|
||||
scale_command -> setTransformation(
|
||||
mapToScene(original_bounding_rect_).boundingRect(),
|
||||
@@ -717,7 +717,7 @@ bool ElementPrimitiveDecorator::sceneEventFilter(QGraphicsItem *watched, QEvent
|
||||
//Watched must be an handler
|
||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||
{
|
||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
|
||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||
{
|
||||
|
||||
@@ -416,7 +416,7 @@ const QDomDocument ElementScene::toXml(bool all_parts)
|
||||
{
|
||||
//If the export concerns only the selection, the not selected part is ignored
|
||||
if (!all_parts && !qgi -> isSelected()) continue;
|
||||
if (CustomElementPart *ce = dynamic_cast<CustomElementPart *>(qgi))
|
||||
if (auto *ce = dynamic_cast<CustomElementPart *>(qgi))
|
||||
{
|
||||
if (ce -> isUseless()) continue;
|
||||
description.appendChild(ce -> toXml(xml_document));
|
||||
@@ -492,7 +492,7 @@ QRectF ElementScene::elementSceneGeometricRect() const{
|
||||
if (qgi->type() == ElementPrimitiveDecorator::Type) continue;
|
||||
if (qgi->type() == QGraphicsRectItem::Type) continue;
|
||||
if (qgi->type() == PartDynamicTextField::Type) continue;
|
||||
if (CustomElementPart *cep = dynamic_cast <CustomElementPart*> (qgi)) {
|
||||
if (auto *cep = dynamic_cast <CustomElementPart*> (qgi)) {
|
||||
esgr |= cep -> sceneGeometricRect();
|
||||
}
|
||||
}
|
||||
@@ -675,7 +675,7 @@ void ElementScene::slot_editAuthorInformations() {
|
||||
#endif
|
||||
dialog_author.setMinimumSize(400, 260);
|
||||
dialog_author.setWindowTitle(tr("Éditer les informations sur l'auteur", "window title"));
|
||||
QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog_author);
|
||||
auto *dialog_layout = new QVBoxLayout(&dialog_author);
|
||||
|
||||
// ajoute un champ explicatif au dialogue
|
||||
QLabel *information_label = new QLabel(tr("Vous pouvez utiliser ce champ libre pour mentionner les auteurs de l'élément, sa licence, ou tout autre renseignement que vous jugerez utile."));
|
||||
@@ -684,7 +684,7 @@ void ElementScene::slot_editAuthorInformations() {
|
||||
dialog_layout -> addWidget(information_label);
|
||||
|
||||
// ajoute un QTextEdit au dialogue
|
||||
QTextEdit *text_field = new QTextEdit();
|
||||
auto *text_field = new QTextEdit();
|
||||
text_field -> setAcceptRichText(false);
|
||||
text_field -> setPlainText(informations());
|
||||
text_field -> setReadOnly(is_read_only);
|
||||
@@ -738,7 +738,7 @@ void ElementScene::slot_editNames() {
|
||||
dialog.setModal(true);
|
||||
dialog.setMinimumSize(400, 330);
|
||||
dialog.setWindowTitle(tr("Éditer les noms", "window title"));
|
||||
QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog);
|
||||
auto *dialog_layout = new QVBoxLayout(&dialog);
|
||||
|
||||
// ajoute un champ explicatif au dialogue
|
||||
QLabel *information_label = new QLabel(tr("Vous pouvez spécifier le nom de l'élément dans plusieurs langues."));
|
||||
@@ -747,7 +747,7 @@ void ElementScene::slot_editNames() {
|
||||
dialog_layout -> addWidget(information_label);
|
||||
|
||||
// ajoute un NamesListWidget au dialogue
|
||||
NamesListWidget *names_widget = new NamesListWidget();
|
||||
auto *names_widget = new NamesListWidget();
|
||||
names_widget -> setNames(m_names_list);
|
||||
names_widget -> setReadOnly(is_read_only);
|
||||
dialog_layout -> addWidget(names_widget);
|
||||
@@ -772,7 +772,7 @@ void ElementScene::slot_editNames() {
|
||||
QList<CustomElementPart *> ElementScene::primitives() const {
|
||||
QList<CustomElementPart *> primitives_list;
|
||||
foreach (QGraphicsItem *item, items()) {
|
||||
if (CustomElementPart *primitive = dynamic_cast<CustomElementPart *>(item)) {
|
||||
if (auto *primitive = dynamic_cast<CustomElementPart *>(item)) {
|
||||
primitives_list << primitive;
|
||||
}
|
||||
}
|
||||
@@ -1001,7 +1001,7 @@ ElementContent ElementScene::loadContent(const QDomDocument &xml_document)
|
||||
else if (qde.tagName() == "input") cep = pdtf = new PartDynamicTextField(m_element_editor);
|
||||
else continue;
|
||||
|
||||
if (QGraphicsItem *qgi = dynamic_cast<QGraphicsItem *>(cep))
|
||||
if (auto *qgi = dynamic_cast<QGraphicsItem *>(cep))
|
||||
{
|
||||
if (!qgi->zValue())
|
||||
qgi->setZValue(z++);
|
||||
@@ -1180,7 +1180,7 @@ void ElementScene::stackAction(ElementEditionCommand *command) {
|
||||
|
||||
if (!command -> elementView()) {
|
||||
foreach (QGraphicsView *view, views()) {
|
||||
if (ElementView *element_view = dynamic_cast<ElementView *>(view)) {
|
||||
if (auto *element_view = dynamic_cast<ElementView *>(view)) {
|
||||
command -> setElementView(element_view);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ ElementContent ElementView::paste(const QDomDocument &xml_document, const QPoint
|
||||
// si quelque chose a effectivement ete ajoute au schema, on cree un objet d'annulation
|
||||
if (content_pasted.count()) {
|
||||
m_scene -> clearSelection();
|
||||
PastePartsCommand *undo_object = new PastePartsCommand(this, content_pasted);
|
||||
auto *undo_object = new PastePartsCommand(this, content_pasted);
|
||||
m_scene -> undoStack().push(undo_object);
|
||||
}
|
||||
return(content_pasted);
|
||||
@@ -343,7 +343,7 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
|
||||
// si quelque chose a effectivement ete ajoute au schema, on cree un objet d'annulation
|
||||
if (content_pasted.count()) {
|
||||
m_scene -> clearSelection();
|
||||
PastePartsCommand *undo_object = new PastePartsCommand(this, content_pasted);
|
||||
auto *undo_object = new PastePartsCommand(this, content_pasted);
|
||||
undo_object -> setOffset(offset_paste_count_ - 1, old_start_top_left_corner, offset_paste_count_, start_top_left_corner_);
|
||||
m_scene -> undoStack().push(undo_object);
|
||||
}
|
||||
@@ -446,7 +446,7 @@ bool ElementView::event(QEvent *e) {
|
||||
*/
|
||||
bool ElementView::gestureEvent(QGestureEvent *event){
|
||||
if (QGesture *gesture = event->gesture(Qt::PinchGesture)) {
|
||||
QPinchGesture *pinch = static_cast<QPinchGesture *>(gesture);
|
||||
auto *pinch = static_cast<QPinchGesture *>(gesture);
|
||||
if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged){
|
||||
qreal value = gesture->property("scaleFactor").toReal();
|
||||
if (value > 1){
|
||||
@@ -515,9 +515,9 @@ void ElementView::drawBackground(QPainter *p, const QRectF &r) {
|
||||
qreal limite_x = r.x() + r.width();
|
||||
qreal limite_y = r.y() + r.height();
|
||||
|
||||
int g_x = (int)ceil(r.x());
|
||||
auto g_x = (int)ceil(r.x());
|
||||
while (g_x % drawn_x_grid) ++ g_x;
|
||||
int g_y = (int)ceil(r.y());
|
||||
auto g_y = (int)ceil(r.y());
|
||||
while (g_y % drawn_y_grid) ++ g_y;
|
||||
|
||||
for (int gx = g_x ; gx < limite_x ; gx += drawn_x_grid) {
|
||||
|
||||
@@ -44,9 +44,9 @@ EllipseEditor::EllipseEditor(QETElementEditor *editor, PartEllipse *ellipse, QWi
|
||||
h->setRange(-5000, 5000);
|
||||
v->setRange(-5000, 5000);
|
||||
|
||||
QVBoxLayout *v_layout = new QVBoxLayout(this);
|
||||
auto *v_layout = new QVBoxLayout(this);
|
||||
|
||||
QGridLayout *grid = new QGridLayout();
|
||||
auto *grid = new QGridLayout();
|
||||
grid -> addWidget(new QLabel(tr("Centre : ")), 0, 0);
|
||||
grid -> addWidget(new QLabel("x"), 1, 0, Qt::AlignRight);
|
||||
grid -> addWidget(x, 1, 1);
|
||||
@@ -88,7 +88,7 @@ bool EllipseEditor::setPart(CustomElementPart *new_part)
|
||||
style_ -> setPart(nullptr);
|
||||
return(true);
|
||||
}
|
||||
if (PartEllipse *part_ellipse = dynamic_cast<PartEllipse *>(new_part))
|
||||
if (auto *part_ellipse = dynamic_cast<PartEllipse *>(new_part))
|
||||
{
|
||||
if (part == part_ellipse) return true;
|
||||
if (part)
|
||||
|
||||
@@ -218,7 +218,7 @@ bool PartArc::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
||||
//Watched must be an handler
|
||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||
{
|
||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
|
||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||
{
|
||||
|
||||
@@ -214,7 +214,7 @@ bool PartEllipse::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
||||
//Watched must be an handler
|
||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||
{
|
||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
|
||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||
{
|
||||
|
||||
@@ -190,7 +190,7 @@ bool PartLine::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
||||
//Watched must be an handler
|
||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||
{
|
||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
|
||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||
{
|
||||
|
||||
@@ -308,7 +308,7 @@ bool PartPolygon::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
||||
//Watched must be an handler
|
||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||
{
|
||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
|
||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||
{
|
||||
|
||||
@@ -322,7 +322,7 @@ bool PartRectangle::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
||||
//Watched must be an handler
|
||||
if(watched->type() == QetGraphicsHandlerItem::Type)
|
||||
{
|
||||
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
|
||||
|
||||
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent
|
||||
end1_length = new QDoubleSpinBox();
|
||||
end2_length = new QDoubleSpinBox();
|
||||
|
||||
QGridLayout *grid = new QGridLayout();
|
||||
auto *grid = new QGridLayout();
|
||||
grid -> addWidget(new QLabel("x1"), 0, 0);
|
||||
grid -> addWidget(x1, 0, 1);
|
||||
grid -> addWidget(new QLabel("y1"), 0, 2);
|
||||
@@ -72,7 +72,7 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent
|
||||
grid -> addWidget(new QLabel("y2"), 1, 2);
|
||||
grid -> addWidget(y2, 1, 3);
|
||||
|
||||
QGridLayout *grid2 = new QGridLayout();
|
||||
auto *grid2 = new QGridLayout();
|
||||
grid2 -> addWidget(new QLabel(tr("Fin 1")), 0, 0);
|
||||
grid2 -> addWidget(end1_type, 0, 1);
|
||||
grid2 -> addWidget(end1_length, 0, 2);
|
||||
@@ -80,7 +80,7 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent
|
||||
grid2 -> addWidget(end2_type, 1, 1);
|
||||
grid2 -> addWidget(end2_length, 1, 2);
|
||||
|
||||
QVBoxLayout *v_layout = new QVBoxLayout(this);
|
||||
auto *v_layout = new QVBoxLayout(this);
|
||||
v_layout -> addWidget(style_);
|
||||
v_layout -> addLayout(grid);
|
||||
v_layout -> addLayout(grid2);
|
||||
@@ -115,7 +115,7 @@ bool LineEditor::setPart(CustomElementPart *new_part)
|
||||
style_ -> setPart(nullptr);
|
||||
return(true);
|
||||
}
|
||||
if (PartLine *part_line = dynamic_cast<PartLine *>(new_part))
|
||||
if (auto *part_line = dynamic_cast<PartLine *>(new_part))
|
||||
{
|
||||
if (part == part_line) return true;
|
||||
if (part)
|
||||
|
||||
@@ -45,7 +45,7 @@ PolygonEditor::PolygonEditor(QETElementEditor *editor, PartPolygon *p, QWidget *
|
||||
updateForm();
|
||||
|
||||
// layout
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
layout -> addWidget(style_);
|
||||
layout -> addWidget(new QLabel(tr("Points du polygone :")));
|
||||
layout -> addWidget(&points_list);
|
||||
@@ -106,7 +106,7 @@ void PolygonEditor::updateForm() {
|
||||
point = part -> mapToScene(point);
|
||||
QStringList qsl;
|
||||
qsl << QString("%1").arg(point.x()) << QString("%1").arg(point.y());
|
||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(qsl);
|
||||
auto *qtwi = new QTreeWidgetItem(qsl);
|
||||
qtwi -> setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
|
||||
points_list.addTopLevelItem(qtwi);
|
||||
}
|
||||
@@ -135,7 +135,7 @@ bool PolygonEditor::setPart(CustomElementPart *new_part)
|
||||
style_ -> setPart(nullptr);
|
||||
return(true);
|
||||
}
|
||||
if (PartPolygon *part_polygon = dynamic_cast<PartPolygon *>(new_part))
|
||||
if (auto *part_polygon = dynamic_cast<PartPolygon *>(new_part))
|
||||
{
|
||||
if (part == part_polygon) return true;
|
||||
if (part)
|
||||
|
||||
@@ -537,7 +537,7 @@ void QETElementEditor::setupInterface()
|
||||
m_undo_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||
m_undo_dock -> setMinimumWidth(290);
|
||||
addDockWidget(Qt::RightDockWidgetArea, m_undo_dock);
|
||||
QUndoView* undo_view = new QUndoView(&(m_elmt_scene -> undoStack()), this);
|
||||
auto* undo_view = new QUndoView(&(m_elmt_scene -> undoStack()), this);
|
||||
undo_view -> setEmptyLabel(tr("Aucune modification"));
|
||||
m_undo_dock -> setWidget(undo_view);
|
||||
|
||||
@@ -596,7 +596,7 @@ void QETElementEditor::slot_updateInformations()
|
||||
style_editable = true;
|
||||
foreach (QGraphicsItem *qgi, selected_qgis)
|
||||
{
|
||||
if (CustomElementPart *cep = dynamic_cast<CustomElementPart *>(qgi))
|
||||
if (auto *cep = dynamic_cast<CustomElementPart *>(qgi))
|
||||
cep_list << cep;
|
||||
else
|
||||
style_editable = false;
|
||||
@@ -609,11 +609,11 @@ void QETElementEditor::slot_updateInformations()
|
||||
if(selected_qgis.size() == 1)
|
||||
{
|
||||
QGraphicsItem *qgi = selected_qgis.first();
|
||||
if (CustomElementPart *selection = dynamic_cast<CustomElementPart *>(qgi))
|
||||
if (auto *selection = dynamic_cast<CustomElementPart *>(qgi))
|
||||
{
|
||||
if (QWidget *widget = m_tools_dock_stack->widget(1))
|
||||
{
|
||||
if (ElementItemEditor *editor = dynamic_cast<ElementItemEditor *>(widget))
|
||||
if (auto *editor = dynamic_cast<ElementItemEditor *>(widget))
|
||||
{
|
||||
if(editor->currentPart() == selection)
|
||||
return;
|
||||
@@ -626,11 +626,11 @@ void QETElementEditor::slot_updateInformations()
|
||||
if (selected_qgis.size() == 1)
|
||||
{
|
||||
QGraphicsItem *qgi = selected_qgis.first();
|
||||
if (CustomElementPart *selection = dynamic_cast<CustomElementPart *>(qgi))
|
||||
if (auto *selection = dynamic_cast<CustomElementPart *>(qgi))
|
||||
{
|
||||
//The current editor already edit the selected part
|
||||
if (QWidget *widget = m_tools_dock_stack->widget(1))
|
||||
if (ElementItemEditor *editor = dynamic_cast<ElementItemEditor *>(widget))
|
||||
if (auto *editor = dynamic_cast<ElementItemEditor *>(widget))
|
||||
if(editor->currentPart() == selection)
|
||||
return;
|
||||
|
||||
@@ -1065,7 +1065,7 @@ QString program = (QDir::homePath() + "/.qet/DXFtoQET.app");
|
||||
QString program = (QDir::homePath() + "/.qet/DXFtoQET");
|
||||
#endif
|
||||
QStringList arguments;
|
||||
QProcess *DXF = new QProcess(qApp);
|
||||
auto *DXF = new QProcess(qApp);
|
||||
DXF->start(program,arguments);
|
||||
|
||||
}
|
||||
@@ -1336,9 +1336,9 @@ void QETElementEditor::slot_createPartsList() {
|
||||
if (qgis.count() <= QET_MAX_PARTS_IN_ELEMENT_EDITOR_LIST) {
|
||||
for (int j = qgis.count() - 1 ; j >= 0 ; -- j) {
|
||||
QGraphicsItem *qgi = qgis[j];
|
||||
if (CustomElementPart *cep = dynamic_cast<CustomElementPart *>(qgi)) {
|
||||
if (auto *cep = dynamic_cast<CustomElementPart *>(qgi)) {
|
||||
QString part_desc = cep -> name();
|
||||
QListWidgetItem *qlwi = new QListWidgetItem(part_desc);
|
||||
auto *qlwi = new QListWidgetItem(part_desc);
|
||||
QVariant v;
|
||||
v.setValue<QGraphicsItem *>(qgi);
|
||||
qlwi -> setData(42, v);
|
||||
@@ -1382,7 +1382,7 @@ void QETElementEditor::slot_updateSelectionFromPartsList() {
|
||||
m_parts_list -> blockSignals(true);
|
||||
for (int i = 0 ; i < m_parts_list -> count() ; ++ i) {
|
||||
QListWidgetItem *qlwi = m_parts_list -> item(i);
|
||||
QGraphicsItem *qgi = qlwi -> data(42).value<QGraphicsItem *>();
|
||||
auto *qgi = qlwi -> data(42).value<QGraphicsItem *>();
|
||||
if (qgi) {
|
||||
qgi -> setSelected(qlwi -> isSelected());
|
||||
}
|
||||
@@ -1578,7 +1578,7 @@ void QETElementEditor::updateCurrentPartEditor() {
|
||||
if (!m_tools_dock_stack -> currentIndex()) return;
|
||||
|
||||
// s'il y a un widget d'edition affiche, on le met a jour
|
||||
if (ElementItemEditor *current_editor = dynamic_cast<ElementItemEditor *>(m_tools_dock_stack->widget(1))) {
|
||||
if (auto *current_editor = dynamic_cast<ElementItemEditor *>(m_tools_dock_stack->widget(1))) {
|
||||
current_editor -> updateForm();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
||||
|
||||
main_layout -> addWidget(new QLabel("<u>" + tr("Apparence :") + "</u> "));
|
||||
|
||||
QHBoxLayout *color_layout = new QHBoxLayout();
|
||||
auto *color_layout = new QHBoxLayout();
|
||||
color_layout -> addWidget(new QLabel(tr("Contour :")), 0, Qt::AlignRight);
|
||||
color_layout -> addWidget(outline_color);
|
||||
color_layout -> addSpacing(10);
|
||||
@@ -106,7 +106,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
||||
color_layout -> addWidget(filling_color);
|
||||
main_layout -> addLayout(color_layout);
|
||||
|
||||
QHBoxLayout *style_layout = new QHBoxLayout();
|
||||
auto *style_layout = new QHBoxLayout();
|
||||
style_layout -> addWidget(new QLabel(tr("Style : ")), 0, Qt::AlignRight);
|
||||
style_layout -> addWidget(line_style);
|
||||
style_layout -> addSpacing(10);
|
||||
@@ -205,7 +205,7 @@ bool StyleEditor::setPart(CustomElementPart *new_part) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
if (CustomElementGraphicPart *part_graphic = dynamic_cast<CustomElementGraphicPart *>(new_part))
|
||||
if (auto *part_graphic = dynamic_cast<CustomElementGraphicPart *>(new_part))
|
||||
{
|
||||
part = part_graphic;
|
||||
updateForm();
|
||||
@@ -237,7 +237,7 @@ bool StyleEditor::setParts(QList<CustomElementPart *> part_list)
|
||||
|
||||
foreach (CustomElementPart *cep, part_list)
|
||||
{
|
||||
if (CustomElementGraphicPart *cegp = dynamic_cast<CustomElementGraphicPart *>(cep))
|
||||
if (auto *cegp = dynamic_cast<CustomElementGraphicPart *>(cep))
|
||||
m_part_list << cegp;
|
||||
else
|
||||
return false;
|
||||
|
||||
@@ -48,17 +48,17 @@ TerminalEditor::TerminalEditor(QETElementEditor *editor, PartTerminal *term, QWi
|
||||
orientation -> addItem(QET::Icons::South, tr("Sud"), Qet::South);
|
||||
orientation -> addItem(QET::Icons::West, tr("Ouest"), Qet::West);
|
||||
|
||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
||||
auto *main_layout = new QVBoxLayout();
|
||||
main_layout -> addWidget(new QLabel(tr("Position : ")));
|
||||
|
||||
QHBoxLayout *position = new QHBoxLayout();
|
||||
auto *position = new QHBoxLayout();
|
||||
position -> addWidget(new QLabel(tr("x : ")));
|
||||
position -> addWidget(qle_x );
|
||||
position -> addWidget(new QLabel(tr("y : ")));
|
||||
position -> addWidget(qle_y );
|
||||
main_layout -> addLayout(position);
|
||||
|
||||
QHBoxLayout *ori = new QHBoxLayout();
|
||||
auto *ori = new QHBoxLayout();
|
||||
ori -> addWidget(new QLabel(tr("Orientation : ")));
|
||||
ori -> addWidget(orientation );
|
||||
main_layout -> addLayout(ori);
|
||||
@@ -91,7 +91,7 @@ bool TerminalEditor::setPart(CustomElementPart *new_part)
|
||||
part = nullptr;
|
||||
return(true);
|
||||
}
|
||||
if (PartTerminal *part_terminal = dynamic_cast<PartTerminal *>(new_part))
|
||||
if (auto *part_terminal = dynamic_cast<PartTerminal *>(new_part))
|
||||
{
|
||||
if(part == part_terminal) return true;
|
||||
if (part)
|
||||
|
||||
@@ -51,33 +51,33 @@ TextEditor::TextEditor(QETElementEditor *editor, PartText *text, QWidget *parent
|
||||
qle_x -> setRange(-5000, 5000);
|
||||
qle_y -> setRange(-5000, 5000);
|
||||
|
||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
||||
auto *main_layout = new QVBoxLayout();
|
||||
main_layout -> addWidget(new QLabel(tr("Position : ")));
|
||||
|
||||
QHBoxLayout *position = new QHBoxLayout();
|
||||
auto *position = new QHBoxLayout();
|
||||
position -> addWidget(new QLabel(tr("x : ")));
|
||||
position -> addWidget(qle_x );
|
||||
position -> addWidget(new QLabel(tr("y : ")));
|
||||
position -> addWidget(qle_y );
|
||||
main_layout -> addLayout(position);
|
||||
|
||||
QHBoxLayout *fs = new QHBoxLayout();
|
||||
auto *fs = new QHBoxLayout();
|
||||
fs -> addWidget(new QLabel(tr("Taille : ")));
|
||||
fs -> addWidget(font_size);
|
||||
main_layout -> addLayout(fs);
|
||||
|
||||
QHBoxLayout *color_layout = new QHBoxLayout();
|
||||
auto *color_layout = new QHBoxLayout();
|
||||
color_layout -> addWidget(new QLabel(tr("Couleur : ")));
|
||||
color_layout -> addWidget(black_color_);
|
||||
color_layout -> addWidget(white_color_);
|
||||
color_layout -> addStretch();
|
||||
main_layout -> addLayout(color_layout);
|
||||
|
||||
QHBoxLayout *t = new QHBoxLayout();
|
||||
auto *t = new QHBoxLayout();
|
||||
t -> addWidget(new QLabel(tr("Texte : ")));
|
||||
t -> addWidget(qle_text);
|
||||
|
||||
QHBoxLayout *rotation_angle_layout = new QHBoxLayout();
|
||||
auto *rotation_angle_layout = new QHBoxLayout();
|
||||
rotation_angle_layout -> addWidget(rotation_angle_label);
|
||||
rotation_angle_layout -> addWidget(rotation_angle_);
|
||||
|
||||
@@ -110,7 +110,7 @@ bool TextEditor::setPart(CustomElementPart *new_part)
|
||||
part = nullptr;
|
||||
return(true);
|
||||
}
|
||||
if (PartText *part_text = dynamic_cast<PartText *>(new_part))
|
||||
if (auto *part_text = dynamic_cast<PartText *>(new_part))
|
||||
{
|
||||
if (part == part_text) return true;
|
||||
part = part_text;
|
||||
|
||||
@@ -228,7 +228,7 @@ void DynamicTextFieldEditor::on_m_frame_cb_clicked()
|
||||
|
||||
void DynamicTextFieldEditor::on_m_width_sb_editingFinished()
|
||||
{
|
||||
qreal width = (qreal)ui->m_width_sb->value();
|
||||
auto width = (qreal)ui->m_width_sb->value();
|
||||
|
||||
if(width != m_text_field.data()->textWidth())
|
||||
{
|
||||
|
||||
@@ -156,7 +156,7 @@ void ElementPropertiesEditorWidget::populateTree()
|
||||
|
||||
for(const QString& key : keys)
|
||||
{
|
||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_tree);
|
||||
auto *qtwi = new QTreeWidgetItem(ui->m_tree);
|
||||
qtwi->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||
qtwi->setData(0, Qt::DisplayRole, QETApp::elementTranslatedInfoKey(key));
|
||||
qtwi->setData(0, Qt::UserRole, key);
|
||||
|
||||
@@ -68,7 +68,7 @@ bool RectangleEditor::setPart(CustomElementPart *part)
|
||||
return(true);
|
||||
}
|
||||
|
||||
if (PartRectangle *part_rectangle = dynamic_cast<PartRectangle *>(part))
|
||||
if (auto *part_rectangle = dynamic_cast<PartRectangle *>(part))
|
||||
{
|
||||
if (m_part == part_rectangle) {
|
||||
return true;
|
||||
@@ -147,7 +147,7 @@ void RectangleEditor::editingFinished()
|
||||
}
|
||||
m_locked = true;
|
||||
|
||||
QUndoCommand *undo = new QUndoCommand();
|
||||
auto *undo = new QUndoCommand();
|
||||
undo->setText(tr("Modifier un rectangle"));
|
||||
|
||||
QRectF rect(editedTopLeft(), QSizeF(ui->m_width_sb->value(), ui->m_height_sb->value()));
|
||||
|
||||
Reference in New Issue
Block a user