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

Reply via email to