[Kstars-devel] KDE/kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Wed Aug 16 07:42:40 CEST 2006


SVN commit 573429 by harris:

Finally got rid of the extra empty item in the status bar.  
slotShowGUIItems gets triggered at startup by applyConfig(), which was 
causing the coordinate fields in the statusbar to be added again.  I 
added a provision to avoid double-adding fields.

CCMAIL: kstars-devel at kde.org



 M  +7 -4      kstarsactions.cpp  
 M  +2 -2      kstarsinit.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/kstarsactions.cpp #573428:573429
@@ -972,7 +972,7 @@
 
 //toggle display of GUI Items on/off
 void KStars::slotShowGUIItem( bool show ) {
-//Toolbars
+	//Toolbars
 	if ( sender()->objectName() == QString( "show_mainToolBar" ) ) {
 		Options::setShowMainToolBar( show );
 		if ( show ) toolBar("kstarsToolBar")->show();
@@ -996,7 +996,8 @@
 		if ( show ) {
 			//To preserve the order (AzAlt before RADec), we have to remove
 			//the RADec field and then add both back.
-			if ( Options::showRADecField() ) statusBar()->removeItem( 2 );
+			if ( statusBar()->hasItem(1) ) statusBar()->removeItem( 1 );
+			if ( statusBar()->hasItem(2) ) statusBar()->removeItem( 2 );
 
 			QString s = "000d 00m 00s,   +00d 00\' 00\""; //only need this to set the width
 			statusBar()->insertPermanentFixedItem( s, 1 );
@@ -1017,8 +1018,10 @@
 		Options::setShowRADecField( show );
 		if ( show ) {
 			QString s = "000d 00m 00s,   +00d 00\' 00\""; //only need this to set the width
-			statusBar()->insertPermanentFixedItem( s, 2 );
-			statusBar()->setItemAlignment( 2, Qt::AlignRight | Qt::AlignVCenter );
+			if ( ! statusBar()->hasItem(2) ) {
+				statusBar()->insertPermanentFixedItem( s, 2 );
+				statusBar()->setItemAlignment( 2, Qt::AlignRight | Qt::AlignVCenter );
+			}
 			statusBar()->changeItem( QString(), 2 );
 		} else {
 			statusBar()->removeItem( 2 );
--- trunk/KDE/kdeedu/kstars/kstars/kstarsinit.cpp #573428:573429
@@ -452,13 +452,13 @@
 
 	QString s = "000d 00m 00s,   +00d 00\' 00\""; //only need this to set the width
 	if ( Options::showAltAzField() ) {
-		statusBar()->insertItem( s, 1 );
+		statusBar()->insertPermanentFixedItem( s, 1 );
 		statusBar()->setItemAlignment( 1, Qt::AlignRight | Qt::AlignVCenter );
 		statusBar()->changeItem( QString(), 1 );
 	}
 
 	if ( Options::showRADecField() ) {
-		statusBar()->insertItem( s, 2 );
+		statusBar()->insertPermanentFixedItem( s, 2 );
 		statusBar()->setItemAlignment( 2, Qt::AlignRight | Qt::AlignVCenter );
 		statusBar()->changeItem( QString(), 2 );
 	}


More information about the Kstars-devel mailing list