コード例 #1
0
void SingleConnectorInfoWidget::toStandardMode() {
	hide();

	setInEditionMode(false);

	hideIfNeeded(m_nameEditContainer);
	hideIfNeeded(m_descEditContainer);
	hideIfNeeded(m_acceptButton);
	hideIfNeeded(m_cancelButton);

	QHBoxLayout *hbLayout = new QHBoxLayout();
	hbLayout->addWidget(m_type);
	hbLayout->addSpacerItem(new QSpacerItem(10,0));
	hbLayout->addWidget(m_nameLabel);
	m_nameLabel->show();
	hbLayout->addWidget(m_nameDescSeparator);
	m_nameDescSeparator->show();
	hbLayout->addWidget(m_descLabel);
	m_descLabel->show();
	hbLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding));
	hbLayout->addWidget(m_removeButton);

	QVBoxLayout *layout = (QVBoxLayout*)this->layout();
	layout->addLayout(hbLayout);

	setFixedHeight(SingleConnectorHeight);
	setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
	updateGeometry();

	show();
	setFocus();
}
コード例 #2
0
void SingleConnectorInfoWidget::toEditionMode() {
	hide();

	setInEditionMode(true);

	hideIfNeeded(m_nameLabel);
	hideIfNeeded(m_nameDescSeparator);
	hideIfNeeded(m_descLabel);

	createInputs();

	// first row
	QHBoxLayout *firstRowLayout = new QHBoxLayout();
	firstRowLayout->addWidget(m_type);
	firstRowLayout->addSpacerItem(new QSpacerItem(10,0));
	firstRowLayout->addWidget(m_nameEditContainer);
	firstRowLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding));
	firstRowLayout->addWidget(m_removeButton);
	m_nameEditContainer->show();

	// second row
	m_descEditContainer->show();

	// third row
	if(!m_acceptButton) {
		m_acceptButton = new QPushButton(QObject::tr("Accept"),this);
		connect(m_acceptButton,SIGNAL(clicked()),this,SLOT(editionCompleted()));
	}
	m_acceptButton->show();

	if(!m_cancelButton) {
		m_cancelButton = new QPushButton(QObject::tr("Cancel"),this);
		connect(m_cancelButton,SIGNAL(clicked()),this,SLOT(editionCanceled()));
	}
	m_cancelButton->show();

	QHBoxLayout *thirdRowLayout = new QHBoxLayout();
	thirdRowLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding));
	thirdRowLayout->addWidget(m_acceptButton);
	thirdRowLayout->addWidget(m_cancelButton);


	QVBoxLayout *layout = (QVBoxLayout*)this->layout();
	layout->addLayout(firstRowLayout);
	layout->addWidget(m_descEditContainer);
	layout->addLayout(thirdRowLayout);


	setFixedHeight(SingleConnectorHeight*4);
	setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
	updateGeometry();

	show();
	setFocus();

	emit editionStarted();
}
コード例 #3
0
void KMdiDockContainer::removeWidget( KDockWidget* dwdg )
{
	KDockWidget * w = dwdg;
	if ( !m_map.contains( w ) )
		return; //we don't have this widget in our container

	kdDebug( 760 ) << k_funcinfo << endl;
	//lower the tab. ( TODO: needed? )
	int id = m_map[ w ];
	if ( m_tb->isTabRaised( id ) )
	{
		m_tb->setTab( id, false );
		tabClicked( id );
	}

	m_tb->removeTab( id );
	m_ws->removeWidget( w );
	m_map.remove( w );
	m_revMap.remove( id );
	if ( m_overlapButtons.contains( w ) )
	{
		( ::tqqt_cast<KDockWidgetHeader*>( w->getHeader() ) )->removeButton( m_overlapButtons[ w ] );
		m_overlapButtons.remove( w );
	}
	KDockContainer::removeWidget( w );
	itemNames.remove( w->name() );
	tabCaptions.remove( w->name() );
	tabTooltips.remove( w->name() );
	hideIfNeeded();
}