Skip to content

Commit

Permalink
don't close popup after first click, so user can select all necessary
Browse files Browse the repository at this point in the history
options at once
  • Loading branch information
alexbruy committed Apr 8, 2017
1 parent 9fbb31a commit 1e3baca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/gui/qgscheckablecombobox.cpp
Expand Up @@ -169,10 +169,11 @@ void QgsCheckableComboBox::toggleItemCheckState( int index )

void QgsCheckableComboBox::hidePopup()
{
if ( !view()->underMouse() )
if ( !mSkipHide )
{
QComboBox::hidePopup();
}
mSkipHide = false;
}

void QgsCheckableComboBox::showContextMenu( const QPoint &pos )
Expand Down Expand Up @@ -206,7 +207,11 @@ void QgsCheckableComboBox::deselectAllOptions()

bool QgsCheckableComboBox::eventFilter( QObject *object, QEvent *event )
{
Q_UNUSED( object );
if ( ( event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease )
&& object == view()->viewport() )
{
mSkipHide = true;
}

if ( event->type() == QEvent::MouseButtonRelease )
{
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgscheckablecombobox.h
Expand Up @@ -227,6 +227,8 @@ class GUI_EXPORT QgsCheckableComboBox : public QComboBox
QString mSeparator;
QString mDefaultText;

bool mSkipHide = false;

QMenu *mContextMenu = nullptr;
QAction *mSelectAllAction = nullptr;
QAction *mDeselectAllAction = nullptr;
Expand Down

0 comments on commit 1e3baca

Please sign in to comment.