/** * Sets up the window * * This method clears, sets up and populates the tree view with the correct * and wrong people, and adjusts the labels. * * @param correctPerson the correct person entry * @param wrongPeople a list of one or more wrong person entries */ void ConfirmOverwritePersonDialog::setup (const Person &correctPerson, const QList<Person> &wrongPeople) { // Store the people data this->correctPerson=correctPerson; this->wrongPeople=wrongPeople; // Clear the tree ui.entriesTree->clear (); // Create the root items wrongParentItem =new QTreeWidgetItem (ui.entriesTree); correctParentItem=new QTreeWidgetItem (ui.entriesTree); // Setup the root items wrongParentItem ->setFirstColumnSpanned (true); correctParentItem->setFirstColumnSpanned (true); // Create (empty) children items for the correct person and wrong people. // The contents depend on the language and will be filled in by setupTexts. new QTreeWidgetItem (correctParentItem); for (int i=0, n=wrongPeople.size (); i<n; ++i) new QTreeWidgetItem (wrongParentItem); // Fill in all language dependent texts setupTexts (); // Expand the root items wrongParentItem ->setExpanded (true); correctParentItem->setExpanded (true); for (int i=0, n=ui.entriesTree->columnCount (); i<n; ++i) ui.entriesTree->resizeColumnToContents (i); }
void WizardStartPage::initializePage() { ui->comboBox->clear(); ui->comboBox->addItem("English"); ui->comboBox->addItems(Translations::instance()->availableLanguages()); ui->comboBox->setCurrentText(Translations::instance()->nativeLanguage(sxWizard()->language())); connect(ui->comboBox, &QComboBox::currentTextChanged, this, &WizardStartPage::onLanguageChange, Qt::UniqueConnection); setupTexts(); }
void WizardStartPage::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { setupTexts(); } else QWidget::changeEvent(e); }
void ConfirmOverwritePersonDialog::languageChanged () { SkDialog<Ui::ConfirmOverwritePersonDialogClass>::languageChanged (); setupTexts (); adjustSize (); }