[Kstars-devel] kdeedu/kstars/kstars

Pablo de Vicente p.devicente at wanadoo.es
Sun Oct 3 21:56:15 CEST 2004


CVS commit by pvicente: 

Modifications on Jason's usability improvement.

- Added a QToolTip which explains what to enter on a dmsBox. It is almost identical
  to QWhatsThis text, except that I have stripped off the examples.
  I think that this QToolTip may be very useful for the calculator, where there are
  many dmsBox'es which otherwise would need a QToolTip per each UI.

- Moved setEmptyText() call from the constructor to the dmsBox::setDegType() function.
  The problem here was that when calling for the first time a calculator module or
  the manual focusing window, bot the RA and Dec boxes where showing the string "dd mm ss"
  whereas RA should show "hh mm ss" and Dec "dd mm ss". This may be fixed by adding in
  the constructor of each calculator module a call to raBox->setDegType(FALSE). This
  call fixes the previous bug only if the RA box receives the focus and nothing is entered
  and later another dmsBox receives the focus. However it does not fix the bug the
  first time you call the calculator module or the manual focus window.

  If we move the setEmptyText() inside the setDegType() function we manage to get a correct
  "hh mm ss" string in the RA boxes, even the first time we open the window with those
  dmsBox'es. On the other hand placing the setEmptyText() call inside the setDegType()
  function and the end of it, we are sure that it is being executed using the same sequence
  as when it was in the constructor.

  However there is a small bug: the "hh mm ss" appears in black instead of being shown in
  grey. I do not understand why.

- Added a call to QPROPERTY macro in dmsbox.h. I have included it to be able to define
  a degType property which can be set when using a dmsBox from the Qt Designer. This would
  prevent calling the raBox->setDegType(FALSE) instruction in each calculator module
  constructor where it is needed.
  Unfortunately I have tested it and it does not work. I do not understand why it does not
  work. See: http://doc.trolltech.com/3.3/properties.html. I leave it here since it makes
  no harm to the code and someone of us may find what is wrong here.

CCMAIL:kstars-devel at kde.org


  M +9 -4      dmsbox.cpp   1.28
  M +1 -0      dmsbox.h   1.15


--- kdeedu/kstars/kstars/dmsbox.cpp  #1.27:1.28
@@ -24,4 +24,5 @@
 #include <qregexp.h>
 #include <qstring.h>
+#include <qtooltip.h>
 #include <qwhatsthis.h>
 
@@ -32,5 +33,4 @@ dmsBox::dmsBox(QWidget *parent, const ch
         setDegType( dg );
         
-        setEmptyText();
         
         connect( this, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotTextChanged( const QString & ) ) );
@@ -91,8 +91,13 @@ void dmsBox::setDegType( bool t ) {
         deg = t;
 
-        if ( deg )
+        if ( deg ) {
+                QToolTip::add( this, i18n( "Angle value in degrees. You may enter a simple integer \nor a floating-point value, or space- or colon-delimited values \nspecifying degrees, arcminutes and arcseconds." ) );
                 QWhatsThis::add( this, i18n( "Enter an angle value in degrees.  The angle can be expressed as a simple integer (\"45\") or floating-point (\"45.333\") value, or as space- or colon-delimited values specifying degrees, arcminutes and arcseconds (\"45:20\", \"45:20:00\", \"45:20\", \"45 20.0\", etc.)." ) );
-        else
+        } else {
+                QToolTip::add( this, i18n( "Angle value in hours. You may enter a simple integer \nor floating-point value, or space- or colon-delimited values \nspecifying hours, minutes and seconds." ) );
                 QWhatsThis::add( this, i18n( "Enter an angle value in hours.  The angle can be expressed as a simple integer (\"12\") or floating-point (\"12.333\") value, or as space- or colon-delimited values specifying hours, minutes and seconds (\"12:20\", \"12:20:00\", \"12:20\", \"12 20.0\", etc.)." ) );
+        }
+
+        setEmptyText();
 }
 

--- kdeedu/kstars/kstars/dmsbox.h  #1.14:1.15
@@ -43,4 +43,5 @@
 class dmsBox : public KLineEdit  {
 Q_OBJECT
+Q_PROPERTY (bool degType READ degType WRITE setDegType)
 
 public:




More information about the Kstars-devel mailing list