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

List:       kde-devel
Subject:    kpart layout manager
From:       Shaun Jackman <sjackman () shaw ! ca>
Date:       2002-05-31 8:10:52
[Download RAW message or body]

The main widget of my kpart needs a QGridLayout to lay itself out. I 
can't seem to figure out how to get my kpart widget's layout manager 
to play nicely with the layout manager of the main app window. 
Unfortunately, the QGridLayout() constructor is crashing. I know the 
parent has a layout, because if I construt the QGridLayout with the 
parent widget instead of the parent layout, it complains parent 
already has a layout.

I've attached a small code snippet that should have the important 
stuff. If someone could help me out here I'd greatly appreciate it. 
I'm stumped.

Thanks,
Shaun

Editor::Editor( QWidget* parent, const char* name)
		: QWidget( parent, name)
{
	QGridLayout* grid = new QGridLayout( parent->layout());
	grid->setColStretch(1, 1);
	grid->setColStretch(2, 1);
	grid->setSpacing(4);
	grid->setMargin(4);
	
	mFile = new QLabel( "filename", this);
	grid->addMultiCellWidget(mFile, 0, 0, 0, 3);
	// clip more widgets follow
}

Kid3Part::Kid3Part( QWidget* parent, const char* name)
    : KParts::ReadWritePart( parent, name)
{
    // we need an instance
    setInstance( Kid3PartFactory::instance() );

    // this should be your custom internal widget
    m_widget = new Editor( parent, "id3editor");
    m_widget->setFocus();

    // notify the part that this is our internal widget
    setWidget( m_widget);
    m_widget->show();

    // clip more stuff
}
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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