Skip to content
Permalink
Browse files

Disable color picker under OSX, due to limitations with QWidget::grab…

…Mouse on that platform
  • Loading branch information
nyalldawson committed Jul 27, 2014
1 parent acc0f9b commit b3de1dd424a26c837639297d491110e424a62e7f
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/gui/qgscolorbutton.cpp
@@ -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 ) )
@@ -333,6 +338,7 @@ void QgsColorButton::showContextMenu( QMouseEvent *event )
//paste color
setColor( clipColor );
}
#ifndef Q_WS_MAC
else if ( selectedAction == pickColorAction )
{
//pick color
@@ -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 )

0 comments on commit b3de1dd

Please sign in to comment.
You can’t perform that action at this time.