[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    When stealing Karbon code...
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2005-09-17 18:09:28
Message-ID: 200509172009.29231.boud () valdyas ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


I came across the following code (simplified)

QWidget *
KarbonView::createContainer( QWidget *parent, int index, const QDomElement 
&element, int &id )
{
	if( element.attribute( "name" ) == "Tools" )
	{
		if( !m_toolbox )
			m_toolbox = new VToolBox( (KarbonPart *)m_part, mainWindow(), "Tools" );
		else
		{
			m_toolbox = dynamic_cast<VToolBox *>( shell()->toolBar( "Tools" ) );
			mainWindow()->moveDockWindow( m_toolbox, Qt::DockLeft, false, 0 );
			return m_toolbox;
		}

		m_toolbox->setupTools();
		connect( m_toolbox, SIGNAL( activeToolChanged( VTool * ) ), this, 
SLOT( slotActiveToolChanged( VTool * ) ) );

		mainWindow()->moveDockWindow( m_toolbox, Qt::DockLeft, false, 0 );
		part()->toolController()->setActiveView( this );
		return m_toolbox;
	}

	return KXMLGUIBuilder::createContainer( parent, index, element, id );
}


I think the if (!m_toolbox) {} else {} will never work, because the toolbox is 
deleted in removeContainer, so the second part will never be called. I use 
this code in Krita with Krita's improved version of Karbon's toolbox (soon to 
be available from kofficeui), without that part, and it works perfectly.

I'm also under the impression that the moveDockWindow(m_tooblox...) doesn't do 
much; cetero censeo that deleting and recreating widgets when switching 
between split views is something no decent toolkit should impose on us poor 
hackers :-).

-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi

[Attachment #5 (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic