D21971: [DEMO] Enhance ToggleActionMenu with ImplicitDefaultAction mode.

Simone Gaiarin noreply at phabricator.kde.org
Sun Jul 28 13:37:09 BST 2019


simgunz added a comment.


  I did test this today and it seems to be working correctly, at least in the use cases of Okular, i.e. for select annotation tools and for the annotation toolbar. Actually I am currently using in D15580 <https://phabricator.kde.org/D15580> now (will push soon), given that ToolAction was not enough for what I needed ( I'll update my code accordingly if this revision is modified).
  
  Suggested changes:
  
  - Make `QToolButton::MenuButtonPopup`, and `ToggleActionMenu::ImplicitDefaultAction` the defaults in the constructor so we can call it as `d->aMouseModeMenu = new ToggleActionMenu( QIcon(),QString(), this);`
  - I do not fully understand the purpose of the method `setSuggestedDefaultAction`. I would remove it and leave only `setDefaultAction`.
  
  This is how I am currently using it:
  
    ToggleActionMenu *ta = new ToggleActionMenu( QIcon(),QString(), this, QToolButton::MenuButtonPopup, ToggleActionMenu::ImplicitDefaultAction );
    connect(ta, &ToggleActionMenu::toggled, this, &AnnotationActionHandler::setTextToolsEnabled);
    ac->addAction( QStringLiteral("annotation_geometrical_shape"), ta );
    ta->setText( i18nc( "@action", "Geometrical shapes" ) );
    ta->addAction( annArrow );
    ta->addAction( annStraightLine );
    ta->addAction( annRectangle );
    ta->setDefaultAction( annArrow );
  
  I am only considering the use cases of Okular.

REPOSITORY
  R223 Okular

REVISION DETAIL
  https://phabricator.kde.org/D21971

To: davidhurka
Cc: simgunz, okular-devel, maguirre, fbampaloukas, joaonetto, kezik, tfella, ngraham, darcyshen, aacid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20190728/1dfe29f0/attachment.html>


More information about the Okular-devel mailing list