00001 00014 #include "QtFont.h" 00015 00016 #include <string> 00017 00018 using std::string; 00019 00020 QtFont:: 00021 QtFont() 00022 : m_font( QFont ("times") ), 00023 m_flag( false ) 00024 { 00025 } 00026 00027 QtFont:: 00028 QtFont ( const std::string & family, int pointsize, int weight, bool italic ) 00029 :m_font( family.c_str(), pointsize, weight, italic ), 00030 m_flag( false ) 00031 { 00032 } 00033 00034 QtFont:: 00035 QtFont( const QFont& qfont ) 00036 { 00037 m_font = qfont; 00038 m_flag = true; 00039 } 00040 00041 QtFont:: 00042 ~QtFont() 00043 { 00044 } 00045 00046 string 00047 QtFont:: 00048 family() const 00049 { 00050 QString qstr = m_font.family(); 00051 00052 return qstr.latin1(); 00053 } 00054 00055 void 00056 QtFont:: 00057 setFamily ( const std::string & family ) 00058 { 00059 m_font.setFamily( family.c_str() ); 00060 } 00061 00062 int 00063 QtFont:: 00064 pointSize() const 00065 { 00066 return m_font.pointSize(); 00067 } 00068 00069 void 00070 QtFont:: 00071 setPointSize( int pointsize ) 00072 { 00073 m_font.setPointSize( pointsize ); 00074 } 00075 00076 int 00077 QtFont:: 00078 weight () const 00079 { 00080 return m_font.weight(); 00081 } 00082 00083 void 00084 QtFont:: 00085 setWeight( int weight ) 00086 { 00087 m_font.setWeight( weight ); 00088 } 00089 00090 bool 00091 QtFont:: 00092 italic () const 00093 { 00094 return m_font.italic(); 00095 } 00096 00097 void 00098 QtFont:: 00099 setItalic( bool enable ) 00100 { 00101 m_font.setItalic( enable ); 00102 } 00103 00104 const QFont & 00105 QtFont:: 00106 font() const 00107 { 00108 return m_font; 00109 } 00110 00111 void 00112 QtFont:: 00113 setFont( const QFont & qfont ) 00114 { 00115 m_font = qfont; 00116 m_flag = true; 00117 } 00118 00119 void 00120 QtFont:: 00121 unsetFont() 00122 { 00123 m_flag = false; 00124 } 00125 00126 bool 00127 QtFont:: 00128 isSet() 00129 { 00130 return m_flag; 00131 }