fix deprecated warning QSet<T>::toList() Use values() instead.

warning: ‘QList<T> QSet<T>::toList() const [with T = Conductor*]’
is deprecated: Use values() instead. [-Wdeprecated-declarations]

QT_VERSION 5.15.0
GCC 64bit
This commit is contained in:
Simon De Backer
2020-05-27 23:01:39 +02:00
committed by Laurent Trinques
parent 7948e2b1d3
commit 362509cb38
9 changed files with 16 additions and 16 deletions

View File

@@ -38,7 +38,7 @@
ConductorAutoNumerotation::ConductorAutoNumerotation(Conductor *conductor, Diagram *diagram, QUndoCommand *parent_undo) : ConductorAutoNumerotation::ConductorAutoNumerotation(Conductor *conductor, Diagram *diagram, QUndoCommand *parent_undo) :
m_diagram (diagram), m_diagram (diagram),
m_conductor (conductor), m_conductor (conductor),
conductor_list (conductor -> relatedPotentialConductors().toList()), conductor_list (conductor -> relatedPotentialConductors().values()),
m_parent_undo (parent_undo) m_parent_undo (parent_undo)
{} {}

View File

@@ -68,7 +68,7 @@ DiagramContent::DiagramContent(Diagram *diagram, bool selected) :
if (m_potential_conductors.isEmpty()) { if (m_potential_conductors.isEmpty()) {
m_potential_conductors << c; m_potential_conductors << c;
} else { } else {
if (!potentialIsManaged(c->relatedPotentialConductors(true).toList())) { if (!potentialIsManaged(c->relatedPotentialConductors(true).values())) {
m_potential_conductors << c; m_potential_conductors << c;
} }
} }
@@ -338,7 +338,7 @@ DiagramContent &DiagramContent::operator+=(const DiagramContent &other)
for (Conductor *c : other.m_potential_conductors) for (Conductor *c : other.m_potential_conductors)
{ {
QList<Conductor *> c_list = c->relatedPotentialConductors(true).toList(); QList<Conductor *> c_list = c->relatedPotentialConductors(true).values();
c_list << c; c_list << c;
if (!potentialIsManaged(c_list)) { if (!potentialIsManaged(c_list)) {
m_potential_conductors << c; m_potential_conductors << c;

View File

@@ -81,14 +81,14 @@ int ElementsMover::beginMovement(Diagram *diagram, QGraphicsItem *driver_item)
m_moved_content.removeNonMovableItems(); m_moved_content.removeNonMovableItems();
//Remove element text, if the parent element is selected. //Remove element text, if the parent element is selected.
QList<DynamicElementTextItem *> deti_list = m_moved_content.m_element_texts.toList(); QList<DynamicElementTextItem *> deti_list = m_moved_content.m_element_texts.values();
for(DynamicElementTextItem *deti : deti_list) { for(DynamicElementTextItem *deti : deti_list) {
if(m_moved_content.m_elements.contains(deti->parentElement())) { if(m_moved_content.m_elements.contains(deti->parentElement())) {
m_moved_content.m_element_texts.remove(deti); m_moved_content.m_element_texts.remove(deti);
} }
} }
QList<ElementTextItemGroup *> etig_list = m_moved_content.m_texts_groups.toList(); QList<ElementTextItemGroup *> etig_list = m_moved_content.m_texts_groups.values();
for(ElementTextItemGroup *etig : etig_list) { for(ElementTextItemGroup *etig : etig_list) {
if (m_moved_content.m_elements.contains(etig->parentElement())) { if (m_moved_content.m_elements.contains(etig->parentElement())) {
m_moved_content.m_texts_groups.remove(etig); m_moved_content.m_texts_groups.remove(etig);

View File

@@ -1393,7 +1393,7 @@ void QETDiagramEditor::selectionGroupTriggered(QAction *action)
dv->editSelection(); dv->editSelection();
else if (value == "group_selected_texts") else if (value == "group_selected_texts")
{ {
QList<DynamicElementTextItem *> deti_list = dc.m_element_texts.toList(); QList<DynamicElementTextItem *> deti_list = dc.m_element_texts.values();
if(deti_list.size() <= 1) if(deti_list.size() <= 1)
return; return;
@@ -1537,8 +1537,8 @@ void QETDiagramEditor::slot_updateComplexActions()
int selected_dynamic_elmt_text = 0; for(DiagramTextItem *dti : texts) {if(dti->type() == DynamicElementTextItem::Type) selected_dynamic_elmt_text++;} int selected_dynamic_elmt_text = 0; for(DiagramTextItem *dti : texts) {if(dti->type() == DynamicElementTextItem::Type) selected_dynamic_elmt_text++;}
m_rotate_texts->setEnabled(!ro && (selected_texts || groups.size())); m_rotate_texts->setEnabled(!ro && (selected_texts || groups.size()));
//Action that need only element text selected //Action that need only element text selected
QList<DynamicElementTextItem *> deti_list = dc.m_element_texts.toList(); QList<DynamicElementTextItem *> deti_list = dc.m_element_texts.values();
if(deti_list.size() > 1 && dc.count() == deti_list.count()) if(deti_list.size() > 1 && dc.count() == deti_list.count())
{ {
Element *elmt = deti_list.first()->parentElement(); Element *elmt = deti_list.first()->parentElement();

View File

@@ -612,7 +612,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
if (use_properties) if (use_properties)
{ {
Conductor *other = conductors_list.toList().first(); Conductor *other = conductors_list.values().first();
new_conductor->rSequenceNum() = other->sequenceNum(); new_conductor->rSequenceNum() = other->sequenceNum();
new_conductor->setProperties(others_properties); new_conductor->setProperties(others_properties);
} }
@@ -626,7 +626,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
diagram() -> undoStack().push(undo); diagram() -> undoStack().push(undo);
if (use_properties) if (use_properties)
{ {
Conductor *other = conductors_list.toList().first(); Conductor *other = conductors_list.values().first();
new_conductor->setProperties(other->properties()); new_conductor->setProperties(other->properties());
} }
} }

View File

@@ -718,7 +718,7 @@ TitleBlockCell *MergeCellsCommand::getBottomRightCell(const TitleBlockTemplateCe
// next, we get its logical cells: the painted one and the spanned ones (if any) // next, we get its logical cells: the painted one and the spanned ones (if any)
QSet<TitleBlockCell *> logical_cells = bottom_right_cell -> cells(); QSet<TitleBlockCell *> logical_cells = bottom_right_cell -> cells();
if (logical_cells.isEmpty()) return(nullptr); if (logical_cells.isEmpty()) return(nullptr);
if (logical_cells.count() == 1) return(logical_cells.toList().first()); if (logical_cells.count() == 1) return(logical_cells.values().first());
// we then look for the bottom right logical cell // we then look for the bottom right logical cell
int max_num_row = -1, max_num_col = -1; int max_num_row = -1, max_num_col = -1;

View File

@@ -422,7 +422,7 @@ void TitleBlockTemplateView::drawBackground(QPainter *painter, const QRectF &rec
@return the selected logical cells, not including the spanned ones. @return the selected logical cells, not including the spanned ones.
*/ */
QList<TitleBlockCell *> TitleBlockTemplateView::selectedCells() const { QList<TitleBlockCell *> TitleBlockTemplateView::selectedCells() const {
return(selectedCellsSet().cells(false).toList()); return(selectedCellsSet().cells(false).values());
} }
/** /**

View File

@@ -104,7 +104,7 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector
seq_num = conductor_in_potential->sequenceNum(); seq_num = conductor_in_potential->sequenceNum();
number = conductor_in_potential->relatedPotentialConductors().size()+1; //We add +1 because conductor_in_potential isn't count by relatedPotentialConductors number = conductor_in_potential->relatedPotentialConductors().size()+1; //We add +1 because conductor_in_potential isn't count by relatedPotentialConductors
c_list = conductor_in_potential->relatedPotentialConductors().toList(); c_list = conductor_in_potential->relatedPotentialConductors().values();
c_list.append(conductor_in_potential); c_list.append(conductor_in_potential);
foreach(Conductor *c, c_list) foreach(Conductor *c, c_list)
properties_list.append(c->properties()); properties_list.append(c->properties());
@@ -137,14 +137,14 @@ class LinkReportPotentialSelector : public AbstractPotentialSelector
m_conductor_number_1 = report->conductors().first()->relatedPotentialConductors().size() + 1; m_conductor_number_1 = report->conductors().first()->relatedPotentialConductors().size() + 1;
m_seq_num_1 = report->conductors().first()->sequenceNum(); m_seq_num_1 = report->conductors().first()->sequenceNum();
m_conductors_list_1.append(report->conductors().first()->relatedPotentialConductors().toList()); m_conductors_list_1.append(report->conductors().first()->relatedPotentialConductors().values());
m_conductors_list_1.append(report->conductors().first()); m_conductors_list_1.append(report->conductors().first());
foreach(Conductor *c, m_conductors_list_1) foreach(Conductor *c, m_conductors_list_1)
m_properties_list_1 << c->properties(); m_properties_list_1 << c->properties();
m_conductor_number_2 = other_report->conductors().first()->relatedPotentialConductors().size() + 1; m_conductor_number_2 = other_report->conductors().first()->relatedPotentialConductors().size() + 1;
m_seq_num_2 = other_report->conductors().first()->sequenceNum(); m_seq_num_2 = other_report->conductors().first()->sequenceNum();
m_conductors_list_2.append(other_report->conductors().first()->relatedPotentialConductors().toList()); m_conductors_list_2.append(other_report->conductors().first()->relatedPotentialConductors().values());
m_conductors_list_2.append(other_report->conductors().first()); m_conductors_list_2.append(other_report->conductors().first());
foreach(Conductor *c, m_conductors_list_2) foreach(Conductor *c, m_conductors_list_2)
m_properties_list_2 << c->properties(); m_properties_list_2 << c->properties();

View File

@@ -281,7 +281,7 @@ void DeleteQGraphicsItemCommand::redo()
if (m_diagram -> defaultConductorProperties.m_one_text_per_folio && c -> textItem() -> isVisible()) if (m_diagram -> defaultConductorProperties.m_one_text_per_folio && c -> textItem() -> isVisible())
{ {
QList <Conductor *> conductor_list; QList <Conductor *> conductor_list;
conductor_list << c -> relatedPotentialConductors(false).toList(); conductor_list << c -> relatedPotentialConductors(false).values();
if (conductor_list.count()) if (conductor_list.count())
conductor_list.first() -> calculateTextItemPosition(); conductor_list.first() -> calculateTextItemPosition();
} }