From 7ad75d9ffc9ac672258528e155472cea85b30330 Mon Sep 17 00:00:00 2001 From: William Kyngesburye Date: Sat, 7 May 2011 19:15:35 -0500 Subject: [PATCH] finish fix for #3497 --- .../symbology-ng/qgssymbollayerv2widget.cpp | 14 +++++++ .../qgssymbolv2selectordialog.cpp | 2 + .../qgsvectorgradientcolorrampv2dialog.cpp | 42 ++++++++++++++----- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/gui/symbology-ng/qgssymbollayerv2widget.cpp b/src/gui/symbology-ng/qgssymbollayerv2widget.cpp index ce57652eda05..fd79a7292ae0 100644 --- a/src/gui/symbology-ng/qgssymbollayerv2widget.cpp +++ b/src/gui/symbology-ng/qgssymbollayerv2widget.cpp @@ -86,6 +86,8 @@ void QgsSimpleLineSymbolLayerV2Widget::colorChanged() { #if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog ); #else QColor color = QColorDialog::getColor( mLayer->color(), this ); @@ -233,6 +235,8 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setColorBorder() { #if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed QColor borderColor = QColorDialog::getColor( mLayer->borderColor(), this, "", QColorDialog::DontUseNativeDialog ); #else QColor borderColor = QColorDialog::getColor( mLayer->borderColor(), this ); @@ -248,6 +252,8 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setColorFill() { #if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog ); #else QColor color = QColorDialog::getColor( mLayer->color(), this ); @@ -327,6 +333,8 @@ void QgsSimpleFillSymbolLayerV2Widget::setColor() { #if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog ); #else QColor color = QColorDialog::getColor( mLayer->color(), this ); @@ -342,6 +350,8 @@ void QgsSimpleFillSymbolLayerV2Widget::setBorderColor() { #if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed QColor color = QColorDialog::getColor( mLayer->borderColor(), this, "", QColorDialog::DontUseNativeDialog ); #else QColor color = QColorDialog::getColor( mLayer->borderColor(), this ); @@ -665,6 +675,8 @@ void QgsLineDecorationSymbolLayerV2Widget::colorChanged() { #if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog ); #else QColor color = QColorDialog::getColor( mLayer->color(), this ); @@ -861,6 +873,8 @@ void QgsFontMarkerSymbolLayerV2Widget::setColor() { #if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog ); #else QColor color = QColorDialog::getColor( mLayer->color(), this ); diff --git a/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp b/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp index 01e713b09e17..45138722a9f3 100644 --- a/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp +++ b/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp @@ -176,6 +176,8 @@ void QgsSymbolV2SelectorDialog::setSymbolColor() { #if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed QColor color = QColorDialog::getColor( mSymbol->color(), this, "", QColorDialog::DontUseNativeDialog ); #else QColor color = QColorDialog::getColor( mSymbol->color(), this ); diff --git a/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp b/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp index 1f40e768020f..917679fd746a 100644 --- a/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp +++ b/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp @@ -73,7 +73,14 @@ void QgsVectorGradientColorRampV2Dialog::updatePreview() void QgsVectorGradientColorRampV2Dialog::setColor1() { +#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) + // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed + QColor color = QColorDialog::getColor( mRamp->color1(), this, "", QColorDialog::DontUseNativeDialog ); +#else QColor color = QColorDialog::getColor( mRamp->color1(), this ); +#endif if ( !color.isValid() ) return; mRamp->setColor1( color ); @@ -82,7 +89,14 @@ void QgsVectorGradientColorRampV2Dialog::setColor1() void QgsVectorGradientColorRampV2Dialog::setColor2() { +#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) + // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed + QColor color = QColorDialog::getColor( mRamp->color2(), this, "", QColorDialog::DontUseNativeDialog ); +#else QColor color = QColorDialog::getColor( mRamp->color2(), this ); +#endif if ( !color.isValid() ) return; mRamp->setColor2( color ); @@ -114,7 +128,14 @@ void QgsVectorGradientColorRampV2Dialog::stopDoubleClicked( QTreeWidgetItem* ite { if ( column == 0 ) { +#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) + // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // FIXME need to also check max QT_VERSION when Qt bug fixed + QColor color = QColorDialog::getColor( item->data( 0, StopColorRole ).value(), this, "", QColorDialog::DontUseNativeDialog ); +#else QColor color = QColorDialog::getColor( item->data( 0, StopColorRole ).value(), this ); +#endif if ( !color.isValid() ) return; setStopColor( item, color ); @@ -153,13 +174,19 @@ void QgsVectorGradientColorRampV2Dialog::stopDoubleClicked( QTreeWidgetItem* ite void QgsVectorGradientColorRampV2Dialog::addStop() { - // Qt 4.7 Mac Cocoa bug: calling QInputDialog::getInt after QColorDialog::getColor will freeze app - // workaround: call QColorDialog::getColor below instead of here -#ifndef QT_MAC_USE_COCOA +#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) + // Native Mac dialog works only for Qt Carbon + // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 + // also Qt 4.7 Mac Cocoa bug: calling QInputDialog::getInt after QColorDialog::getColor will freeze app + // workaround: call QColorDialog::getColor below instead of here, + // but not needed at this time because of the other Qt bug + // FIXME need to also check max QT_VERSION when Qt bug(s) fixed + QColor color = QColorDialog::getColor( QColor(), this, "", QColorDialog::DontUseNativeDialog ); +#else QColor color = QColorDialog::getColor( QColor(), this ); +#endif if ( !color.isValid() ) return; -#endif bool ok; int val = 50; @@ -179,13 +206,6 @@ void QgsVectorGradientColorRampV2Dialog::addStop() if ( !ok ) return; - // Qt 4.7 Mac Cocoa bug workaround: call QColorDialog::getColor here instead of above -#ifdef QT_MAC_USE_COCOA - QColor color = QColorDialog::getColor( QColor(), this ); - if ( !color.isValid() ) - return; -#endif - double key = val / 100.0; QStringList lst; lst << "." << QString::number( val, 'f', 0 );