Skip to content

Commit

Permalink
Use Qt color picker to avoid Qt Cocoa crashes (#3497), part 1
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15376 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
kyngchaos committed Mar 7, 2011
1 parent 8742876 commit 2bafd79
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/qgssinglesymboldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,12 @@ QgsSingleSymbolDialog::~QgsSingleSymbolDialog()

void QgsSingleSymbolDialog::selectOutlineColor()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor c = QColorDialog::getColor( btnOutlineColor->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor c = QColorDialog::getColor( btnOutlineColor->color(), this );
#endif

if ( c.isValid() )
{
Expand All @@ -265,7 +270,12 @@ void QgsSingleSymbolDialog::selectOutlineColor()

void QgsSingleSymbolDialog::selectFillColor()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor c = QColorDialog::getColor( btnFillColor->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor c = QColorDialog::getColor( btnFillColor->color(), this );
#endif

if ( c.isValid() )
{
Expand Down
35 changes: 35 additions & 0 deletions src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ void QgsSimpleLineSymbolLayerV2Widget::penWidthChanged()

void QgsSimpleLineSymbolLayerV2Widget::colorChanged()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mLayer->color(), this );
#endif
if ( !color.isValid() )
return;
mLayer->setColor( color );
Expand Down Expand Up @@ -226,7 +231,12 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setName()

void QgsSimpleMarkerSymbolLayerV2Widget::setColorBorder()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor borderColor = QColorDialog::getColor( mLayer->borderColor(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor borderColor = QColorDialog::getColor( mLayer->borderColor(), this );
#endif
if ( !borderColor.isValid() )
return;
mLayer->setBorderColor( borderColor );
Expand All @@ -236,7 +246,12 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setColorBorder()

void QgsSimpleMarkerSymbolLayerV2Widget::setColorFill()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mLayer->color(), this );
#endif
if ( !color.isValid() )
return;
mLayer->setColor( color );
Expand Down Expand Up @@ -310,7 +325,12 @@ QgsSymbolLayerV2* QgsSimpleFillSymbolLayerV2Widget::symbolLayer()

void QgsSimpleFillSymbolLayerV2Widget::setColor()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mLayer->color(), this );
#endif
if ( !color.isValid() )
return;
mLayer->setColor( color );
Expand All @@ -320,7 +340,12 @@ void QgsSimpleFillSymbolLayerV2Widget::setColor()

void QgsSimpleFillSymbolLayerV2Widget::setBorderColor()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor color = QColorDialog::getColor( mLayer->borderColor(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mLayer->borderColor(), this );
#endif
if ( !color.isValid() )
return;
mLayer->setBorderColor( color );
Expand Down Expand Up @@ -638,7 +663,12 @@ QgsSymbolLayerV2* QgsLineDecorationSymbolLayerV2Widget::symbolLayer()

void QgsLineDecorationSymbolLayerV2Widget::colorChanged()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mLayer->color(), this );
#endif
if ( !color.isValid() )
return;
mLayer->setColor( color );
Expand Down Expand Up @@ -829,7 +859,12 @@ void QgsFontMarkerSymbolLayerV2Widget::setFontFamily( const QFont& font )

void QgsFontMarkerSymbolLayerV2Widget::setColor()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mLayer->color(), this );
#endif
if ( !color.isValid() )
return;
mLayer->setColor( color );
Expand Down
5 changes: 5 additions & 0 deletions src/gui/symbology-ng/qgssymbolv2selectordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ void QgsSymbolV2SelectorDialog::changeSymbolProperties()

void QgsSymbolV2SelectorDialog::setSymbolColor()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor color = QColorDialog::getColor( mSymbol->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mSymbol->color(), this );
#endif
if ( !color.isValid() )
return;

Expand Down

0 comments on commit 2bafd79

Please sign in to comment.