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


C++ QLayoutItem::layout方法代码示例

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


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

示例1: setVertical

void MiniProgrammerUI::setVertical(bool vertical)
{
    if(m_isVertical == vertical)
        return;

    m_isVertical = vertical;

    QBoxLayout *from = ui->horLayout;
    QBoxLayout *to = ui->vertLayout;

    if(!vertical)
        std::swap(from, to);

    while(from->count() != 0)
    {
        QLayoutItem *i = from->takeAt(0);
        if(i->layout())
        {
            i->layout()->setParent(0);
            to->addLayout(i->layout());
        }
        else
            to->addItem(i);
    }

    delete to->takeAt(to->count()-1);
    to->addStretch(1);
}
开发者ID:Tasssadar,项目名称:Lorris,代码行数:28,代码来源:miniprogrammerui.cpp

示例2: QLineEdit

AskColorDialog::AskColorDialog(QColor initial, QWidget *parent) :
	QColorDialog(initial, parent)
{
	hexcode = new QLineEdit( this);
	hexcode->setMaxLength(9);
	QLayout *layout = this->layout();

	// find a nice spot in the layout...
	for (int k=0; k<2; k++) if (layout) {
		for (int i=2; i>=0; i--) {
			QLayoutItem *test = layout->itemAt(i);
			if (test) if (test->layout()) {
				layout = test->layout();
				//qDebug("ok %d (%d)",i,k);
				break;
			}
		}
	}

	if (layout) layout->addWidget(hexcode);

	connect(hexcode,SIGNAL(textEdited(QString)),this,SLOT(setHex()));
	connect(this,SIGNAL(currentColorChanged(QColor)),this,SLOT(updateHex()));


	setOption(ShowAlphaChannel, true);
	updateHex();
	setHex();
}
开发者ID:cfcohen,项目名称:openbrf,代码行数:29,代码来源:askColorDialog.cpp

示例3: stopButtonClicked

void MainWindow::stopButtonClicked()
{
    player->stop();
    playPauseButton->setText("Play");
    progressSlider->setValue(0);
    subtitleTimer->stop();

    //Reload subtitles
    mysubs = getsubtitles(subtitleName.toStdString());

    if ( subtitleLayout != NULL )
    {
        QLayoutItem* layoutItem;
        while((layoutItem = subtitleLayout->takeAt(0)) != NULL)
        {
            QLayoutItem* widgetItem;
            while((widgetItem = layoutItem->layout()->takeAt(0)) != NULL)
            {
                delete widgetItem->widget();
            }
            delete widgetItem;
            delete layoutItem->layout();
        }
        delete layoutItem;
    }
}
开发者ID:igormacedo,项目名称:subplayer,代码行数:26,代码来源:mainwindow.cpp

示例4: showLayout

static void showLayout(QLayout *layout)
{
  for(GLint i=0; i<layout->count(); ++i) {
    QLayoutItem *item = layout->itemAt(i);
    if(item->widget()) { item->widget()->show(); }
    if(item->layout()) { showLayout(item->layout()); }
  }
}
开发者ID:daniel86,项目名称:regen,代码行数:8,代码来源:video-player-widget.cpp

示例5: recursiveEnable

void WizardPageEnvOptions::recursiveEnable( QLayout *layout, bool enable )
{
	int numChildren = layout->count();
	for( int c = 0; c < numChildren; ++c ) {
		QLayoutItem *item = layout->itemAt( c );
		if( item->layout() )
			recursiveEnable( item->layout(), enable );
		else if( item->widget() )
			item->widget()->setEnabled( enable );
	}
}
开发者ID:sansumbrella,项目名称:TinderBox,代码行数:11,代码来源:WizardPageEnvOptions.cpp

示例6: clearLayout

void EditorWindow::clearLayout(QLayout *layout)
{
    QLayoutItem *child;
    while ((child = layout->takeAt(0)) != 0) {
        if(child->layout() != 0)
            clearLayout( child->layout() );
        else if(child->widget() != 0)
            delete child->widget();

        delete child;
    }
}
开发者ID:tedr56,项目名称:DynaMapEditor,代码行数:12,代码来源:editorwindow.cpp

示例7: recursiveDeleteLater

void editSimulators::recursiveDeleteLater(QLayout * parentLayout) {

    QLayoutItem * item;
    while ((item = parentLayout->takeAt(0))) {
        if (item->widget() && item->widget() != ui->addEnv)
            item->widget()->deleteLater();
        if (item->layout())
            recursiveDeleteLaterloop(item->layout());
        delete item;
    }

}
开发者ID:ajc158,项目名称:spinecreator,代码行数:12,代码来源:editsimulators.cpp

示例8: recursiveDeleteLater2

void recursiveDeleteLater2(QLayout * parentLayout) {

    QLayoutItem * item;
    while ((item = parentLayout->takeAt(0))) {
        if (item->widget())
            item->widget()->deleteLater();
        if (item->layout())
            recursiveDeleteLater2(item->layout());
    }
    parentLayout->deleteLater();

}
开发者ID:ajc158,项目名称:spinecreator,代码行数:12,代码来源:layoutaliaseditdialog.cpp

示例9: clearLayout

void clearLayout(QLayout *layout){
    QLayoutItem *item;
    while((item = layout->takeAt(0))) {
        if (item->layout()) {
            clearLayout(item->layout());
            delete item->layout();
        }
        if (item->widget()) {
            delete item->widget();
        }
        delete item;
    }
}
开发者ID:orgnnice,项目名称:OrgNNice,代码行数:13,代码来源:todo.cpp

示例10: setLayoutWidgetsVisibility

void BaseTrackView::setLayoutWidgetsVisibility(QLayout *layout, bool visible)
{
    for (int i = 0; i < layout->count(); ++i) {
        QLayoutItem *item = layout->itemAt(i);
        if (item->layout()) {
            setLayoutWidgetsVisibility(item->layout(), visible);
        } else {
            QWidget *widget = item->widget();
            if (widget)
                widget->setVisible(visible);
        }
    }
}
开发者ID:eriser,项目名称:JamTaba,代码行数:13,代码来源:BaseTrackView.cpp

示例11: clear_layout

void clear_layout(QLayout* layout)
{
    for (int i = layout->count(); i > 0; --i)
    {
        QLayoutItem* item = layout->takeAt(0);

        if (item->layout())
            clear_layout(item->layout());
        else item->widget()->deleteLater();

        delete item;
    }
}
开发者ID:boberfly,项目名称:gafferDependencies,代码行数:13,代码来源:miscellaneous.cpp

示例12: storeFilterValue

void ParameterWidget::storeFilterValue(QDate date)
{
  QObject *filter = (QObject *)sender();
  QLayoutItem *test;
  QLayoutItem *test2;
  QLayoutItem *child;
  QLayoutItem *child2;
  QGridLayout *layout;
  QHBoxLayout *layout2;
  QWidget *found;
  XComboBox *mybox;
  int foundRow = 0;

  for (int i = 1; i < _filtersLayout->rowCount(); i++)
  {
    test = _filtersLayout->itemAtPosition(i, 1);
    if (test)
    {
      layout = (QGridLayout *)test->layout();
      child =layout->itemAtPosition(0, 0);
      layout2 = (QHBoxLayout *)child->layout()->itemAt(0);
      child2 = layout2->itemAt(0);
      found = child2->widget();

      if (found == filter )
        foundRow = i;
    }
  }

  test2 = _filtersLayout->itemAtPosition(foundRow, 0)->layout()->itemAt(0);
  mybox = (XComboBox*)test2->widget();
  QString currText = mybox->currentText();
  QPair<QString, ParameterWidgetTypes> tempPair = _types[currText];

  _filterValues[foundRow] = qMakePair(tempPair.first, QVariant(date));
  //if (!mybox->currentText().isEmpty())
  //{
  //_usedTypes->removeAll(mybox->currentText());
  
  if (!_usedTypes.isEmpty())
    _usedTypes.remove(foundRow);

  _usedTypes[foundRow] = mybox->currentText();
  _addFilterRow->setDisabled(false);
  repopulateComboboxes();

  emit updated();
}
开发者ID:,项目名称:,代码行数:48,代码来源:

示例13: emptyLayout

/*Dato un layout, elimina il suo contenuto, "distruggendo" gli oggetti che contiene*/
void FormPerson::emptyLayout(QLayout * layout)
{
    QLayoutItem * item;
    QLayout * sublayout;
    QWidget * widget;

    // Per ciascun oggetto conenuto nel layout
    while ((item = layout->takeAt(0)))
    {
        // Se l'oggetto è un layout, ricorsivamente richiamo questa funzione
        if ((sublayout = item->layout()) != 0)
        {           
            emptyLayout(sublayout);
        }
        else if ((widget = item->widget()) != 0) // ...se invece l'oggetto è un widget ..
        {
            widget->hide(); // nascondo il widget
            layout->removeWidget(widget); // rimuovo il widget dal layout
            delete widget; // distruggo il widget
        }
        else //...in qualsiasi altro caso ...
        {
            // NOTA: in realtà non so quando avviene questo evento

            // rimuovo l'oggetto dal layout
            layout->removeItem(item);
            // distruggo l'oggetto
            delete item;

            qDebug() << "Perchè sono qui? Dovremo capirlo prima o poi!!!";
        }
    }
}
开发者ID:JSalvo,项目名称:Scadenziario,代码行数:34,代码来源:formperson.cpp

示例14: clearSpacing

void StatusBar::clearSpacing(QLayout *lp)
{
    // Traverse the structure of the given layout ensuring that each object takes
    // no extra space. Start with the layout itself.
    lp->setMargin(0);
    lp->setSpacing(0);

    // Now examine its children, if any.
    int numItems = lp->count();
    for (int i = 0; i < numItems; ++i) {
	QLayoutItem *child = lp->itemAt(i);

	// Recursively examine any nested layouts.
	QLayout *l = child->layout();
	if (l) {
	    clearSpacing(l);
	    continue;
	}

	// Remove any spacer items.
	// Careful!! The list will shrink!
	QSpacerItem *s = child->spacerItem();
	if (s) {
	    lp->removeItem(s);
	    delete s;
	    --numItems;
	    --i;
	}
    }
}
开发者ID:goodwinos,项目名称:pcp,代码行数:30,代码来源:statusbar.cpp

示例15: layoutDeleteChildren

void layoutDeleteChildren(QLayout *layout) {
    while(layout->count() > 0) {
        QLayoutItem* child;
        if ((child = layout->takeAt(0)) != nullptr) {
            if (child->layout()) {
                layoutDeleteChildren(child->layout());
            }
            if (dynamic_cast<QToolButton*>(child->widget())) {
                delete child;
                break;
            }
            delete child->widget();
            delete child;
        }
    }
}
开发者ID:swift,项目名称:swift,代码行数:16,代码来源:QtVCardWidget.cpp


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