setupGUI() once again !!!

Sébastien Laoût sebastien.laout at
Tue Jun 15 22:15:26 BST 2004


Sorry, I'm late for this concern !

But I've browsed the patchs and I miss another automatisms :

Toggle menubar, toolbar, statusbar are left to the programer !
Idem for the save of them states.

So, after searching on how to do that for my app, I finnaly found !!
I propose to add the following lines/methods :


void KMainWindow::setupGUI( int options ) {
	// Do them if the corresponding options are set :
	m_actShowMenubar->setChecked(   menuBar()->isShown()   );
	m_actShowToolbar->setChecked(   toolBar()->isShown()   );
	m_actShowStatusbar->setChecked( statusBar()->isShown() );
	// (but just after the createGUI(), of course !)
	// m_act... are of course KToggleActions* I must keep in my
	//  app (don't want to get them by string) : have it
	//  automatized will save those variables.

void KMainWindow::toggleMenuBar()
	if (menuBar()->isVisible())

	saveMainWindowSettings( KGlobal::config(), autoSaveGroup() );

void KMainWindow::toggleToolBar()
	if (toolBar()->isVisible())

	saveMainWindowSettings( KGlobal::config(), autoSaveGroup() );

void KMainWindow::toggleStatusBar()
	if (statusBar()->isVisible())

	saveMainWindowSettings( KGlobal::config(), autoSaveGroup() );


So, we won't even to bother of toggling stuff (that was difficult to
find for me).

And it's more logical : if we want a toolbar we want to be able to
show/hide it. Idem for menubar and statusbar (in the cunter case, the
app doesn't want to be a KDE app !!!). Those tasks are boring and
repetitive tasks.

Perhapse the problem should also be solved for apps with more than one
toolbar in a similar way.

Perhapse it's already integrated and I'm wrong.

My two cents (a lot of value for me ;-) ).

Sébastien Laoût.

More information about the kde-core-devel mailing list