本文整理汇总了C++中QLayout::activate方法的典型用法代码示例。如果您正苦于以下问题:C++ QLayout::activate方法的具体用法?C++ QLayout::activate怎么用?C++ QLayout::activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLayout
的用法示例。
在下文中一共展示了QLayout::activate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: previewLayoutChanged
void SmoothToolTip::previewLayoutChanged(Applet::PreviewLayoutType previewLayout) {
QLayout *layout = m_widget->layout();
switch (previewLayout) {
case Applet::NewPreviewLayout:
layout->setSpacing(0);
break;
case Applet::ClassicPreviewLayout:
default:
layout->setSpacing(3);
}
layout->activate();
}
示例2: setLayout
void QWidgetProxy::setLayout ( QObjectProxy *layoutProxy ) {
QWidget *w = widget();
QLayout *l = qobject_cast<QLayout*>( layoutProxy->object() );
if( !w || !l ) return;
QLayout *exLayout = w->layout();
if( exLayout != l ) {
if( exLayout != 0 ) {
qcDebugMsg( 2, QString("Deleting old layout.") );
delete exLayout;
}
qcDebugMsg( 2, QString("Setting layout.") );
w->setLayout( l );
l->activate();
}
else {
qcDebugMsg( 2, QString("Layout same as existing. Will do nothing.") );
}
}
示例3: updateTheme
void WindowPreview::updateTheme() {
QLayout *layout = this->layout();
m_background->clearCache();
// frame around preview:
qreal hoverLeft = 0, hoverTop = 0, hoverRight = 0, hoverBottom = 0;
qreal normalLeft = 0, normalTop = 0, normalRight = 0, normalBottom = 0;
m_background->setElementPrefix(HOVER);
m_background->getMargins(hoverLeft, hoverTop, hoverRight, hoverBottom);
m_background->setElementPrefix(NORMAL);
m_background->getMargins(normalLeft, normalTop, normalRight, normalBottom);
qreal left = qMax(normalLeft, hoverLeft);
qreal top = qMax(normalTop, hoverTop);
qreal right = qMax(normalRight, hoverRight);
qreal bottom = qMax(normalBottom, hoverBottom);
QSizeF normalSize(
normalLeft + m_previewSize.width() + normalRight,
normalTop + m_previewSize.height() + normalBottom);
m_background->setElementPrefix(HOVER);
// m_background->resizeFrame(QSizeF(
// hoverLeft + m_previewSize.width() + hoverRight,
// hoverTop + m_previewSize.height() + hoverBottom));
m_background->resizeFrame(normalSize);
m_background->setElementPrefix(NORMAL);
m_background->resizeFrame(normalSize);
// placeholder for preview:
if (m_previewSpace) {
m_previewSpace->changeSize(
left + m_previewSize.width() + right,
top + m_previewSize.height() + bottom,
QSizePolicy::Minimum,
QSizePolicy::Minimum);
m_previewSpace->invalidate();
}
layout->invalidate();
layout->activate();
update();
if (KWindowSystem::compositingActive()) {
if (m_toolTip->applet()->previewLayout() == Applet::NewPreviewLayout) {
m_taskNameLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum);
}
else {
m_taskNameLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
}
}
else {
m_taskNameLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
}
adjustSize();
}
示例4: SetOrUnsetButtonForActiveTool
void QmitkToolSelectionBox::SetOrUnsetButtonForActiveTool()
{
// we want to emit a signal in any case, whether we selected ourselves or somebody else changes "our" tool manager. --> emit before check on m_SelfCall
int id = m_ToolManager->GetActiveToolID();
// don't emit signal for shape model tools
bool emitSignal = true;
mitk::Tool* tool = m_ToolManager->GetActiveTool();
if(tool && std::string(tool->GetGroup()) == "organ_segmentation")
emitSignal = false;
if(emitSignal)
emit ToolSelected(id);
// delete old GUI (if any)
if ( m_LastToolGUI && m_ToolGUIWidget )
{
if (m_ToolGUIWidget->layout())
{
m_ToolGUIWidget->layout()->removeWidget(m_LastToolGUI);
}
//m_LastToolGUI->reparent(NULL, QPoint(0,0));
// TODO: reparent <-> setParent, Daniel fragen
m_LastToolGUI->setParent(0);
delete m_LastToolGUI; // will hopefully notify parent and layouts
m_LastToolGUI = NULL;
QLayout* layout = m_ToolGUIWidget->layout();
if (layout)
{
layout->activate();
}
}
QToolButton* toolButton(NULL);
//mitk::Tool* tool = m_ToolManager->GetActiveTool();
if (m_ButtonIDForToolID.find(id) != m_ButtonIDForToolID.end()) // if this tool is in our box
{
//toolButton = dynamic_cast<QToolButton*>( Q3ButtonGroup::find( m_ButtonIDForToolID[id] ) );
toolButton = dynamic_cast<QToolButton*>( m_ToolButtonGroup->buttons().at( m_ButtonIDForToolID[id] ) );
}
if ( toolButton )
{
// mmueller
// uncheck all other buttons
QAbstractButton* tmpBtn = 0;
QList<QAbstractButton*>::iterator it;
for(int i=0; i < m_ToolButtonGroup->buttons().size(); ++i)
{
tmpBtn = m_ToolButtonGroup->buttons().at(i);
if(tmpBtn != toolButton)
dynamic_cast<QToolButton*>( tmpBtn )->setChecked(false);
}
toolButton->setChecked(true);
if (m_ToolGUIWidget && tool)
{
// create and reparent new GUI (if any)
itk::Object::Pointer possibleGUI = tool->GetGUI("Qmitk", "GUI").GetPointer(); // prefix and postfix
QmitkToolGUI* gui = dynamic_cast<QmitkToolGUI*>( possibleGUI.GetPointer() );
//!
m_LastToolGUI = gui;
if (gui)
{
gui->SetTool( tool );
// mmueller
//gui->reparent(m_ToolGUIWidget, gui->geometry().topLeft(), true );
gui->setParent(m_ToolGUIWidget);
gui->move(gui->geometry().topLeft());
gui->show();
QLayout* layout = m_ToolGUIWidget->layout();
if (!layout)
{
layout = new QVBoxLayout( m_ToolGUIWidget );
}
if (layout)
{
// mmueller
layout->addWidget( gui );
//layout->add( gui );
layout->activate();
}
}
}
}
else
{
// disable all buttons
QToolButton* selectedToolButton = dynamic_cast<QToolButton*>( m_ToolButtonGroup->checkedButton() );
//QToolButton* selectedToolButton = dynamic_cast<QToolButton*>( Q3ButtonGroup::find( Q3ButtonGroup::selectedId() ) );
if (selectedToolButton)
{
//.........这里部分代码省略.........