make more use of auto and thus avoid having to specify the same type twice

This commit is contained in:
Axel Kohlmeyer
2024-07-04 11:12:40 -04:00
parent 10e3595b57
commit cefe76919c
8 changed files with 47 additions and 47 deletions

View File

@ -35,7 +35,7 @@ LogWindow::LogWindow(const QString &_filename, QWidget *parent) :
QSettings settings;
resize(settings.value("logx", 500).toInt(), settings.value("logy", 320).toInt());
auto action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_S), this);
auto *action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_S), this);
connect(action, &QShortcut::activated, this, &LogWindow::save_as);
action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(action, &QShortcut::activated, this, &LogWindow::quit);
@ -99,7 +99,7 @@ void LogWindow::contextMenuEvent(QContextMenuEvent *event)
// show augmented context menu
auto *menu = createStandardContextMenu();
menu->addSeparator();
auto action = menu->addAction(QString("Save Log to File ..."));
auto *action = menu->addAction(QString("Save Log to File ..."));
action->setIcon(QIcon(":/icons/document-save-as.png"));
action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S));
connect(action, &QAction::triggered, this, &LogWindow::save_as);
@ -114,7 +114,7 @@ void LogWindow::contextMenuEvent(QContextMenuEvent *event)
bool LogWindow::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::ShortcutOverride) {
QKeyEvent *keyEvent = dynamic_cast<QKeyEvent *>(event);
auto *keyEvent = dynamic_cast<QKeyEvent *>(event);
if (!keyEvent) return QWidget::eventFilter(watched, event);
if (keyEvent->modifiers().testFlag(Qt::ControlModifier) && keyEvent->key() == '/') {
stop_run();