Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use Qt font dialog for Qt Cocoa
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15323 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
kyngchaos committed Mar 3, 2011
1 parent 62e7df7 commit 50b4cd0
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/app/composer/qgscomposerlabelwidget.cpp
Expand Up @@ -53,8 +53,8 @@ void QgsComposerLabelWidget::on_mFontButton_clicked()
if ( mComposerLabel )
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && !defined(__LP64__)
// Native Mac dialog works only for 64 bit Cocoa (observed in Qt 4.5.2, probably a Qt bug)
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerLabel->font(), this, QString(), QFontDialog::DontUseNativeDialog );
#else
QFont newFont = QFontDialog::getFont( &ok, mComposerLabel->font(), this );
Expand Down
16 changes: 8 additions & 8 deletions src/app/composer/qgscomposerlegendwidget.cpp
Expand Up @@ -169,8 +169,8 @@ void QgsComposerLegendWidget::on_mTitleFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && !defined(__LP64__)
// Native Mac dialog works only for 64 bit Cocoa (observed in Qt 4.5.2, probably a Qt bug)
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->titleFont(), this, QString(), QFontDialog::DontUseNativeDialog );
#else
QFont newFont = QFontDialog::getFont( &ok, mLegend->titleFont() );
Expand All @@ -191,8 +191,8 @@ void QgsComposerLegendWidget::on_mGroupFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && !defined(__LP64__)
// Native Mac dialog works only for 64 bit Cocoa (observed in Qt 4.5.2, probably a Qt bug)
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->groupFont(), this, QString(), QFontDialog::DontUseNativeDialog );
#else
QFont newFont = QFontDialog::getFont( &ok, mLegend->groupFont() );
Expand All @@ -213,8 +213,8 @@ void QgsComposerLegendWidget::on_mLayerFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && !defined(__LP64__)
// Native Mac dialog works only for 64 bit Cocoa (observed in Qt 4.5.2, probably a Qt bug)
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->layerFont(), this, QString(), QFontDialog::DontUseNativeDialog );
#else
QFont newFont = QFontDialog::getFont( &ok, mLegend->layerFont() );
Expand All @@ -235,8 +235,8 @@ void QgsComposerLegendWidget::on_mItemFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && !defined(__LP64__)
// Native Mac dialog works only for 64 bit Cocoa (observed in Qt 4.5.2, probably a Qt bug)
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->itemFont(), this, QString(), QFontDialog::DontUseNativeDialog );
#else
QFont newFont = QFontDialog::getFont( &ok, mLegend->itemFont() );
Expand Down
4 changes: 2 additions & 2 deletions src/app/composer/qgscomposermapwidget.cpp
Expand Up @@ -646,8 +646,8 @@ void QgsComposerMapWidget::on_mAnnotationFontButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && !defined(__LP64__)
// Native Mac dialog works only for 64 bit Cocoa (observed in Qt 4.5.2, probably a Qt bug)
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerMap->gridAnnotationFont(), this, QString(), QFontDialog::DontUseNativeDialog );
#else
QFont newFont = QFontDialog::getFont( &ok, mComposerMap->gridAnnotationFont(), this );
Expand Down
5 changes: 5 additions & 0 deletions src/app/composer/qgscomposerscalebarwidget.cpp
Expand Up @@ -240,7 +240,12 @@ void QgsComposerScaleBarWidget::on_mFontButton_clicked()

bool dialogAccepted;
QFont oldFont = mComposerScaleBar->font();
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &dialogAccepted, oldFont, 0, QString(), QFontDialog::DontUseNativeDialog );
#else
QFont newFont = QFontDialog::getFont( &dialogAccepted, oldFont, 0 );
#endif
if ( dialogAccepted )
{
mComposerScaleBar->beginCommand( tr( "Scalebar font changed" ) );
Expand Down
10 changes: 10 additions & 0 deletions src/app/composer/qgscomposertablewidget.cpp
Expand Up @@ -193,7 +193,12 @@ void QgsComposerTableWidget::on_mHeaderFontPushButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerTable->headerFont(), 0, tr( "Select Font" ), QFontDialog::DontUseNativeDialog );
#else
QFont newFont = QFontDialog::getFont( &ok, mComposerTable->headerFont(), 0, tr( "Select Font" ) );
#endif
if ( ok )
{
mComposerTable->beginCommand( tr( "Table header font" ) );
Expand All @@ -210,7 +215,12 @@ void QgsComposerTableWidget::on_mContentFontPushButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerTable->contentFont(), 0, tr( "Select Font" ), QFontDialog::DontUseNativeDialog );
#else
QFont newFont = QFontDialog::getFont( &ok, mComposerTable->contentFont(), 0, tr( "Select Font" ) );
#endif
if ( ok )
{
mComposerTable->beginCommand( tr( "Table content font" ) );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgslabeldialog.cpp
Expand Up @@ -281,8 +281,8 @@ void QgsLabelDialog::changeFont( void )

qreal fontSize = mFont.pointSizeF();
bool resultFlag;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && !defined(__LP64__)
// Native Mac dialog works only for 64 bit Cocoa (observed in Qt 4.5.2, probably a Qt bug)
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
mFont = QFontDialog::getFont( &resultFlag, mFont, this, QString(), QFontDialog::DontUseNativeDialog );
#else
mFont = QFontDialog::getFont( &resultFlag, mFont, this );
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgslabelinggui.cpp
Expand Up @@ -409,7 +409,12 @@ void QgsLabelingGui::changeTextColor()
void QgsLabelingGui::changeTextFont()
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont font = QFontDialog::getFont( &ok, lblFontPreview->font(), this, QString(), QFontDialog::DontUseNativeDialog );
#else
QFont font = QFontDialog::getFont( &ok, lblFontPreview->font(), this );
#endif
if ( ok )
{
updateFont( font );
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgslabelpropertydialog.cpp
Expand Up @@ -249,7 +249,12 @@ void QgsLabelPropertyDialog::on_mRotationSpinBox_valueChanged( double d )
void QgsLabelPropertyDialog::on_mFontPushButton_clicked()
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
mLabelFont = QFontDialog::getFont( &ok, mLabelFont, 0, tr( "Label font" ), QFontDialog::DontUseNativeDialog );
#else
mLabelFont = QFontDialog::getFont( &ok, mLabelFont, 0, tr( "Label font" ) );
#endif
if ( ok )
{
insertChangedValue( QgsPalLayerSettings::Size, mLabelFont.pointSizeF() );
Expand Down
Expand Up @@ -203,7 +203,12 @@ void QgsPointDisplacementRendererWidget::on_mLabelFontButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for QT Carbon
QFont newFont = QFontDialog::getFont( &ok, mRenderer->labelFont(), 0, tr( "Label Font" ), QFontDialog::DontUseNativeDialog );
#else
QFont newFont = QFontDialog::getFont( &ok, mRenderer->labelFont(), 0, tr( "Label Font" ) );
#endif
if ( ok )
{
mRenderer->setLabelFont( newFont );
Expand Down

0 comments on commit 50b4cd0

Please sign in to comment.