Skip to content

Commit

Permalink
Disable color picker under OSX, due to limitations with QWidget::grab…
Browse files Browse the repository at this point in the history
…Mouse on that platform
  • Loading branch information
nyalldawson committed Jul 27, 2014
1 parent acc0f9b commit b3de1dd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/gui/qgscolorbutton.cpp
Expand Up @@ -312,9 +312,14 @@ void QgsColorButton::showContextMenu( QMouseEvent *event )
QAction* pasteColorAction = new QAction( tr( "Paste color" ), 0 );
pasteColorAction->setEnabled( false );
colorContextMenu.addAction( pasteColorAction );
#ifndef Q_WS_MAC
//disabled for OSX, as it is impossible to grab the mouse under OSX
//see note for QWidget::grabMouse() re OSX Cocoa
//http://qt-project.org/doc/qt-4.8/qwidget.html#grabMouse
QAction* pickColorAction = new QAction( tr( "Pick color" ), 0 );
colorContextMenu.addSeparator();
colorContextMenu.addAction( pickColorAction );
#endif

QColor clipColor;
if ( colorFromMimeData( QApplication::clipboard()->mimeData(), clipColor ) )
Expand All @@ -333,6 +338,7 @@ void QgsColorButton::showContextMenu( QMouseEvent *event )
//paste color
setColor( clipColor );
}
#ifndef Q_WS_MAC
else if ( selectedAction == pickColorAction )
{
//pick color
Expand All @@ -341,10 +347,11 @@ void QgsColorButton::showContextMenu( QMouseEvent *event )
grabMouse();
mPickingColor = true;
}
delete pickColorAction;
#endif

delete copyColorAction;
delete pasteColorAction;
delete pickColorAction;
}

void QgsColorButton::setValidColor( const QColor& newColor )
Expand Down

0 comments on commit b3de1dd

Please sign in to comment.