From: mzn Date: Tue, 11 Apr 2006 11:26:42 +0000 (+0000) Subject: Fix for bug IPAL12144. X-Git-Tag: T3_2_0b1_pre1~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=29c896314d287024edadb032d6b8df8e6dcfecb5;p=modules%2Fgui.git Fix for bug IPAL12144. --- 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