]> sigrok.org Git - pulseview.git/commitdiff
Fix #1412 more by allowing the PD stack menu to be scrolled
authorSoeren Apel <redacted>
Thu, 7 Nov 2019 21:49:11 +0000 (22:49 +0100)
committerSoeren Apel <redacted>
Thu, 7 Nov 2019 21:54:08 +0000 (22:54 +0100)
pv/views/trace/decodetrace.cpp
pv/widgets/decodermenu.cpp

index f7f60a28b49d9586c539bf4c4c8875fe7a9a46db..f76e43a8470427faee0601c3238b0dfc813fd43a 100644 (file)
@@ -288,6 +288,8 @@ void DecodeTrace::update_stack_button()
                        connect(decoder_menu, SIGNAL(decoder_selected(srd_decoder*)),
                                this, SLOT(on_stack_decoder(srd_decoder*)));
 
+                       decoder_menu->setStyleSheet("QMenu { menu-scrollable: 1; }");
+
                        stack_button_->setMenu(decoder_menu);
                        stack_button_->show();
                        return;
index 9fcc0cf077c5e7a00b6a0e7ccadc0cb3e7590383..505a1f67e9e4179c756f2ae33f148cf793686738 100644 (file)
@@ -30,8 +30,8 @@ DecoderMenu::DecoderMenu(QWidget *parent, const char* input, bool first_level_de
        QMenu(parent),
        mapper_(this)
 {
-       GSList *li = g_slist_sort(g_slist_copy(
-               (GSList*)srd_decoder_list()), decoder_name_cmp);
+       GSList *li = g_slist_sort(g_slist_copy((GSList*)srd_decoder_list()), decoder_name_cmp);
+
        for (GSList *l = li; l; l = l->next) {
                const srd_decoder *const d = (srd_decoder*)l->data;
                assert(d);
@@ -50,30 +50,26 @@ DecoderMenu::DecoderMenu(QWidget *parent, const char* input, bool first_level_de
                                continue;
                }
 
-               QAction *const action =
-                       addAction(QString::fromUtf8(d->name));
+               QAction *const action = addAction(QString::fromUtf8(d->name));
                action->setData(qVariantFromValue(l->data));
                mapper_.setMapping(action, action);
-               connect(action, SIGNAL(triggered()),
-                       &mapper_, SLOT(map()));
+               connect(action, SIGNAL(triggered()), &mapper_, SLOT(map()));
        }
        g_slist_free(li);
 
-       connect(&mapper_, SIGNAL(mapped(QObject*)),
-               this, SLOT(on_action(QObject*)));
+       connect(&mapper_, SIGNAL(mapped(QObject*)), this, SLOT(on_action(QObject*)));
 }
 
 int DecoderMenu::decoder_name_cmp(const void *a, const void *b)
 {
-       return strcmp(((const srd_decoder*)a)->name,
-               ((const srd_decoder*)b)->name);
+       return strcmp(((const srd_decoder*)a)->name, ((const srd_decoder*)b)->name);
 }
 
 void DecoderMenu::on_action(QObject *action)
 {
        assert(action);
-       srd_decoder *const dec =
-               (srd_decoder*)((QAction*)action)->data().value<void*>();
+
+       srd_decoder *const dec = (srd_decoder*)((QAction*)action)->data().value<void*>();
        assert(dec);
 
        decoder_selected(dec);