void PringKvitok::on_toolButton_print_clicked() { #if !defined(QT_NO_PRINTER) QPrinter printer(QPrinter::HighResolution); QPrintDialog *dlg = new QPrintDialog(&printer, this); dlg->setWindowTitle(tr("Настройки принтера")); if (dlg->exec() == QDialog::Accepted){ QString pg; QMapIterator<QString, QCheckBox*> i(childsCheckBox_map); ui->progressBar->setVisible(true); int count = 0; int c = 0; while (i.hasNext()) { i.next(); QCheckBox *cb = i.value(); if (cb->checkState() == Qt::Checked){ count++; } } ui->progressBar->setMaximum(count); QString page1; QString page2; while (i.hasPrevious()) { i.previous(); QCheckBox *cb = i.value(); if (cb->checkState() == Qt::Checked){ if (ui->checkBox_twokv->checkState() == Qt::Checked){ if (page1 == "") page1 = prepareKvit(cb->text()); else { page2 = prepareKvit(cb->text()); pg += TwoKvitOnePage(page1, page2); page1 = ""; page2 = ""; } } else pg += prepareKvit(cb->text()); ui->progressBar->setValue(c++); } } if (ui->checkBox_twokv->checkState() == Qt::Checked && page1 != "" && page2 == "") pg += page1; QTextDocument textDocument; textDocument.setHtml(pg); QPrinter printer(QPrinter::HighResolution); printer.setOrientation(QPrinter::Portrait); printer.setPaperName("A4"); printer.setPageMargins(0.3, 0.3, 0.3, 0.3, QPrinter::Unit() ); if (ui->checkBox_duplex->checkState() == Qt::Checked)printer.setDuplex(QPrinter::DuplexAuto); textDocument.print(&printer); ui->progressBar->setVisible(false); } delete dlg; #endif }
void PringKvitok::on_toolButton_pdf_clicked() { #if !defined(QT_NO_PRINTER) QString pg; QMapIterator<QString, QCheckBox*> i(childsCheckBox_map); ui->progressBar->setVisible(true); int count = 0; int c = 0; while (i.hasNext()) { i.next(); QCheckBox *cb = i.value(); if (cb->checkState() == Qt::Checked){ count++; } } ui->progressBar->setMaximum(count); QString page1; QString page2; while (i.hasPrevious()) { i.previous(); QCheckBox *cb = i.value(); if (cb->checkState() == Qt::Checked){ if (ui->checkBox_twokv->checkState() == Qt::Checked){ if (page1 == "") page1 = prepareKvit(cb->text()); else { page2 = prepareKvit(cb->text()); pg += TwoKvitOnePage(page1, page2); page1 = ""; page2 = ""; } } else pg += prepareKvit(cb->text()); ui->progressBar->setValue(c++); } } if (ui->checkBox_twokv->checkState() == Qt::Checked && page1 != "" && page2 == "") pg += page1; QTextDocument textDocument; textDocument.setHtml(pg); QPrinter printer(QPrinter::HighResolution); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName( "print.pdf"); printer.setOrientation(QPrinter::Portrait); printer.setPaperName("A4"); printer.setPageMargins(1, 1, 1, 1, QPrinter::Millimeter ); textDocument.print(&printer); ui->progressBar->setValue(c++); ui->progressBar->setVisible(false); #endif }
bool ParamWidget::GetBool(const QString& name) { QCheckBox* checkbox = dynamic_cast<QCheckBox*>(GetWidget(name)); if (!checkbox) { throw std::invalid_argument("Invalid bool parameter " + name.toStdString()); } return checkbox->checkState() == Qt::Checked; }
int drv_checkbox(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9) { handle_head* head = (handle_head*)a0; QCheckBox *self = (QCheckBox*)head->native; switch (drvid) { case CHECKBOX_INIT: { drvNewObj(a0,new QCheckBox); break; } case CHECKBOX_SETCHECK: { self->setCheckState((Qt::CheckState)drvGetInt(a1)); break; } case CHECKBOX_CHECK: { drvSetInt(a1,self->checkState()); break; } case CHECKBOX_SETTRISTATE: { self->setTristate(drvGetBool(a1)); break; } case CHECKBOX_ISTRISTATE: { drvSetBool(a1,self->isTristate()); break; } case CHECKBOX_ONSTATECHANGED: { QObject::connect(self,SIGNAL(stateChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int))); break; } default: return 0; } return 1; }
/*! \reimp */ QString QAccessibleButton::actionText(int action, Text text, int child) const { if (child) return QString(); if (text == Name) switch (action) { case Press: case DefaultAction: // press, checking or open switch (role(0)) { case ButtonMenu: return QPushButton::tr("Open"); case CheckBox: { if (state(child) & Checked) return QCheckBox::tr("Uncheck"); QCheckBox *cb = qobject_cast<QCheckBox*>(object()); if (!cb || !cb->isTristate() || cb->checkState() == Qt::PartiallyChecked) return QCheckBox::tr("Check"); return QCheckBox::tr("Toggle"); } break; case RadioButton: return QRadioButton::tr("Check"); default: break; } break; } return QAccessibleWidgetEx::actionText(action, text, child); }
/** * Return checked Pulse Device */ const QString QvkPulse::myPulseDevice( QVBoxLayout *Pulseframe ) { QList<QCheckBox *> listQFrame = Pulseframe->findChildren<QCheckBox *>(); QCheckBox *box; QList<int> integerList; QString ret; for ( int i = 0; i < listQFrame.count(); i++ ) { box = listQFrame.at( i ); if ( box->checkState() == Qt::Checked ) integerList.append( i ); } if ( integerList.count() == 0 ) ret = ""; if ( integerList.count() == 1 ) { box = listQFrame[ integerList[ 0 ] ]; ret = box->accessibleName(); } if ( integerList.count() > 1 ) ret = "vokoscreenMix.monitor"; return ret; }
QAccessible::State QAccessibleButton::state() const { QAccessible::State state = QAccessibleWidget::state(); QAbstractButton *b = button(); QCheckBox *cb = qobject_cast<QCheckBox *>(b); if (b->isCheckable()) state.checkable = true; if (b->isChecked()) state.checked = true; else if (cb && cb->checkState() == Qt::PartiallyChecked) state.checkStateMixed = true; if (b->isDown()) state.pressed = true; QPushButton *pb = qobject_cast<QPushButton*>(b); if (pb) { if (pb->isDefault()) state.defaultButton = true; #ifndef QT_NO_MENU if (pb->menu()) state.hasPopup = true; #endif } return state; }
void pcl::modeler::BoolParameter::getEditorData(QWidget *editor) { QCheckBox *checkBox = static_cast<QCheckBox*>(editor); bool value = (checkBox->checkState() == Qt::Checked); current_value_ = value; }
void EmitterAttributeEditor::HandleUpdateInvisibleChanged(int value) { if(updatingWidget_) return; QCheckBox* chk = (QCheckBox*)sender(); GetEffect()->SetUpdateInvisible(chk->checkState() == Qt::Checked); }
void PropertyEditDelegate::setModelData(QWidget* editor_, QAbstractItemModel* model_, const QModelIndex& index) const { const QVariant& data = index.data(); GeneratorPropertiesModel* model = static_cast<GeneratorPropertiesModel*>(model_); switch (data.type()) { case QVariant::Double: { QLineEdit* editor = static_cast<QLineEdit*>(editor_); model->setData(index, editor->text().toDouble(), Qt::EditRole); break; } case QVariant::Int: { QSpinBox* editor = static_cast<QSpinBox*>(editor_); editor->interpretText(); model->setData(index, editor->value(), Qt::EditRole); break; } case QVariant::Bool: { QCheckBox* editor = static_cast<QCheckBox*>(editor_); const bool value = editor->checkState() == Qt::Checked; model->setData(index, value, Qt::EditRole); break; } case QVariant::List: { QLineEdit* editor = static_cast<QLineEdit*>(editor_); QStringList list = editor->text().split(","); QVariantList varList; QDoubleValidator validator; for (QString& str : list) { if (str == "") continue; int pos = 0; if (validator.validate(str, pos) == QValidator::Acceptable) varList.push_back(QVariant(str.toDouble())); else varList.push_back(QVariant(-1.0)); } model->setData(index, varList, Qt::EditRole); break; } default: { break; } } }
void GUIImport::updateTreeChecks(QObject* obj) { QTreeWidgetItem* sender = (QTreeWidgetItem*)obj; QCheckBox* check = (QCheckBox*)ui->viewTree->itemWidget(sender, COL_CHECKBOX); if (!sender->parent()) { Qt::CheckState state = check->checkState(); if (check->checkState() == Qt::PartiallyChecked) state = Qt::Unchecked; // just disable or enable childs for (int i = 0; i < sender->childCount(); i++) { QTreeWidgetItem* attrItem = sender->child(i); QCheckBox* attr_check = (QCheckBox*)ui->viewTree->itemWidget(attrItem, COL_CHECKBOX); attr_check->setCheckState(state); } } else { // clicking on child, check state of siblings int numChecked = 0; int numChilds = sender->parent()->childCount(); if (numChilds > 0) { for (int i = 0; i < numChilds; i++) { QCheckBox* attr_check = (QCheckBox*)ui->viewTree->itemWidget(sender->parent()->child(i), COL_CHECKBOX); if (attr_check->checkState() == Qt::Checked) numChecked++; } QCheckBox* view_check = (QCheckBox*)ui->viewTree->itemWidget(sender->parent(), COL_CHECKBOX); if (numChecked == numChilds) view_check->setCheckState(Qt::Checked); else view_check->setCheckState(Qt::PartiallyChecked); } } }
QWidget* EditIndexDialog::createAdvancedTab() { QWidget *advanced = new QWidget(this); _sparceCheckBox = new QCheckBox(tr("Sparse"), advanced); _sparceCheckBox->setChecked(_info._sparse); _backGroundCheckBox = new QCheckBox(tr("Create index in background"), advanced); _backGroundCheckBox->setChecked(_info._backGround); QHBoxLayout *expireLayout = new QHBoxLayout; _expireAfterLineEdit = new QLineEdit(advanced); _expireAfterLineEdit->setMaximumWidth(150); QRegExp rx("\\d+"); _expireAfterLineEdit->setValidator(new QRegExpValidator(rx, this)); QLabel *secLabel = new QLabel(tr("seconds"), advanced); expireLayout->addWidget(_expireAfterLineEdit); expireLayout->addWidget(secLabel); expireLayout->addStretch(1); QCheckBox *expireCheckBox = new QCheckBox(tr("Expire after")); expireCheckBox->setChecked(false); if (_info._ttl >= 0) { expireCheckBox->setChecked(true); _expireAfterLineEdit->setText(QString("%1").arg(_info._ttl)); } expireStateChanged(expireCheckBox->checkState()); VERIFY(connect(expireCheckBox, SIGNAL(stateChanged(int)), this, SLOT(expireStateChanged(int)))); QLabel *sparseHelpLabel = createHelpLabel( "If set, the index only references documents with the specified field. " "These indexes use less space but behave differently in some situations (particularly sorts).", 20, -2, 0, 20); QLabel *backgroundHelpLabel = createHelpLabel( "Builds the index in the background so that building an index does not block other database activities.", 20, -2, 0, 20); QLabel *expireHelpLabel = createHelpLabel( "Specifies a <i>time to live</i>, in seconds, to control how long MongoDB retains documents in this collection", 20, -2, 0, 20); QGridLayout *layout = new QGridLayout; layout->addWidget(_sparceCheckBox, 0, 0, 1, 2); layout->addWidget(sparseHelpLabel, 1, 0, 1, 2); layout->addWidget(_backGroundCheckBox, 2, 0, 1, 2); layout->addWidget(backgroundHelpLabel, 3, 0, 1, 2); layout->addWidget(expireCheckBox, 4, 0); layout->addLayout(expireLayout, 4, 1); layout->addWidget(expireHelpLabel, 5, 0, 1, 2); layout->setAlignment(Qt::AlignTop); advanced->setLayout(layout); return advanced; }
void ConfigPage::flushCache() { // sync the cache with the widgets' state // iterate on checkboxes for (std::map<QString, WidgetCache<bool> >::iterator it = checkboxCache.begin(); it != checkboxCache.end(); it++) { QCheckBox* checkbox = dynamic_cast<QCheckBox*>((it->second).widget); Q_ASSERT(checkbox); (it->second).value = CHECKED_TO_BOOL(checkbox->checkState()); } }
QVariant ItemHandlerCheckbox::GetValue (QObject *object) const { QCheckBox *checkbox = qobject_cast<QCheckBox*> (object); if (!checkbox) { qWarning () << Q_FUNC_INFO << "not a QCheckBox" << object; return QVariant (); } return checkbox->checkState (); }
void Application::actuallyQuit() { QDialog* d = qobject_cast<QDialog*>( sender()); if( d ) { QCheckBox* dontAskCB = d->findChild<QCheckBox*>(); if( dontAskCB ) { unicorn::AppSettings().setValue( "quitDontAsk", ( dontAskCB->checkState() == Qt::Checked )); } } QCoreApplication::quit(); }
/** * Returns count checked pulse devices */ int QvkPulse::getCountCheckedPulseDevices( QFrame *Pulseframe ) { QList<QCheckBox *> listQFrame = Pulseframe->findChildren<QCheckBox *>(); QCheckBox *inBox; int x = 0; for ( int i = 0; i < listQFrame.count(); i++ ) { inBox = listQFrame.at( i ); if ( inBox->checkState() == Qt::Checked ) x++; } return x; }
void _choicedialog::performClose() { sGet = ""; QMap<QString, QCheckBox*>::Iterator it; for ( it = pref.begin(); it != pref.end(); ++it ) { QString sKey = it.key(); QCheckBox *c = *it; if (c->checkState() == Qt::Checked){ sGet += sKey; sGet += ";"; } } close(); }
//------ // run() //------ void CloseGeometryDialog::run() { static log4cplus::Logger logger = log4cplus::Logger::getInstance("CloseGeometryDialog.run"); using namespace SM_DECOMPOSE_NAMESPACE; for (int i = 0; i < _boxes.size(); ++i) { QCheckBox* box = _boxes[i]; if (box->checkState() == Qt::Checked) { const string name = box->text().toStdString(); cvcapp.listPropertyRemove("thumbnail.geometries", name); cvcapp.listPropertyRemove("zoomed.geometries", name); cvcapp.data(name, boost::any()); } } }
void LogSettingsPageWidget::sl_levelStateChanged(int state) { if (state == Qt::PartiallyChecked) { return; } disconnect(tableWidget, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(sl_catItemStateChanged(QTableWidgetItem *))); QCheckBox* cb = qobject_cast<QCheckBox*>(sender()); int column = 1 + qobject_cast<LogSettingsTopLineWidget*>(cb->parent())->level; assert(column >= 1 && column <=LogLevel_NumLevels); for (int row = 1; row < tableWidget->rowCount(); row++) { QTableWidgetItem* catItem = tableWidget->item(row, column); catItem->setCheckState(cb->checkState()); } connect(tableWidget, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(sl_catItemStateChanged(QTableWidgetItem *))); }
void table_widget_delegate::setWidgetModelData(const QModelIndex &index, QAbstractItemModel *model, QWidget *editor) const { if (!editor){ return; } column_data_ptr cd = _column_datas[index.column()]; if (!cd){ return; } switch (cd->type) { case WIDGET_CHECKBOX: { QCheckBox *widget = qobject_cast<QCheckBox*>(editor); if(widget){ model->setData(index, widget->checkState() == Qt::Checked); } } break; case WIDGET_COMBOBOX: { QComboBox *widget = qobject_cast<QComboBox*>(editor); switch (cd->data.type()) { case QVariant::StringList: model->setData(index, widget->currentText()); break; case QVariant::Map: { QVariantMap map = cd->data.toMap(); QString text = widget->currentText(); model->setData(index, map[text]); } break; default: break; } } default: break; } }
void DelegateInfoCheckBox::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { if(index.column() == 0){ return; } QCheckBox *checkBox = static_cast<QCheckBox*>(editor); int value = 0; if(checkBox->checkState() == Qt::Checked){ value = 1; }else{ value = 0; } model->setData(index, value, Qt::CheckStateRole); }
/** * Returns xte checked pulse devicename */ QString QvkPulse::getPulseDeviceName( int value, QFrame *Pulseframe ) { QList<QCheckBox *> listQFrame = Pulseframe->findChildren<QCheckBox *>(); QCheckBox *inBox; int x = 1; QString name; for ( int i = 0; i < listQFrame.count(); i++ ) { inBox = listQFrame.at( i ); if ( inBox->checkState() == Qt::Checked ) { if ( x == value ) name = inBox->text(); x++; } } return name; }
//------ // run() //------ void SaveGeometryDialog::run() { static log4cplus::Logger logger = log4cplus::Logger::getInstance("SaveGeometryDialog.run"); using namespace SM_DECOMPOSE_NAMESPACE; QSettings settings; settings.setValue("openFile/dir", _outputDir->text()); QString dir = _outputDir->text() + "/"; for (int i = 0; i < _boxes.size(); ++i) { QCheckBox* box = _boxes[i]; if (box->checkState() == Qt::Checked) { const string name = box->text().toStdString(); string filename = (dir + _filenames[i]->text()).toStdString(); const cvcraw_geometry::cvcgeom_t geom = boost::any_cast<cvcraw_geometry::cvcgeom_t>(cvcapp.data()[name]); LOG4CPLUS_TRACE(logger, "Saving " << filename); if (_typeBox->currentText() == "raw") { cvcraw_geometry::write(cvcraw_geometry::geometry_t(geom), filename + ".raw"); } else if (_typeBox->currentText() == "obj") { cvcraw_geometry::write_obj(geom, filename + ".obj"); } else if (_typeBox->currentText() == "off") { cvcraw_geometry::write_off(geom, filename + ".off"); } const string ssname = name + "-ssurf"; boost::any tempSurface = cvcapp.data()[ssname]; if (!tempSurface.empty()) { SegmentedSurface ssurf = boost::any_cast<SegmentedSurface>(tempSurface); write_segmentation(filename,ssurf); } } } Status::set("Saved geometries"); }
bool ObjectsChoicesPage::validatePage() { // Delete all objects that won't be imported ThreeDSSearchingTasklet* tasklet = (ThreeDSSearchingTasklet*)((FileImporterWizard*)wizard())->context(); if(tasklet) { QList<ThreeDSContext*> listObjects = tasklet->objects(); for(kint i=_table->rowCount()-1; i>=0; i--) { QCheckBox* checkbox = (QCheckBox*)_table->cellWidget(i, 0); if(checkbox->checkState() == Qt::Unchecked) { ThreeDSContext* context = listObjects.at(i); listObjects.removeAt(i); if(context) { delete context; } } } } return true; }
/*! \reimp */ QAccessible::State QAccessibleButton::state(int child) const { State state = QAccessibleWidgetEx::state(child); QAbstractButton *b = button(); QCheckBox *cb = qobject_cast<QCheckBox *>(b); if (b->isChecked()) state |= Checked; else if (cb && cb->checkState() == Qt::PartiallyChecked) state |= Mixed; if (b->isDown()) state |= Pressed; QPushButton *pb = qobject_cast<QPushButton*>(b); if (pb) { if (pb->isDefault()) state |= DefaultButton; #ifndef QT_NO_MENU if (pb->menu()) state |= HasPopup; #endif } return state; }
void WidgetInfo::BoolChanged(const char *setting) { QCheckBox *checkbox = static_cast<QCheckBox*>(widget); obs_data_setbool(view->settings, setting, checkbox->checkState() == Qt::Checked); }
void TilesetEditor::addTiles(const QList<QUrl> &urls) { Tileset *tileset = currentTileset(); if (!tileset) return; Preferences *prefs = Preferences::instance(); struct LoadedFile { QUrl imageSource; QPixmap image; }; QVector<LoadedFile> loadedFiles; // If the tile is already in the tileset, warn user and confirm addition bool dontAskAgain = false; bool rememberOption = true; for (const QUrl &url : urls) { if (!(dontAskAgain && rememberOption) && hasTileInTileset(url, *tileset)) { if (dontAskAgain) continue; QCheckBox *checkBox = new QCheckBox(tr("Apply this action to all tiles")); QMessageBox warning(QMessageBox::Warning, tr("Add Tiles"), tr("Tile \"%1\" already exists in the tileset!").arg(url.toString()), QMessageBox::Yes | QMessageBox::No, mMainWindow->window()); warning.setDefaultButton(QMessageBox::Yes); warning.setInformativeText(tr("Add anyway?")); warning.setCheckBox(checkBox); int warningBoxChoice = warning.exec(); dontAskAgain = checkBox->checkState() == Qt::Checked; rememberOption = warningBoxChoice == QMessageBox::Yes; if (!rememberOption) continue; } const QPixmap image(url.toLocalFile()); if (!image.isNull()) { loadedFiles.append(LoadedFile { url, image }); } else { // todo: support lazy loading of selected remote files QMessageBox warning(QMessageBox::Warning, tr("Add Tiles"), tr("Could not load \"%1\"!").arg(url.toString()), QMessageBox::Ignore | QMessageBox::Cancel, mMainWindow->window()); warning.setDefaultButton(QMessageBox::Ignore); if (warning.exec() != QMessageBox::Ignore) return; } } if (loadedFiles.isEmpty()) return; const QString lastLocalFile = urls.last().toLocalFile(); if (!lastLocalFile.isEmpty()) prefs->setLastPath(Preferences::ImageFile, lastLocalFile); QList<Tile*> tiles; tiles.reserve(loadedFiles.size()); for (LoadedFile &loadedFile : loadedFiles) { Tile *newTile = new Tile(tileset->takeNextTileId(), tileset); newTile->setImage(loadedFile.image); newTile->setImageSource(loadedFile.imageSource); tiles.append(newTile); } mCurrentTilesetDocument->undoStack()->push(new AddTiles(mCurrentTilesetDocument, tiles)); }
void GlyphEditor::update(){ GLWidget* glw = findChild<GLWidget*>("widget"); glw->updateGL(); QCheckBox* c = findChild<QCheckBox*>("updateBox"); if (c->checkState()==Qt::Checked) emit changed(); }
QString GameParamBoolean::getWidgetValue(QWidget* pWidget) { QCheckBox* box = (QCheckBox*) pWidget; return (box->checkState() == Qt::Checked) ? "True" : "False"; }
void MainWindow::loadBrowserData() { QUrl url = API::sharedAPI()->sharedAniListAPI()->API_BROWSE; QString season = ui->comboSeason->currentText(); QString year = ui->comboYear->currentText(); QString type = ui->comboType->currentText(); QString status = ui->comboStatus->currentText(); // Clear the browser view QLayoutItem *item; while ((item = layout2->takeAt(0))) { delete item->widget(); delete item; } if (!season.isEmpty()) { url = addQuery(url, "season", season); } if (!year.isEmpty()) { url = addQuery(url, "year", year); } if (!type.isEmpty()) { url = addQuery(url, "type", type); } if (!status.isEmpty()) { url = addQuery(url, "status", status); } QStringList genres; QStringList exclude; for (int i = 0; i < ui->genreList->count(); i++) { QCheckBox *w = static_cast<QCheckBox *> (dynamic_cast<QWidgetItem *>(ui->genreList->itemAt(i))->widget()); if (w->checkState() == Qt::PartiallyChecked) { exclude.append(w->text()); } else if (w->checkState() == Qt::Checked) { genres.append(w->text()); } } if (!genres.isEmpty()) { url = addQuery(url, "genres", genres.join(",")); } if (!exclude.isEmpty()) { url = addQuery(url, "genres_exclude", exclude.join(",")); } // Load the results for the requested type QJsonArray browse_results = API::sharedAPI()->sharedAniListAPI()->get(url).array(); for (int i = 0; i <= browse_results.size(); i++) { QJsonObject anime = browse_results.at(i).toObject(); Anime *a = User::sharedUser()->getAnimeByTitle( anime.value("title_romaji").toString()); if (a == 0) { a = new Anime(); a->setID(QString::number(anime.value("id").toInt())); a->setMyProgress(0); a->setMyNotes(""); a->setMyRewatch(0); a->setMyStatus(""); if (a->getID() == "0") { delete a; continue; } } BrowseAnime *s = new BrowseAnime(this, User::sharedUser()->scoreType()); if (a->needsLoad() || a->needsCover()) { User::sharedUser()->loadAnimeData(a, true); QEventLoop evt; connect(a, SIGNAL(finishedReloading()), &evt, SLOT(quit())); evt.exec(); } s->setAnime(a); layout2->addWidget(s); // Do we need to keep loading? if (season != ui->comboSeason->currentText() || year != ui->comboYear->currentText() || type != ui->comboType->currentText() || status != ui->comboStatus->currentText()) { return; } int width = layout2->geometry().width(); int cwidth = layout2->contentsWidth(); if (cwidth < 0) { width = this->width() - 2; cwidth = this->width() - (this->width() % 200); } layout2->setContentsMargins((width-cwidth)/2, 0, 0, 0); } }