Skip to content

Commit

Permalink
Address various warnings and deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
mortbopet committed Sep 26, 2023
1 parent 16207fe commit 8cb60ad
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions graphics/vsrtl_componentgraphic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void ComponentGraphic::resetWires() {
}
}
// Clear wires from this components input ports
for (const auto &p : qAsConst(m_inputPorts)) {
for (const auto &p : std::as_const(m_inputPorts)) {
p->getOutputWire()->clearWirePoints();
}
}
Expand Down Expand Up @@ -526,7 +526,7 @@ QVariant ComponentGraphic::itemChange(QGraphicsItem::GraphicsItemChange change,
// of $this. We need to manually signal the wires going to the input ports
// of this component, to redraw
if (m_initialized) {
for (const auto &inputPort : qAsConst(m_inputPorts)) {
for (const auto &inputPort : std::as_const(m_inputPorts)) {
if (!inputPort->getPort()->isConstant()) {
if (auto *simInputPort = inputPort->getPort()->getInputPort()) {
if (auto *graphic = simInputPort->getGraphic<PortGraphic>()) {
Expand Down
2 changes: 1 addition & 1 deletion graphics/vsrtl_graphics_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ inline void getAllChildren(QGraphicsItem *p, QList<QGraphicsItem *> &acc) {
acc.push_back(p);
} else {
const auto children = p->childItems();
for (const auto &c : qAsConst(children)) {
for (const auto &c : std::as_const(children)) {
getAllChildren(c, acc);
}
acc.push_back(p);
Expand Down
2 changes: 1 addition & 1 deletion graphics/vsrtl_gridcomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ bool GridComponent::parentContainsRect(const QRect &r) const {
std::vector<GridComponent *> GridComponent::getGridSubcomponents() const {
std::vector<GridComponent *> c;
const auto children = childItems();
for (const auto &subc : qAsConst(children)) {
for (const auto &subc : std::as_const(children)) {
auto *ptr = dynamic_cast<GridComponent *>(subc);
if (ptr)
c.push_back(ptr);
Expand Down
6 changes: 3 additions & 3 deletions graphics/vsrtl_mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void MainWindow::createToolbar() {
m_vsrtlWidget->reset();
m_netlist->reloadNetlist();
});
resetAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
resetAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_R));
simulatorToolBar->addAction(resetAct);

const QIcon reverseIcon = QIcon(":/vsrtl_icons/reverse.svg");
Expand All @@ -68,7 +68,7 @@ void MainWindow::createToolbar() {
m_vsrtlWidget->reverse();
m_netlist->reloadNetlist();
});
reverseAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
reverseAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Z));
simulatorToolBar->addAction(reverseAct);
reverseAct->setEnabled(false);
connect(m_vsrtlWidget, &VSRTLWidget::canReverse, reverseAct,
Expand All @@ -80,7 +80,7 @@ void MainWindow::createToolbar() {
m_vsrtlWidget->clock();
m_netlist->reloadNetlist();
});
clockAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
clockAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_C));
simulatorToolBar->addAction(clockAct);

QTimer *timer = new QTimer();
Expand Down
2 changes: 1 addition & 1 deletion graphics/vsrtl_multiplexergraphic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void MultiplexerGraphic::paintOverlay(QPainter *painter,
const unsigned int index = select->uValue();
Q_ASSERT(static_cast<long>(index) < m_inputPorts.size());

for (const auto &ip : qAsConst(m_inputPorts)) {
for (const auto &ip : std::as_const(m_inputPorts)) {
const auto *p_base = ip->getPort();
if (p_base != select) {
if (p_base == inputPorts[index]) {
Expand Down
2 changes: 1 addition & 1 deletion graphics/vsrtl_netlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace {
void getIndexComponentPtr(const QItemSelection &selected,
std::vector<SimComponent *> &c_v) {
const auto indexes = selected.indexes();
for (const auto &sel : qAsConst(indexes)) {
for (const auto &sel : std::as_const(indexes)) {
auto *c =
static_cast<NetlistTreeItem *>(sel.internalPointer())->m_component;
if (c) {
Expand Down
4 changes: 2 additions & 2 deletions graphics/vsrtl_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void VSRTLScene::handleWirePointMove(QGraphicsSceneMouseEvent *event) {
if (m_selectedPoint != nullptr && event->buttons() == Qt::LeftButton) {
std::set<WirePoint *> pointsUnderCursor;
const auto itemsAtPoint = items(event->scenePos());
for (const auto &item : qAsConst(itemsAtPoint)) {
for (const auto &item : std::as_const(itemsAtPoint)) {
if (auto *point = dynamic_cast<WirePoint *>(item)) {
if (m_selectedPoint->canMergeWith(point)) {
pointsUnderCursor.insert(point);
Expand Down Expand Up @@ -180,7 +180,7 @@ void VSRTLScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
std::vector<QAction *> showActions;

const auto sceneItems = items();
for (const auto &i : qAsConst(sceneItems)) {
for (const auto &i : std::as_const(sceneItems)) {
if (!i->isVisible()) {
if (auto *c = dynamic_cast<ComponentGraphic *>(i)) {
// If a components parent is expanded but it itself is not visible,
Expand Down
4 changes: 2 additions & 2 deletions graphics/vsrtl_scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class VSRTLScene : public QGraphicsScene {
template <typename T, typename F, typename... Args>
void execOnItems(F f, Args... args) {
const auto sceneItems = items();
for (auto *c : qAsConst(sceneItems)) {
for (auto *c : std::as_const(sceneItems)) {
if (auto *t_c = dynamic_cast<T *>(c)) {
(t_c->*f)(args...);
}
Expand All @@ -80,7 +80,7 @@ class VSRTLScene : public QGraphicsScene {
void predicatedExecOnItems(std::function<bool(const T *)> pred, F &&f,
Args... args) {
const auto sceneItems = items();
for (auto *c : qAsConst(sceneItems)) {
for (auto *c : std::as_const(sceneItems)) {
if (auto *t_c = dynamic_cast<T *>(c)) {
if (pred(t_c)) {
(t_c->*f)(args...);
Expand Down
2 changes: 1 addition & 1 deletion graphics/vsrtl_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ VSRTLView::VSRTLView(QWidget *parent) : QGraphicsView(parent) {

ComponentGraphic *VSRTLView::lookupGraphicForComponent(const SimComponent *c) {
const auto sceneItems = items();
for (auto *i : qAsConst(sceneItems)) {
for (auto *i : std::as_const(sceneItems)) {
auto d = dynamic_cast<ComponentGraphic *>(i);
if (d) {
// Equality is based on pointer equality
Expand Down
4 changes: 2 additions & 2 deletions graphics/vsrtl_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void VSRTLWidget::handleSceneSelectionChanged() {
std::vector<SimComponent *> selectedComponents;
std::vector<SimPort *> selectedPorts;
const auto selectedItems = m_scene->selectedItems();
for (auto *i : qAsConst(selectedItems)) {
for (auto *i : std::as_const(selectedItems)) {
ComponentGraphic *i_c = dynamic_cast<ComponentGraphic *>(i);
if (i_c) {
selectedComponents.push_back(i_c->getComponent());
Expand Down Expand Up @@ -191,7 +191,7 @@ void VSRTLWidget::sync() {
// tell all labels to reset their text value, given that labels manually must
// have their text updated (ie. text is not updated in the redraw call).
const auto sceneItems = m_scene->items();
for (auto *item : qAsConst(sceneItems)) {
for (auto *item : std::as_const(sceneItems)) {
if (auto *simobject = dynamic_cast<SimQObject *>(item)) {
simobject->simUpdateSlot();
}
Expand Down

0 comments on commit 8cb60ad

Please sign in to comment.