20 #include "tdefontrequester.h"
23 #include <tqpushbutton.h>
25 #include <tqtooltip.h>
26 #include <tqwhatsthis.h>
28 #include <tdefontdialog.h>
32 bool onlyFixed ) : TQWidget( parent, name ),
33 m_onlyFixed( onlyFixed )
37 m_sampleLabel =
new TQLabel(
this,
"m_sampleLabel" );
38 m_button =
new TQPushButton( i18n(
"Choose..." ),
this,
"m_button" );
40 m_sampleLabel->setFrameStyle( TQFrame::StyledPanel | TQFrame::Sunken );
41 setFocusProxy( m_button );
43 layout->addWidget( m_sampleLabel, 1 );
44 layout->addWidget( m_button );
46 connect( m_button, TQT_SIGNAL( clicked() ), TQT_SLOT( buttonClicked() ) );
55 m_onlyFixed = onlyFixed;
73 void TDEFontRequester::buttonClicked()
77 if ( result == KDialog::Accepted )
84 void TDEFontRequester::displaySampleText()
86 m_sampleLabel->setFont( m_selFont );
88 int size = m_selFont.pointSize();
90 size = m_selFont.pixelSize();
92 if ( m_sampleText.isEmpty() )
93 m_sampleLabel->setText( TQString(
"%1 %2" ).arg( m_selFont.family() )
96 m_sampleLabel->setText( m_sampleText );
99 void TDEFontRequester::setToolTip()
101 TQToolTip::remove( m_button );
102 TQToolTip::add( m_button, i18n(
"Click to select a font" ) );
104 TQToolTip::remove( m_sampleLabel );
105 TQWhatsThis::remove( m_sampleLabel );
107 if ( m_title.isNull() )
109 TQToolTip::add( m_sampleLabel, i18n(
"Preview of the selected font" ) );
110 TQWhatsThis::add( m_sampleLabel,
111 i18n(
"This is a preview of the selected font. You can change it"
112 " by clicking the \"Choose...\" button." ) );
116 TQToolTip::add( m_sampleLabel,
117 i18n(
"Preview of the \"%1\" font" ).arg( m_title ) );
118 TQWhatsThis::add( m_sampleLabel,
119 i18n(
"This is a preview of the \"%1\" font. You can change it"
120 " by clicking the \"Choose...\" button." ).arg( m_title ) );
124 #include "tdefontrequester.moc"