本文整理汇总了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);
}
示例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();
}
示例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;
}
}
示例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()); }
}
}
示例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 );
}
}
示例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;
}
}
示例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;
}
}
示例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();
}
示例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;
}
}
示例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);
}
}
}
示例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;
}
}
示例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();
}
示例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!!!";
}
}
}
示例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;
}
}
}
示例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;
}
}
}