diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /widgets/DecodeHighlightingListView.cpp | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'widgets/DecodeHighlightingListView.cpp')
| -rw-r--r-- | widgets/DecodeHighlightingListView.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/widgets/DecodeHighlightingListView.cpp b/widgets/DecodeHighlightingListView.cpp index cfb14fc5..2997017a 100644 --- a/widgets/DecodeHighlightingListView.cpp +++ b/widgets/DecodeHighlightingListView.cpp @@ -15,6 +15,10 @@ DecodeHighlightingListView::DecodeHighlightingListView (QWidget * parent) addAction (fg_colour_action); connect (fg_colour_action, &QAction::triggered, [this] (bool /*checked*/) { auto const& index = currentIndex (); + if (!model () || !index.isValid ()) + { + return; + } auto colour = QColorDialog::getColor (model ()->data (index, Qt::ForegroundRole).value<QBrush> ().color () , this , tr ("Choose %1 Foreground Color") @@ -28,13 +32,21 @@ DecodeHighlightingListView::DecodeHighlightingListView (QWidget * parent) auto * unset_fg_colour_action = new QAction {tr ("&Unset foreground color"), this}; addAction (unset_fg_colour_action); connect (unset_fg_colour_action, &QAction::triggered, [this] (bool /*checked*/) { - model ()->setData (currentIndex (), QBrush {}, Qt::ForegroundRole); + auto const& index = currentIndex (); + if (model () && index.isValid ()) + { + model ()->setData (index, QBrush {}, Qt::ForegroundRole); + } }); auto * bg_colour_action = new QAction {tr ("&Background color ..."), this}; addAction (bg_colour_action); connect (bg_colour_action, &QAction::triggered, [this] (bool /*checked*/) { auto const& index = currentIndex (); + if (!model () || !index.isValid ()) + { + return; + } auto colour = QColorDialog::getColor (model ()->data (index, Qt::BackgroundRole).value<QBrush> ().color () , this , tr ("Choose %1 Background Color") @@ -48,13 +60,21 @@ DecodeHighlightingListView::DecodeHighlightingListView (QWidget * parent) auto * unset_bg_colour_action = new QAction {tr ("U&nset background color"), this}; addAction (unset_bg_colour_action); connect (unset_bg_colour_action, &QAction::triggered, [this] (bool /*checked*/) { - model ()->setData (currentIndex (), QBrush {}, Qt::BackgroundRole); + auto const& index = currentIndex (); + if (model () && index.isValid ()) + { + model ()->setData (index, QBrush {}, Qt::BackgroundRole); + } }); auto * defaults_action = new QAction {tr ("&Reset this item to defaults"), this}; addAction (defaults_action); connect (defaults_action, &QAction::triggered, [this] (bool /*checked*/) { auto const& index = currentIndex (); + if (!model () || !index.isValid ()) + { + return; + } model ()->setData (index, model ()->data (index, DecodeHighlightingModel::EnabledDefaultRole).toBool () ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole); model ()->setData (index, model ()->data (index, DecodeHighlightingModel::ForegroundDefaultRole), Qt::ForegroundRole); model ()->setData (index, model ()->data (index, DecodeHighlightingModel::BackgroundDefaultRole), Qt::BackgroundRole); |
