当前位置: 首页>>代码示例>>C++>>正文


C++ QStackedWidget::removeWidget方法代码示例

本文整理汇总了C++中QStackedWidget::removeWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QStackedWidget::removeWidget方法的具体用法?C++ QStackedWidget::removeWidget怎么用?C++ QStackedWidget::removeWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QStackedWidget的用法示例。


在下文中一共展示了QStackedWidget::removeWidget方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: slotTriggered

void RemoveStackPageAction::slotTriggered()
{
    if (   !KexiUtils::objectIsA(m_receiver, "QStackedWidget")
        && /* compat */ !KexiUtils::objectIsA(m_receiver, "QWidgetStack"))
    {
        return;
    }
    QStackedWidget *stack = qobject_cast<QStackedWidget*>(m_receiver);
    QWidget *page = stack->currentWidget();

    QWidgetList list;
    list.append(page);
    KFormDesigner::Command *com = new KFormDesigner::DeleteWidgetCommand(*m_container->form(), list);

    // raise prev/next widget
    int index = stack->indexOf(page);
    if (index > 0) {
        index--;
    }
    else if (index < (stack->count()-1)) {
        index++;
    }
    else {
        index = -1;
    }
    if (index >= 0) {
        stack->setCurrentIndex(index);
    }
    stack->removeWidget(page);
    m_container->form()->addCommand(com);
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:31,代码来源:KexiStandardContainerFormWidgets.cpp

示例2: undo

void InsertPageCommand::undo()
{
    QWidget *page = m_form->objectTree()->lookup(m_name)->widget();
    QWidget *parent = m_form->objectTree()->lookup(m_parentname)->widget();

    QWidgetList list;
    list.append(page);
    KFormDesigner::Command *com = new KFormDesigner::DeleteWidgetCommand(*m_form, list);

    QByteArray classname = parent->metaObject()->className();
    if (classname == "KFDTabWidget") {
        TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(parent);
        tab->removeTab(tab->indexOf(page));
    } else if (classname == "QStackedWidget" || /* compat */ classname == "QWidgetStack") {
        QStackedWidget *stack = dynamic_cast<QStackedWidget*>(parent);
        int index = stack->indexOf(page);
        if (index > 0)
            index--;
        else if (index < (stack->count()-1))
            index++;
        else
            index = -1;

        if (index >= 0)
            stack->setCurrentIndex(index);
        stack->removeWidget(page);
    }

    com->execute();
    delete com;
}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:31,代码来源:containerfactory.cpp

示例3: getCellImp

void SplitGrid2::setCell(QWidget * w, int row, int col)
{
    Q_ASSERT( w != 0 );

    QStackedWidget* cell = getCellImp( row, col );
    Q_ASSERT( cell != 0 );
    if( cell->count() > 0 )
        cell->removeWidget( cell->widget(0) );
    cell->addWidget( w );
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:10,代码来源:SplitGrid2.cpp

示例4: wrapQWidget

SEXP 
qt_qremoveWidgetFromStack(SEXP x, SEXP index) {
    int i = asInteger(index);
    QStackedWidget *s = unwrapQObject(x, QStackedWidget);
    QWidget *w;
    if (i > 0 && i <= s->count()) {
	w = s->widget(i - 1);
	s->removeWidget(w);
	return wrapQWidget(w);
    }    
    return R_NilValue;
}
开发者ID:rforge,项目名称:qtinterfaces,代码行数:12,代码来源:containers.cpp

示例5: recreate_instruments_widget_from_state

static void recreate_instruments_widget_from_state(vector_t *state){
  QStackedWidget* tabs = instruments_widget->tabs;

  while(tabs->count()>0)
    tabs->removeWidget(tabs->currentWidget());

  //vector_t *names = (vector_t*)state->elements[0];
  vector_t *pages = (vector_t*)state->elements[0];

  for(int i=pages->num_elements-1; i>=0; i--){
    QWidget *page = (QWidget*)pages->elements[i];
    tabs->insertWidget(0,page);//,(const char*)names->elements[i]);
  }

  tabs->setCurrentWidget((QWidget*)state->elements[1]);
}
开发者ID:onukore,项目名称:radium,代码行数:16,代码来源:undo_instruments_widget.cpp

示例6: removeWidget

void QStackedWidgetProto::removeWidget(QWidget *widget)
{
  QStackedWidget *item = qscriptvalue_cast<QStackedWidget*>(thisObject());
  if (item)
    item->removeWidget(widget);
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:6,代码来源:qstackedwidgetproto.cpp


注:本文中的QStackedWidget::removeWidget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。