Use a more conventional dropdown menu style instead of press-and-hold

Summary:
Currently, `ToolAction` menus (of which there is only one, the selection tool menu)
activate the current tool on click, and require a click-and-hold to choose a new tool.
This is a somewhat unfamiliar user interface that I myself struggled with when initially
encountering it, and I've encountered user complaints about it as well.

This patch adjusts the behavior so that clicking on the arrow on the right side of the
button will open the pop-up and allow choosing another tool, which is a more common
method of implementing the feature. The patch also adjusts the tooltop accordingly.

Test Plan: {F6874466, size=full}

Reviewers: #okular, #vdg, ndavis

Reviewed By: #vdg, ndavis

Subscribers: ndavis, abetts, filipf, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21622
This commit is contained in:
Nate Graham 2019-06-06 08:18:39 -06:00
parent c325cb4161
commit c792444550

View file

@ -49,7 +49,7 @@ QWidget* ToolAction::createWidget( QWidget *parent )
button->setFocusPolicy( Qt::NoFocus );
button->setIconSize( toolBar->iconSize() );
button->setToolButtonStyle( toolBar->toolButtonStyle() );
button->setPopupMode( QToolButton::DelayedPopup );
button->setPopupMode( QToolButton::MenuButtonPopup );
button->setMenu( new QMenu( button ) );
button->setCheckable( true );
connect(toolBar, &QToolBar::iconSizeChanged, button, &QToolButton::setIconSize);
@ -68,7 +68,7 @@ QWidget* ToolAction::createWidget( QWidget *parent )
if ( action->isChecked() )
button->setDefaultAction( action );
}
button->setToolTip( i18n("Click to use the current selection tool\nClick and hold to choose another selection tool") );
button->setToolTip( i18n("Click to use the current selection tool\nClick on the arrow to choose another selection tool") );
}
return button;
@ -80,7 +80,7 @@ void ToolAction::slotNewDefaultAction( QAction *action )
if ( button )
{
button->setDefaultAction( action );
button->setToolTip( i18n("Click to use the current selection tool\nClick and hold to choose another selection tool") );
button->setToolTip( i18n("Click to use the current selection tool\nClick on the arrow to choose another selection tool") );
}
}