//Changement du buffer de référence void PagesContainer::setBuffer(PagesBuffer* newBuffer) { m_buffer = newBuffer; m_resizingThread.fill(QFuture<void>(), m_buffer->getNumberOfBlocs()); int numberOfPages(m_buffer->getNumberOfPages()); clearLayout(layout()); //Obligatoire si un layout est déjà en place (pas d'écrasement possible) m_layout = new QHBoxLayout(this); //Disposition horizontale m_layout->addWidget(getResizedPage(0)); //Page de gauche centrée si seule et à droite de son emplacement si suivie m_layout->setAlignment(getResizedPage(0), numberOfPages == 1 ? Qt::AlignCenter : Qt::AlignHCenter | Qt::AlignRight); //Pages intérmédiaires centrées for(int i = 1 ; i < numberOfPages - 1 ; i++){ m_layout->addWidget(getResizedPage(i)); m_layout->setAlignment(getResizedPage(i), Qt::AlignCenter); } //Dernière page alignée à gauche if(numberOfPages >= 2){ m_layout->addWidget(getResizedPage(numberOfPages - 1)); m_layout->setAlignment(getResizedPage(numberOfPages - 1), Qt::AlignHCenter | Qt::AlignLeft); } //Définit les marges autour des pages puis l'écart entre deux pages m_layout->setContentsMargins(0, 0, 0, 0); m_layout->setSpacing(PAGES_GAP); setLayout(m_layout); //Application du layout applyResizePolicy(); //Application de la politique de redimentionnement aux pages }
// Called when the user wants to maximize the palette void UBDesktopPalette::maximizeMe() { QList<QAction*> actions; clearLayout(); actions << mActionUniboard; actions << UBApplication::mainWindow->actionPen; actions << UBApplication::mainWindow->actionEraser; actions << UBApplication::mainWindow->actionMarker; #ifndef Q_WS_X11 actions << UBApplication::mainWindow->actionSelector; #endif actions << UBApplication::mainWindow->actionPointer; if (UBPlatformUtils::hasVirtualKeyboard()) actions << UBApplication::mainWindow->actionVirtualKeyboard; actions << mActionCustomSelect; actions << mDisplaySelectAction; actions << mShowHideAction; //actions << UBApplication::mainWindow->actionDesktopTools; setActions(actions); QSize newSize = preferredSize(); this->resize(newSize); // Notify that the maximization has been done emit maximized(); }
void MMessageBoxViewPrivate::updateLayout() { clearLayout(); prepareLayout(); if (centralWidget) { contentsLayout->insertItem(0, centralWidget); } if (textLabel) { contentsLayout->insertItem(0, textLabel); contentsLayout->setAlignment(textLabel, Qt::AlignCenter); } if (titleLabel) { contentsLayout->insertItem(0, titleLabel); contentsLayout->setAlignment(titleLabel, Qt::AlignCenter); } if (iconImage) { contentsLayout->insertItem(0, iconImage); contentsLayout->setAlignment(iconImage, Qt::AlignCenter); } if (!QGraphicsLayout::instantInvalidatePropagation()) { /* Update the geometry of the parents immediately. This simply makes the layout have the correct sizehint * immediately instead of one frame later, removing a single frame of 'flicker'. */ QGraphicsLayoutItem *item = contents; do { item->updateGeometry(); } while( (item = item->parentLayoutItem()) ); } }
void Calibration::loadClicksStep(int oldStep) { pointChoisiA = new QPoint(-1,-1); pointChoisiB = new QPoint(-1,-1); // Si l'on vient de choisir la webcam et le track if(oldStep == 1) { // Sauvegarde des valeurs webcamChoisie = choixWebcams->currentIndex(); tracking = trackingChoice->currentText(); } clearLayout(layoutCentral); QLabel *labelClicks = new QLabel(tr("Cliquez deux fois pour selectionner votre objet :")); ViewCalibration *viewImage = new ViewCalibration(pointChoisiA,pointChoisiB); WebcamManager wm; imageCapturee = wm.getImageInit(webcamChoisie); cvFlip(imageCapturee, imageCapturee, 1); viewImage->addPixmap(QPixmap::fromImage(iplToQimage(imageCapturee))); QPushButton *boutonRecommencer = new QPushButton(tr("Reprendre photo")); connect(boutonRecommencer, SIGNAL(clicked()), this, SLOT(slotNewPhoto())); layoutCentral->addWidget(labelClicks); layoutCentral->addWidget(viewImage); layoutCentral->addWidget(boutonRecommencer); boutonSuivant->setText(tr("Suivant ->")); boutonPrecedent->setEnabled(true); }
void EditorWindow::loadControlUI() { QModelIndex Select = ControllerTree->selectionModel()->selectedIndexes()[0]; QModelIndex SelectRoot = Controllers->getRootSelection(Select); QString Key = Controllers->data(SelectRoot, Qt::DisplayRole).toString(); qDebug() << Key; if (Key == currentControl) return; QFile controllerUIFile("./Controllers/" + Key + ".ui"); if (!controllerUIFile.exists()) { QMessageBox::warning(this, tr("UI File"), tr("Cannot found file %1:\n%2.") .arg(controllerUIFile.fileName()) .arg(controllerUIFile.errorString())); return; } if (!controllerUIFile.open(QFile::ReadOnly | QFile::Text)) { QMessageBox::warning(this, tr("UI File"), tr("Cannot read file %1:\n%2.") .arg(controllerUIFile.fileName()) .arg(controllerUIFile.errorString())); return; } QUiLoader UiLoader; clearLayout(ControllerUI->layout()); ControllerUI->layout()->addWidget(UiLoader.load(&controllerUIFile, ControllerUI)); controllerUIFile.close(); }
void Calibration::loadWebcamsStep(int oldStep) { clearLayout(layoutCentral); QLabel *labelWebcams = new QLabel(tr("Choisissez une webcam :")); choixWebcams = new QComboBox(); layoutCentral->addWidget(labelWebcams); layoutCentral->addWidget(choixWebcams); WebcamManager wm; int nb = wm.getNumberOfWebcams(); for (int i=0; i<nb; i++) choixWebcams->addItem(tr("Webcam ") + QString::number(i)); // Choix de la méthode de Tracking QLabel *labelTracking = new QLabel(tr("Choisissez le type de suivi :")); trackingChoice = new QComboBox(); layoutCentral->addWidget(labelTracking); layoutCentral->addWidget(trackingChoice); // Types de trackings : couleur, forme, blob trackingChoice->addItem(tr("Couleur")); trackingChoice->addItem(tr("Forme")); trackingChoice->addItem(tr("Blob")); if (tracking == tr("Couleur")) trackingChoice->setCurrentIndex(0); else if (tracking == tr("Forme")) trackingChoice->setCurrentIndex(1); else if (tracking == tr("Blob")) trackingChoice->setCurrentIndex(2); // Empêcher de revenir en arrière boutonPrecedent->setEnabled(false); }
// on "init" you need to initialize your instance bool Dialog::init() { ////////////////////////////// // 1. super init first if ( !LayerColor::initWithColor(Color4B(0, 0, 0, 127)) ) { return false; } Size visibleSize = Director::getInstance()->getVisibleSize(); Point origin = Director::getInstance()->getVisibleOrigin(); m_dialog = Layer::create(); this->addChild(m_dialog); EventListenerTouchOneByOne* listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = [] (Touch* touch, Event* e) { return true; }; listener->setSwallowTouches(true); Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this); clearLayout(); return true; }
// Called when the user wants to maximize the palette void UBDesktopPalette::maximizeMe() { QList<QAction*> actions; clearLayout(); actions << mActionUniboard; actions << UBApplication::mainWindow->actionPen; actions << UBApplication::mainWindow->actionEraser; actions << UBApplication::mainWindow->actionMarker; actions << UBApplication::mainWindow->actionSelector; actions << UBApplication::mainWindow->actionPointer; if (UBPlatformUtils::hasVirtualKeyboard()) actions << UBApplication::mainWindow->actionVirtualKeyboard; actions << mActionCustomSelect; actions << mDisplaySelectAction; actions << mShowHideAction; setActions(actions); adjustSizeAndPosition(); // Notify that the maximization has been done emit maximized(); #ifdef Q_OS_LINUX emit refreshMask(); #endif }
void TKeyboard::setLayout(const QString &layoutID, const QStringList &keys) { clearLayout(); QStringList layout = layoutID.split(QChar('/')); QVBoxLayout *vLayout = new QVBoxLayout; int i; for(i = 0; i < layout.size(); i++) { QHBoxLayout *hLayout = new QHBoxLayout; int j; for(j = 0; j < layout[i].size(); j++) { QPushButton *button = new QPushButton("", _frame); hLayout->addWidget(button); _buttons.append(button); connect(button, SIGNAL(pressed()), this, SLOT(slotPressed())); connect(button, SIGNAL(clicked(bool)), this, SLOT(slotClicked(bool))); } vLayout->insertLayout(-1, hLayout); } setKeys(keys); _frame->setLayout(vLayout); }
MMessageBoxViewPrivate::~MMessageBoxViewPrivate() { clearLayout(); delete iconImage; delete titleLabel; delete textLabel; }
void TKeyboard::detach() { if(_frame != NULL) { clearLayout(); _frame = NULL; } else { qDebug() << "Error, detach an unattached keyboard"; } }
QGraphicsLayout *MAdvancedListItem::createLayout() { Q_D(MAdvancedListItem); clearLayout(); d->createLayout(); return d->layout(); }
void MultiplayerDialog::updatePlayersList() { clearLayout( m_playersLayout ); m_playersData.clear(); buildPlayersList(); } // MultiplayerDialog::updatePlayersList
void AttributesPane::setEffect(QSharedPointer<Effect> effect) { _effect = effect; QVBoxLayout* effectLayout = qobject_cast<QVBoxLayout*>(ui->effectAttrsFrame->layout()); clearLayout(effectLayout); effectLayout->addWidget(_effect->editor()); //effectLayout->addStretch(); ui->effectAttrsLabel->show(); }
void MainWindow::on_actionMusic_triggered() { clearLayout(); GridLayout->addWidget(gbMusic,0,0); GridLayout->addWidget(gbSound,0,1); gbMusic->show(); gbSound->show(); eGame.setUserInterface(Scenario::uiMusic); actionMusic->setChecked(true); }
void QOsgInspectorWidget::setTargetObject(osg::Object* anObject) { this->setWidget(NULL); _scrollAreaContents->setLayout(NULL); clearLayout(_layout, true); if(anObject == NULL) return; osgDB::ClassInterface ci; osgDB::ObjectWrapper* ow = ci.getObjectWrapper(anObject); osgDB::ClassInterface::PropertyMap blackList; blackList["Name"] = osgDB::BaseSerializer::RW_STRING; blackList["DataVariance"] = osgDB::BaseSerializer::RW_ENUM; blackList["UserData"] = osgDB::BaseSerializer::RW_USER; blackList["UserDataContainer"] = osgDB::BaseSerializer::RW_OBJECT; osgDB::ClassInterface::PropertyMap propMap; ci.getSupportedProperties(anObject, propMap, true); const osgDB::StringList& associates = ow->getAssociates(); for(osgDB::StringList::const_iterator aitr = associates.begin(); aitr != associates.end(); ++aitr) { osgDB::ObjectWrapper* associate_wrapper = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(*aitr); if (associate_wrapper) { const osgDB::ObjectWrapper::SerializerList& associate_serializers = associate_wrapper->getSerializerList(); unsigned int i=0; for(osgDB::ObjectWrapper::SerializerList::const_iterator sitr = associate_serializers.begin(); sitr != associate_serializers.end(); ++sitr, ++i) { const std::string& propertyName = (*sitr)->getName(); bool notBlackListed = (blackList.count(propertyName)==0); if (notBlackListed) { // properties[propertyName] = associate_wrapper->getTypeList()[i]; //OSG_ALWAYS << "Property: " << (*propItr).first << " : " << ci.getTypeName((*propItr).second) << std::endl; //create readable label QString qpropname = QString(propertyName.c_str()); QStringList sl = qpropname.split(QRegExp("(?=[A-Z])"), QString::SkipEmptyParts); std::string label = sl.join(" ").toStdString(); QOsgPropertyWidget* propWidget = QOsgPropertyWidget::Create(anObject, propertyName, associate_wrapper->getTypeList()[i]); _layout->addRow(QString(label.c_str()), propWidget); } } } } _scrollAreaContents->setLayout(_layout); this->setWidget(_scrollAreaContents); }
void favoritesTab::updateFavorites() { QStringList assoc = QStringList() << "name" << "note" << "lastviewed"; QString order = assoc[ui->comboOrder->currentIndex()]; bool reverse = (ui->comboAsc->currentIndex() == 1); if (order == "note") { qSort(m_favorites.begin(), m_favorites.end(), sortByNote); } else if (order == "lastviewed") { qSort(m_favorites.begin(), m_favorites.end(), sortByLastviewed); } else { qSort(m_favorites.begin(), m_favorites.end(), sortByName); } if (reverse) { m_favorites = reversed(m_favorites); } QString format = tr("MM/dd/yyyy"); clearLayout(ui->layoutFavorites); QString display = m_settings->value("favorites_display", "ind").toString(); int i = 0; for (Favorite fav : m_favorites) { QString xt = tr("<b>Name:</b> %1<br/><b>Note:</b> %2 %%<br/><b>Last view:</b> %3").arg(fav.getName(), QString::number(fav.getNote()), fav.getLastViewed().toString(format)); QWidget *w = new QWidget(ui->scrollAreaWidgetContents); QVBoxLayout *l = new QVBoxLayout(w); if (display.contains("i")) { QPixmap img = fav.getImage(); QBouton *image = new QBouton(fav.getName(), false, false, 0, QColor(), this); image->setIcon(img); image->setIconSize(img.size()); image->setFlat(true); image->setToolTip(xt); connect(image, SIGNAL(rightClick(QString)), this, SLOT(favoriteProperties(QString))); connect(image, SIGNAL(middleClick(QString)), this, SLOT(addTabFavorite(QString))); connect(image, SIGNAL(appui(QString)), this, SLOT(loadFavorite(QString))); l->addWidget(image); } QAffiche *caption = new QAffiche(fav.getName(), 0 ,QColor(), this); caption->setText((display.contains("n") ? fav.getName() : "") + (display.contains("d") ? "<br/>("+QString::number(fav.getNote())+" % - "+fav.getLastViewed().toString(format)+")" : "")); caption->setTextFormat(Qt::RichText); caption->setAlignment(Qt::AlignCenter); caption->setToolTip(xt); if (!caption->text().isEmpty()) { connect(caption, SIGNAL(clicked(QString)), this, SLOT(loadFavorite(QString))); l->addWidget(caption); } ui->layoutFavorites->addWidget(w, i / 8, i % 8); ++i; } }
void toDo::update() { qDebug() << "Started Update"; qDebug() << "Name des ersten Subject"; QList <ToDoItem> alltodos = pDBh->queryWithReturnToDoItemList("SELECT * FROM todo"); clearLayout(ui->verticalLayout_2); this->setItemList(alltodos); MainWindow* parent = qobject_cast<MainWindow*>(this->parent()); // check parent is not null parent->updateLists(); }
void StackedWidgetHelper::update2DPoints(const QVector<QPoint> &points2D) { clearLayout(ui->verticalLayout2Dpoints,true); for (int i=0; i<points2D.size(); i++) { QString valuePoint2D = QString::number(QPoint(points2D.at(i)).x()) + "," + QString::number(QPoint(points2D.at(i)).y()); QLabel *lab = new QLabel(valuePoint2D,_parent); ui->verticalLayout2Dpoints->addWidget(lab); } }
void BibItemEditWidget::rebuild(const QString& type) { m_mapper.submit(); clearLayout(); QHash<QString, QString> fieldProperties; // Temporary storage for field properties QWidget *field; // Temporary storage for newly created widgets QLabel *label; // Temporary storage for newly created labels for (QString fieldType : BibLaTeX::instance().fields(type).keys()) { label = new QLabel(fieldType, this); m_layout->addRow("", label); m_fields.append(label); for (QString fieldString :BibLaTeX::instance().fields(type)[fieldType] ) { for (QString fieldName :fieldString.split("/")) { fieldProperties = BibLaTeX::instance().fieldProperties(fieldName); if ((fieldProperties["Type"] == "String") || (fieldProperties["Type"] == "StringList")) field = new QLineEdit; if (fieldProperties["Type"] == "Text") { field = new QPlainTextEdit; } /*else if (fieldProperties["Type"] == "Date") {j QDateTimeEdit *dte = new QDateTimeEdit; dte->setDisplayFormat("yyyy-MM-dd"); dte->setSpecialValueText( " " ); field = dte; } else if (fieldProperties["Type"] == "Year") { QDateTimeEdit *dte = new QDateTimeEdit; dte->setDisplayFormat("yyyy"); field = dte; }*/ else field = new QLineEdit; m_mapper.addMapping(field, BibLaTeX::instance().fieldsOrdered().indexOf(fieldName)); m_layout->addRow(fieldName, field); m_fields.append(field); } } } m_mapper.setCurrentIndex(m_mapper.currentIndex()); }
ShaderParamsDialog::ShaderParamsDialog(QWidget *parent) : QDialog(parent) ,m_layout() ,m_scrollArea() { setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS)); setObjectName("shaderParamsDialog"); resize(720, 480); QTimer::singleShot(0, this, SLOT(clearLayout())); }
void MainWindow::on_actionDesign_triggered() { clearLayout(); GridLayout->addWidget(gbScenario,0,0,0,1); GridLayout->addWidget(gbCharacter,0,1); GridLayout->addWidget(gbNote,1,1); gbScenario->show(); gbCharacter->show(); gbNote->show(); eGame.setUserInterface(Scenario::uiDesign); actionDesign->setChecked(true); }
// Called when the palette is near the border and must be minimized void UBDesktopPalette::minimizeMe(eMinimizedLocation location) { Q_UNUSED(location); QList<QAction*> actions; clearLayout(); actions << mMaximizeAction; setActions(actions); QSize newSize = preferredSize(); this->resize(newSize); }
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; } }
void PatientBrowserMenuExtendedInfo::setItems(const QList<PatientBrowserMenuExtendedItem*> &items) { clearLayout(m_layout); int maxWidth = 0; int accumulatedHeight = 0; foreach(PatientBrowserMenuExtendedItem *item, items) { item->adjustSize(); m_layout->addWidget(item); maxWidth = qMax(maxWidth, item->width()); accumulatedHeight += item->height(); }
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; } }
void QTools::clearLayout( QLayout* layout ) { while( QLayoutItem* item = layout->takeAt(0) ) { if( QWidget* widget = item->widget() ) { delete widget; } if( QLayout* childLayout = item->layout() ) { clearLayout( childLayout ); } delete item; } }
void OptionDialog::setDbDialog(Brewtarget::DBTypes db) { groupBox_dbConfig->setVisible(false); clearLayout(); if ( db == Brewtarget::PGSQL ) { postgresVisible(true); sqliteVisible(false); gridLayout->addWidget(label_hostname,0,0); gridLayout->addWidget(btStringEdit_hostname,0,1,1,2); gridLayout->addWidget(label_portnum,0,3); gridLayout->addWidget(btStringEdit_portnum,0,4); gridLayout->addWidget(label_schema,1,0); gridLayout->addWidget(btStringEdit_schema,1,1); gridLayout->addWidget(label_dbName,2,0); gridLayout->addWidget(btStringEdit_dbname,2,1); gridLayout->addWidget(label_username,3,0); gridLayout->addWidget(btStringEdit_username,3,1); gridLayout->addWidget(label_password,4,0); gridLayout->addWidget(btStringEdit_password,4,1); gridLayout->addWidget(checkBox_savePassword, 4, 4); } else { postgresVisible(false); sqliteVisible(true); gridLayout->addWidget(label_dataDir,0,0); gridLayout->addWidget(btStringEdit_dataDir,0,1,1,2); gridLayout->addWidget(pushButton_browseDataDir,0,3); gridLayout->addWidget(label_backupDir,1,0); gridLayout->addWidget(btStringEdit_backupDir,1,1,1,2); gridLayout->addWidget(pushButton_browseBackupDir,1,3); gridLayout->addWidget(label_numBackups,3,0); gridLayout->addWidget(spinBox_numBackups,3,1); gridLayout->addWidget(label_frequency,4,0); gridLayout->addWidget(spinBox_frequency,4,1); } groupBox_dbConfig->setVisible(true); }
void clearLayout( QLayout* layout ) { while ( QLayoutItem* item = layout->takeAt( 0 ) ) { if ( QWidget* widget = item->widget() ) widget->deleteLater(); if ( QLayout* childLayout = item->layout() ) clearLayout( childLayout ); delete item; } }
void clearLayout(QLayout* layout, bool deleteWidgets = true) { while (QLayoutItem* item = layout->takeAt(0)) { if (deleteWidgets) { if (QWidget* widget = item->widget()) delete widget; } if (QLayout* childLayout = item->layout()) clearLayout(childLayout, deleteWidgets); delete item; } }