26 #include <QFocusEvent>
27 #include <QApplication>
35 connect(
this, SIGNAL( textChanged(
const QString & ) ),
this, SLOT( slotTextChanged(
const QString & ) ) );
38 void dmsBox::setEmptyText() {
41 QPalette p=QApplication::palette();
42 QColor txc = p.color( QPalette::Active, QPalette::Text );
43 QColor bgc = p.color( QPalette::Active, QPalette::Base );
44 int r( ( txc.red() + bgc.red() )/2 );
45 int g( ( txc.green() + bgc.green() )/2 );
46 int b( ( txc.blue() + bgc.blue() )/2 );
48 p.setColor( QPalette::Active, QPalette::Text, QColor( r, g, b ) );
49 p.setColor( QPalette::Inactive, QPalette::Text, QColor( r, g, b ) );
53 setText(
"dd mm ss.s" );
55 setText(
"hh mm ss.s" );
61 KLineEdit::focusInEvent( e );
65 setPalette( QApplication::palette() );
71 KLineEdit::focusOutEvent( e );
78 void dmsBox::slotTextChanged(
const QString &t ) {
80 if ( EmptyFlag && ! t.isEmpty() ) {
84 if ( ! EmptyFlag && t.isEmpty() ) {
93 QString sTip = ( t ? i18n(
"Angle value in degrees." ) : i18n(
"Angle value in hours." ) );
98 sWhatsThis = i18n(
"This box displays an angle in degrees. "
99 "The three numbers displayed are the angle's "
100 "degrees, arcminutes, and arcseconds." );
103 sWhatsThis = i18n(
"This box displays an angle in hours. "
104 "The three numbers displayed are the angle's "
105 "hours, minutes, and seconds." );
109 sTip += i18n(
" You may enter a simple integer, or a floating-point value, "
110 "or space- or colon-delimited values specifying "
111 "degrees, arcminutes and arcseconds" );
113 sWhatsThis = i18n(
"Enter an angle value in degrees. The angle can be expressed "
114 "as a simple integer (\"12\"), a floating-point value "
115 "(\"12.33\"), or as space- or colon-delimited "
116 "values specifying degrees, arcminutes and arcseconds (\"12:20\", \"12:20:00\", "
117 "\"12 20\", \"12 20 00.0\", etc.)." );
120 sTip += i18n(
" You may enter a simple integer, or a floating-point value, "
121 "or space- or colon-delimited values specifying "
122 "hours, minutes and seconds" );
124 sWhatsThis = i18n(
"Enter an angle value in hours. The angle can be expressed "
125 "as a simple integer (\"12\"), a floating-point value "
126 "(\"12.33\"), or as space- or colon-delimited "
127 "values specifying hours, minutes and seconds (\"12:20\", \"12:20:00\", "
128 "\"12 20\", \"12 20 00.0\", etc.)." );
133 setWhatsThis( sWhatsThis );
151 setDMS( QString().sprintf(
"%02d %02d %05.2f", d.
hour(), d.
minute(), seconds ) );
167 check = dmsAngle.setFromString( text(), deg );
176 #include "dmsbox.moc"
void focusOutEvent(QFocusEvent *e)
void focusInEvent(QFocusEvent *e)
void setDMS(const QString &s)
Simply display a string.
dms createDms(bool deg=true, bool *ok=0)
Parse the text in the dmsBox as an angle.
dmsBox(QWidget *parent, bool deg=true)
Constructor for the dmsBox object.
void showInDegrees(dms t)
Display an angle using Deg/Arcmin/Arcsec.
void showInHours(dms t)
Display an angle using Hours/Min/Sec.
An angle, stored as degrees, but expressible in many ways.
void show(dms t, bool deg=true)
Display an angle.
void setDegType(bool t)
set the dmsBox to Degrees or Hours
~dmsBox()
Destructor (empty)