From 29c896314d287024edadb032d6b8df8e6dcfecb5 Mon Sep 17 00:00:00 2001 From: mzn Date: Tue, 11 Apr 2006 11:26:42 +0000 Subject: [PATCH] Fix for bug IPAL12144. --- src/LightApp/LightApp_Application.cxx | 46 ++++++++++++++------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index b711b24cd..4c4a9a615 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -211,6 +211,30 @@ myPrefs( 0 ) #endif connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) ); + + // Set existing font for the python console in resources + if( !aResMgr->hasValue( "PyConsole", "font" ) ) + return; + + QFont f = aResMgr->fontValue( "PyConsole", "font" ); + QFontDatabase fdb; + QStringList famdb = fdb.families(); + + if ( famdb.contains(f.family()) || !aResMgr->hasValue( "PyConsole", "additional_families" ) ) + return; + + QStringList anAddFamilies = QStringList::split( ";", aResMgr->stringValue( "PyConsole", "additional_families" ) ); + QString aFamily; + for ( QStringList::Iterator it = anAddFamilies.begin(); it != anAddFamilies.end(); ++it ) + { + aFamily = *it; + if ( famdb.contains(aFamily) ) + { + f.setFamily( aFamily ); + aResMgr->setValue( "PyConsole", "font", f ); + break; + } + } } /*!Destructor. @@ -999,28 +1023,6 @@ void LightApp_Application::addWindow( QWidget* wid, const int flag, const int st f = ( ( PythonConsole* )wid )->font(); resourceMgr()->setValue( "PyConsole", "font", f ); } - - // Try to set one of additional families (if it exists in the font database) - QFontDatabase fdb; - QStringList aDatabaseFamilies = fdb.families(); - - if ( !aDatabaseFamilies.contains(f.family()) && - resourceMgr()->hasValue( "PyConsole", "additional_families" ) ) - { - QStringList anAddFamilies = QStringList::split( ";", resourceMgr()->stringValue( "PyConsole", "additional_families" ) ); - - QString aFamily; - for ( QStringList::Iterator it = anAddFamilies.begin(); it != anAddFamilies.end(); ++it ) - { - aFamily = *it; - if ( !aDatabaseFamilies.contains(aFamily) ) - continue; - - f.setFamily( aFamily ); - resourceMgr()->setValue( "PyConsole", "font", f ); - break; - } - } } else #endif -- 2.39.2