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