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


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

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


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

示例1: count

int QStackedWidgetProto::count()                  const
{
  QStackedWidget *item = qscriptvalue_cast<QStackedWidget*>(thisObject());
  if (item)
    return item->count();
  return 0;
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:7,代码来源:qstackedwidgetproto.cpp

示例2: 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

示例3: 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

示例4: 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

示例5:

Audio_instrument_widget *get_audio_instrument_widget(struct Patch *patch){
  QStackedWidget* tabs = g_instruments_widget->tabs;

  for(int i=0;i<tabs->count();i++){
    Audio_instrument_widget *instrument = dynamic_cast<Audio_instrument_widget*>(tabs->widget(i));
    if(instrument!=NULL && instrument->_patch.data()==patch)
      return instrument;
  }

  return NULL;
}
开发者ID:kmatheussen,项目名称:radium,代码行数:11,代码来源:Qt_instruments.cpp

示例6: 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

示例7: 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

示例8: startMasterPageMode

void PagePalette::startMasterPageMode(QString masterPage)
{
	ScribusDoc* doc = m_view->Doc;
	
	bool mustDeselect = false;
	mustDeselect |= (!doc->masterPageMode());
	mustDeselect |= (doc->masterPageMode() && doc->currentPage()->pageName() != masterPage);
	if (mustDeselect)
	{
		// We must avoid deselecting directly if doc is in an edit mode,
		// otherwise that would cause an inconsistent state. In such case,
		// fallback to normal mode by precaution
		if (doc->appMode != modeNormal)
			m_view->requestMode(modeNormal);
		m_view->Deselect(true);
	}

	QStackedWidget* stackedWidget = this->stackedWidget();
	if (stackedWidget->count() < 2)
	{
		PagePalette_MasterPages* mpWidget = new PagePalette_MasterPages(stackedWidget, m_view, masterPage);
		mpWidget->setObjectName(QString::fromLocal8Bit("PagePalette_MasterPages"));
		stackedWidget->addWidget(mpWidget);

		connect(mpWidget, SIGNAL(removePage(int )), m_scMW, SLOT(deletePage2(int )));
		connect(mpWidget, SIGNAL(finished())      , m_scMW, SLOT(editMasterPagesEnd()));
	}
	else
	{
		ScribusDoc* doc = m_view->Doc;
		PagePalette_MasterPages* mpWidget = this->masterpageWidget();
		if (mpWidget->m_view != m_view)
			mpWidget->setView(m_view, masterPage);
		mpWidget->updateMasterPageList(masterPage);
		if (doc->currentPage()->pageName() != masterPage)
			mpWidget->selectMasterPage(masterPage);
	}

	// Set focus to page palette or focus may be set to wrong document window
	this->setFocus();
	stackedWidget->setCurrentIndex(1);
}
开发者ID:andreas-vox,项目名称:ScribusCTL,代码行数:42,代码来源:pagepalette.cpp

示例9:

static vector_t *create_instruments_widget_state(void){
  vector_t *state = (vector_t *)talloc(sizeof(vector_t));

  //vector_t *names = (vector_t *)talloc(sizeof(vector_t));
  vector_t *pages = (vector_t *)talloc(sizeof(vector_t));

  //VECTOR_push_back(state, names);
  VECTOR_push_back(state, pages);

  QStackedWidget* tabs = instruments_widget->tabs;

  for(int i=0;i<tabs->count();i++){
    //VECTOR_push_back(names, talloc_strdup(tabs->tabText(i).toUtf8().constData()));
    VECTOR_push_back(pages, tabs->widget(i));
  }

  VECTOR_push_back(state, tabs->currentWidget());
  
  return state;
}
开发者ID:onukore,项目名称:radium,代码行数:20,代码来源:undo_instruments_widget.cpp

示例10: GFX_update_all_instrument_widgets

void GFX_update_all_instrument_widgets(void){
  QStackedWidget* tabs = g_instruments_widget->tabs;

  //printf("*(((((((((( Calling. Update all %d:\n",tabs->count());
  for(int i=0;i<tabs->count();i++){
    MIDI_instrument_widget *midi_instrument = dynamic_cast<MIDI_instrument_widget*>(tabs->widget(i));
    Audio_instrument_widget *audio_instrument = dynamic_cast<Audio_instrument_widget*>(tabs->widget(i));
    //printf("Update all %d: %p/%p\n",i,midi_instrument,audio_instrument);

    if(midi_instrument!=NULL){

      if(midi_instrument->patch->patchdata!=NULL)
        update_midi_instrument_widget(midi_instrument,midi_instrument->patch.data());

    }else if(audio_instrument!=NULL){

      if(audio_instrument->_patch->patchdata!=NULL)
        update_audio_instrument_widget(audio_instrument,audio_instrument->_patch.data());

    }
  }
}
开发者ID:kmatheussen,项目名称:radium,代码行数:22,代码来源:Qt_instruments.cpp

示例11: fileInfo


//.........这里部分代码省略.........
      }

      if (name.empty() == false)
      {
         strWindowTitle += ": " + QString::fromStdString(name);
      }
   }

   setWindowTitle(strWindowTitle);
   setModal(true);

   if ((mpSubsetPage != NULL) || (mpExporterPage != NULL))
   {
      QWidget* pSubsetWidget = NULL;
      if (mpSubsetPage != NULL)
      {
         pSubsetWidget = new QWidget();
         mpSubsetPage->setParent(pSubsetWidget);

         QVBoxLayout* pSubsetLayout = new QVBoxLayout(pSubsetWidget);
         if (mpExporterPage != NULL)
         {
            pSubsetLayout->setMargin(10);
         }
         else
         {
            pSubsetLayout->setMargin(0);
         }

         pSubsetLayout->setSpacing(10);
         pSubsetLayout->addWidget(mpSubsetPage);
      }

      QWidget* pExporterWidget = NULL;
      if (mpExporterPage != NULL)
      {
         pExporterWidget = new QWidget();
         mpExporterPage->setParent(pExporterWidget);

         QVBoxLayout* pExporterLayout = new QVBoxLayout(pExporterWidget);
         if (mpSubsetPage != NULL)
         {
            pExporterLayout->setMargin(10);
         }
         else
         {
            pExporterLayout->setMargin(0);
         }

         pExporterLayout->setSpacing(10);
         pExporterLayout->addWidget(mpExporterPage);
      }

      if ((pSubsetWidget != NULL) && (pExporterWidget != NULL))
      {
         QString strExporterCaption = mpExporterPage->windowTitle();
         if (strExporterCaption.isEmpty() == true)
         {
            PlugIn* pPlugIn = mpExporter->getPlugIn();
            if (pPlugIn != NULL)
            {
               strExporterCaption = QString::fromStdString(pPlugIn->getName());
            }

            if (strExporterCaption.isEmpty() == true)
            {
               strExporterCaption = "Exporter";
            }
         }

         mpTabWidget = new QTabWidget(this);
         mpTabWidget->setTabPosition(QTabWidget::North);
         mpTabWidget->addTab(pSubsetWidget, "Subset");
         mpTabWidget->addTab(pExporterWidget, strExporterCaption);
         pStack->addWidget(mpTabWidget);
      }
      else if (pSubsetWidget != NULL)
      {
         pStack->addWidget(pSubsetWidget);
         pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
      }
      else if (pExporterWidget != NULL)
      {
         pStack->addWidget(pExporterWidget);
      }
   }

   if (pStack->count() == 0)
   {
      QLabel* pNoOptionsLabel = new QLabel("No options are available", this);
      pNoOptionsLabel->setAlignment(Qt::AlignCenter);
      pNoOptionsLabel->setMinimumSize(250, 100);

      pStack->addWidget(pNoOptionsLabel);
   }

   // Connections
   VERIFYNR(connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept())));
   VERIFYNR(connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject())));
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:101,代码来源:ExportOptionsDlg.cpp

示例12: if

void Form3::keyPressEvent(QKeyEvent * ev) {
    QStackedWidget *sw = ui->stackedWidget;
    //if(!testEnabled) return;
    bool ok;
    ix = sw->currentIndex();
    int key = ev->key();
    if(key == Qt::Key_F12) {
        if(testMode == true) {
            QMessageBox mb;
            //mb.setText(tr("Ручная правка данных отключена"));
            //mb.setInformativeText( tr("Чтение из аппаратуры восстановлено") );
            mb.exec();
            testMode=false;
        }
    }
    else if(key == Qt::Key_F11) {
        QString text = QInputDialog::getText(this,
            "",//tr("Ручная правка данных"),
            "",//tr("Чтение из аппаратуры выключено. Введите через запятую: адрес, значение"),
            QLineEdit::Normal, 0, &ok);
        if (ok && !text.isEmpty()) {
            QStringList slist = text.split(",");
            int dev=slist[0].toInt(&ok);  if(!ok) return;
            int adr=slist[1].toInt(&ok);  if(!ok) return;
            int val=slist[2].toInt(&ok);  if(!ok) return;
            valData[dev][adr] = val;
        }
        testMode = true;
    }
    else if(key == Qt::Key_Backspace) {
        ref->show();
        ref->setFocus();
    }

    else if(key == Qt::Key_Slash) { // меню ППН
        if(ix==12) { // только для
            ppnRef->show();
            ppnRef->setFocus();
        }
    }

    else
    if(key == Qt::Key_Right) { // след.страница
        // если были на слайде алгоритма, переходим сразу на 14й слайд (параметры ИК)
        if((ix>=1 && ix<=11))
            sw->setCurrentIndex(12);
        else
            sw->setCurrentIndex( (ix<(sw->count()-1))? ix+1 : 0);
    }
    else if(key == Qt::Key_Left) {// предыд.страница
        // если были на слайде алгоритма, переходим на 1й слайд
        if(ix>=1 && ix<=11)
            sw->setCurrentIndex(0);
        else if(ix==12) // если были на таблице ИК, на первый слайд с алгоритмами
            sw->setCurrentIndex(1);
        else
            sw->setCurrentIndex(ix > 0? ix-1 : sw->count()-1);


    }
    else if(key == Qt::Key_Down) { // след.слайд в группе слайдов
        if(ix==12) { // если мы на таблице ППН
            ui->sw2->setCurrentIndex(( ui->sw2->currentIndex() <ui->sw2->count()-1 )? ui->sw2->currentIndex() + 1 : 0);
        }
        else if(ix>=1 && ix<=11) { // если на алгоритмах защит
            sw->setCurrentIndex( (ix<11)? ix+1 : 1);
        }
        else if(ix==13) { // слайд дискр сигналов
            discrSlideCurr<3?discrSlideCurr++:discrSlideCurr=0;
//            switch(discrSlideCurr) {
//            case 0: // вх 151,152
//                paintEvent1(in151);
//                break;
//            case 1:
//                paintEvent1(out155az);
//                break;
//            case 2:
//                paintEvent1(out155pz);
//                break;
//            case 3:
//                paintEvent1(pca);
//                break;
//            }
            update();

        }

    }
    else if(key == Qt::Key_Up) { // предыд.страница
        if(ix==12) { // если мы на таблице ППН
            ui->sw2->setCurrentIndex((ui->sw2->currentIndex() > 0 )? ui->sw2->currentIndex()-1 : ui->sw2->count()-1);
        }
        else if(ix>=1 && ix<=11) { // если на алгоритмах защит
            sw->setCurrentIndex( (ix>1)? ix-1 : 11);
        }
        else if(ix==13) { // слайд дискр сигналов
            discrSlideCurr>0?discrSlideCurr--:discrSlideCurr=3;
            update();
        }

//.........这里部分代码省略.........
开发者ID:akadenis,项目名称:mm1,代码行数:101,代码来源:form3.cpp


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