void ItemHandlerGroupbox::Handle (const QDomElement& item, QWidget *pwidget) { QGroupBox *box = new QGroupBox (XSD_->GetLabel (item)); box->setObjectName (item.attribute ("property")); QGridLayout *groupLayout = new QGridLayout (); groupLayout->setContentsMargins (2, 2, 2, 2); box->setLayout (groupLayout); box->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); box->setCheckable (true); QVariant value = XSD_->GetValue (item); box->setChecked (value.toBool ()); connect (box, SIGNAL (toggled (bool)), this, SLOT (updatePreferences ())); box->setProperty ("ItemHandler", QVariant::fromValue<QObject*> (this)); XSD_->ParseEntity (item, box); QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ()); lay->addWidget (box, lay->rowCount (), 0, 1, 2); QSpacerItem *verticalSpacer = new QSpacerItem (10, 20, QSizePolicy::Minimum, QSizePolicy::Expanding); lay->addItem (verticalSpacer, lay->rowCount (), 0); }
Kleo::CryptoConfigComponentGUI::CryptoConfigComponentGUI( CryptoConfigModule* module, Kleo::CryptoConfigComponent* component, QWidget* parent ) : QWidget( parent ), mComponent( component ) { QGridLayout * glay = new QGridLayout( this ); glay->setSpacing( KDialog::spacingHint() ); const QStringList groups = mComponent->groupList(); if ( groups.size() > 1 ) { glay->setColumnMinimumWidth( 0, KDHorizontalLine::indentHint() ); for ( QStringList::const_iterator it = groups.begin(), end = groups.end() ; it != end; ++it ) { Kleo::CryptoConfigGroup* group = mComponent->group( *it ); Q_ASSERT( group ); if ( !group ) continue; const QString title = group->description(); KDHorizontalLine * hl = new KDHorizontalLine( title.isEmpty() ? *it : title, this ); const int row = glay->rowCount(); glay->addWidget( hl, row, 0, 1, 3 ); mGroupGUIs.append( new CryptoConfigGroupGUI( module, group, glay, this ) ); } } else if ( !groups.empty() ) { mGroupGUIs.append( new CryptoConfigGroupGUI( module, mComponent->group( groups.front() ), glay, this ) ); } glay->setRowStretch( glay->rowCount(), 1 ); }
WSI_Appearance::WSI_Appearance(WorkspaceSettings& settings) : WSI_Base(settings), mUseOpenGlWidget(nullptr), mUseOpenGlCheckBox(nullptr) { mUseOpenGlWidget = new QWidget(); QGridLayout* openGlLayout = new QGridLayout(mUseOpenGlWidget); openGlLayout->setContentsMargins(0, 0, 0, 0); mUseOpenGlCheckBox = new QCheckBox(tr("Use OpenGL Hardware Acceleration")); openGlLayout->addWidget(mUseOpenGlCheckBox, openGlLayout->rowCount(), 0); openGlLayout->addWidget(new QLabel(tr("This setting will be applied only to newly " "opened windows.")), openGlLayout->rowCount(), 0); // load from settings revert(); }
/** * @fn githubFinished */ void GithubModule::githubFinished(QNetworkReply *reply) { if (debug) qDebug() << "[GithubModule]" << "[githubFinished]"; if (debug) qDebug() << "[GithubModule]" << "[githubFinished]" << ":" << "Error state" << reply->error(); if (debug) qDebug() << "[GithubModule]" << "[githubFinished]" << ":" << "Reply size" << reply->readBufferSize(); bool state = true; QString answer = reply->readAll(); if (debug) qDebug() << "[GithubModule]" << "[replyFinished]" << ":" << answer; QString messageBody, messageTitle; QMessageBox::Icon icon = QMessageBox::NoIcon; if (answer.contains(QString("\"html_url\":"))) { QString url; for (int i=0; i<answer.split(QChar(',')).count(); i++) if (answer.split(QChar(','))[i].split(QChar(':'))[0] == QString("\"html_url\"")) { url = answer.split(QChar(','))[i].split(QString("\"html_url\":"))[1].remove(QChar('"')); break; } messageBody += QString("%1\n").arg(QApplication::translate("Reportabug", "Message has been sended")); messageBody += QString("Url: %2").arg(url); messageTitle = QApplication::translate("Reportabug", "Done!"); icon = QMessageBox::Information; state = true; } else if (answer.contains(QString("\"Bad credentials\""))) { messageBody += QApplication::translate("Reportabug", "Incorrect username or password"); messageTitle = QApplication::translate("Reportabug", "Error!"); icon = QMessageBox::Critical; state = false; } else { messageBody += QApplication::translate("Reportabug", "An error occurs"); messageTitle = QApplication::translate("Reportabug", "Error!"); icon = QMessageBox::Critical; state = false; } reply->deleteLater(); QMessageBox messageBox; messageBox.setText(messageTitle); messageBox.setInformativeText(messageBody); messageBox.setIcon(icon); messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Retry); messageBox.setDefaultButton(QMessageBox::Ok); QSpacerItem *horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); QGridLayout *layout = (QGridLayout *)messageBox.layout(); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); int ret = messageBox.exec(); switch (ret) { case QMessageBox::Ok: if (state) mainWindow->close(); break; case QMessageBox::Retry: if (state) mainWindow->externalUpdateTab(); break; default: break; } }
//++++++++++++++++++++++++++++++++++++++++++++++++ void NinjamPanel::createHostSyncButton(QString buttonText){ hostSyncButton = new QPushButton(buttonText); QGridLayout* layout = dynamic_cast<QGridLayout*>(ui->panelCombos->layout()); layout->addWidget(hostSyncButton, layout->rowCount(), 0, 1, 2); QObject::connect(hostSyncButton, SIGNAL(clicked(bool)), this, SIGNAL(hostSyncButtonClicked())); }
void Wallets::add(QString title, QString wallet, QString link) { QLabel *label_title = new QLabel(title, this); label_title->setAlignment(Qt::AlignRight | Qt::AlignVCenter); label_title->setMinimumWidth(80); QLineEdit *input_wallet = new QLineEdit(wallet, this); input_wallet->setReadOnly(true); input_wallet->setCursor(Qt::IBeamCursor); QToolButton *btn_copy = new QToolButton(this); btn_copy->setProperty("wallet_id", wallet); btn_copy->setIcon(QIcon(":/gfx/actions/copy.png")); btn_copy->setToolTip(tr("Copy to Clipboard")); QToolButton *btn_link = new QToolButton(this); btn_link->setProperty("wallet_link", link); btn_link->setIcon(QIcon(":/gfx/actions/coins.png")); btn_link->setToolTip(QApplication::translate("MainWindow", "Donate")); btn_link->setEnabled(!link.isEmpty()); QGridLayout *grid = qobject_cast<QGridLayout*>(layout()); const int ROW = grid->rowCount(); grid->addWidget(label_title, ROW, 0, Qt::AlignRight); grid->addWidget(input_wallet, ROW, 1); grid->addWidget(btn_copy, ROW, 2); grid->addWidget(btn_link, ROW, 3); connect(btn_copy, SIGNAL(clicked()), this, SLOT(copy())); connect(btn_link, SIGNAL(clicked()), this, SLOT(open())); }
void ItemHandlerTreeView::Handle (const QDomElement& item, QWidget *pwidget) { QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ()); QTreeView *tree = new QTreeView (XSD_); tree->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); QString prop = item.attribute ("property"); tree->setObjectName (prop); tree->setHeaderHidden (item.attribute ("hideHeader") == "true"); Factory_->RegisterDatasourceSetter (prop, [this] (const QString& str, QAbstractItemModel *m, Util::XmlSettingsDialog*) { SetDataSource (str, m); }); Propname2TreeView_ [prop] = tree; QLabel *label = new QLabel (XSD_->GetLabel (item)); label->setWordWrap (false); tree->setProperty ("ItemHandler", QVariant::fromValue<QObject*> (this)); int row = lay->rowCount (); lay->addWidget (label, row, 0, Qt::AlignLeft); lay->addWidget (tree, row + 1, 0, 1, -1); }
void MainWindow::generateReportFromDataRange() { QString absolutePath = QFileDialog::getSaveFileName(this,"Zapisz raport", QString(), tr("Pdf document (*.pdf)")); if(absolutePath.trimmed().isEmpty()) return; DialogBusy dialogBusy; dialogBusy.setModal(true); dialogBusy.setLabelText("Trwa generowanie raportu..."); dialogBusy.show(); this->ct->reports->reportFromDataRange(ui->reportDataRangeFrom->value(), ui->reportDataRangeTo->value(), this->getSelectedObjectName(), absolutePath); dialogBusy.close(); QMessageBox msgBox; msgBox.setInformativeText(QString::fromUtf8("Raport został pomyślnie wygenerowany.")); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setIcon(QMessageBox::Information); msgBox.setWindowTitle(QString::fromUtf8("Raport")); // workaround for not working setMinimumWidth: QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); QGridLayout* layout = (QGridLayout*)msgBox.layout(); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); msgBox.exec(); }
void ItemHandlerRadio::Handle (const QDomElement& item, QWidget *pwidget) { QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ()); RadioGroup *group = new RadioGroup (XSD_); group->setObjectName (item.attribute ("property")); QDomElement option = item.firstChildElement ("option"); while (!option.isNull ()) { QRadioButton *button = new QRadioButton (XSD_->GetLabel (option)); button->setObjectName (option.attribute ("name")); group->AddButton (button, option.hasAttribute ("default") && option.attribute ("default") == "true"); option = option.nextSiblingElement ("option"); } QVariant value = XSD_->GetValue (item); connect (group, SIGNAL (valueChanged ()), this, SLOT (updatePreferences ())); QGroupBox *box = new QGroupBox (XSD_->GetLabel (item)); QVBoxLayout *layout = new QVBoxLayout (); box->setLayout (layout); layout->addWidget (group); group->setProperty ("ItemHandler", QVariant::fromValue<QObject*> (this)); lay->addWidget (box, lay->rowCount (), 0); }
void ItemHandlerSpinboxRange::Handle (const QDomElement& item, QWidget *pwidget) { QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ()); QLabel *label = new QLabel (XSD_->GetLabel (item)); label->setWordWrap (false); RangeWidget *widget = new RangeWidget (); XSD_->SetTooltip (widget, item); widget->setObjectName (item.attribute ("property")); widget->SetMinimum (item.attribute ("minimum").toInt ()); widget->SetMaximum (item.attribute ("maximum").toInt ()); const QVariant& value = XSD_->GetValue (item); widget->SetRange (value); connect (widget, SIGNAL (changed ()), this, SLOT (updatePreferences ())); widget->setProperty ("ItemHandler", QVariant::fromValue<QObject*> (this)); widget->setProperty ("SearchTerms", label->text ()); int row = lay->rowCount (); lay->addWidget (label, row, 0, Qt::AlignRight); lay->addWidget (widget, row, 1); }
void ItemHandlerLineEdit::Handle (const QDomElement& item, QWidget *pwidget) { QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ()); QLabel *label = new QLabel (XSD_->GetLabel (item)); label->setWordWrap (false); const QVariant& value = XSD_->GetValue (item); QLineEdit *edit = new QLineEdit (value.toString ()); XSD_->SetTooltip (edit, item); edit->setObjectName (item.attribute ("property")); edit->setMinimumWidth (QApplication::fontMetrics () .width ("thisismaybeadefaultsetting")); if (item.hasAttribute ("password")) edit->setEchoMode (QLineEdit::Password); if (item.hasAttribute ("inputMask")) edit->setInputMask (item.attribute ("inputMask")); connect (edit, SIGNAL (textChanged (const QString&)), this, SLOT (updatePreferences ())); edit->setProperty ("ItemHandler", QVariant::fromValue<QObject*> (this)); edit->setProperty ("SearchTerms", label->text ()); int row = lay->rowCount (); lay->addWidget (label, row, 0, Qt::AlignRight); lay->addWidget (edit, row, 1); }
/* ----------------------------------------------------------------------------- ProjectInfoPage ----------------------------------------------------------------------------- */ ProjectInfoPage::ProjectInfoPage(QWidget *parent) : QWizardPage( parent ) { this->setTitle(TR("Project Information")); this->setSubTitle(TR("Specify basic information about the project " "you want to create.")); QLabel* projectNameLabel = new QLabel( TR("&Project name:"), this ); this->projectNameLineEdit = new QLineEdit( this ); projectNameLabel->setBuddy( this->projectNameLineEdit ); QLabel* projectDirLabel = new QLabel( TR("&Project directory:"), this ); this->projectDirLineEdit = new QLineEdit( this ); projectDirLabel->setBuddy( this->projectDirLineEdit ); QPushButton* browseBtn = new QPushButton("Browse",this); connect(browseBtn, SIGNAL(pressed()), this, SLOT(selectProjectDir())); QGridLayout* layout = new QGridLayout(this); layout->addWidget( projectNameLabel ); layout->addWidget( this->projectNameLineEdit ); layout->addWidget( projectDirLabel ); layout->addWidget( this->projectDirLineEdit ); layout->addWidget( browseBtn, layout->rowCount()-1, 1 ); this->registerField( ED_PROJECT_NAME"*", this->projectNameLineEdit ); this->registerField( ED_PROJECT_DIR"*", this->projectDirLineEdit ); }
void ItemHandlerPath::Handle (const QDomElement& item, QWidget *pwidget) { QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ()); QLabel *label = new QLabel (XSD_->GetLabel (item)); label->setWordWrap (false); FilePicker::Type type = FilePicker::Type::ExistingDirectory; if (item.attribute ("pickerType") == "openFileName") type = FilePicker::Type::OpenFileName; else if (item.attribute ("pickerType") == "saveFileName") type = FilePicker::Type::SaveFileName; FilePicker *picker = new FilePicker (type, XSD_); const QVariant& value = XSD_->GetValue (item); picker->SetText (value.toString ()); picker->setObjectName (item.attribute ("property")); if (item.attribute ("onCancel") == "clear") picker->SetClearOnCancel (true); if (item.hasAttribute ("filter")) picker->SetFilter (item.attribute ("filter")); connect (picker, SIGNAL (textChanged (const QString&)), this, SLOT (updatePreferences ())); picker->setProperty ("ItemHandler", QVariant::fromValue<QObject*> (this)); picker->setProperty ("SearchTerms", label->text ()); int row = lay->rowCount (); lay->addWidget (label, row, 0); lay->addWidget (picker, row, 1); }
QGroupBox* UiGenerator::createCheckBoxGroup(scheme::Para ¶, QWidget* parent, QButtonGroup* buttonGroupPtr) { auto groupBoxPtr = new QGroupBox(parent); QGridLayout* gridLayout = new QGridLayout(groupBoxPtr); if(buttonGroupPtr == nullptr) buttonGroupPtr = createButtonGroup(para, parent); for(auto paraPtr : para.getOrParas()) { auto button = new QCheckBox(paraPtr->getName(), parent); buttonGroupPtr->addButton(button); button->setChecked(util::isSelected(*paraPtr)); auto ptr = paraPtr.get(); QObject::connect(button, &QCheckBox::stateChanged, [this, ptr](bool val){ mParasManager->setVal(val, ptr); }); int row = gridLayout->rowCount(); int col = 0; gridLayout->addWidget(button, row, col++); if(util::hasComboBox(*paraPtr)) { auto comboBox = createComboBox(*paraPtr, parent); QObject::connect(button, &QCheckBox::toggled, comboBox, &QComboBox::setEnabled); gridLayout->addWidget(comboBox, row, col); } } groupBoxPtr->setLayout(gridLayout); return groupBoxPtr; }
int QGridLayoutProto::rowCount() const { QGridLayout *item = qscriptvalue_cast<QGridLayout*>(thisObject()); if (item) return item->rowCount(); return 0; }
QString QtSpacescapeExportFileDialog::getExportFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, Options options, QString *imageSize) { QString path; // TODO: allow use of dir as path (must validate) path = QDir::currentPath(); QFileDialogArgs args; args.parent = parent; args.caption = caption; args.directory = path; args.selection = ""; args.filter = filter; args.mode = AnyFile; args.options = options; // create a qt dialog QtSpacescapeExportFileDialog dialog(args); // add our widgets QLayout* l = dialog.layout(); QComboBox*q = new QComboBox(parent); q->addItem("512"); q->addItem("1024"); q->addItem("2048"); q->addItem("4096"); QLabel *sizeLabel = new QLabel("Image Size:", parent); if (dynamic_cast<QGridLayout*>(l) != 0) { QGridLayout* grid = dynamic_cast<QGridLayout*>(l); const int numRows = grid->rowCount(); // const int numCols = grid->columnCount(); grid->addWidget(sizeLabel, numRows, 0, 1, 1); grid->addWidget(q, numRows, 1, 1, 1); } dialog.setAcceptMode(AcceptSave); if (selectedFilter) dialog.selectNameFilter(*selectedFilter); if (dialog.exec() == QDialog::Accepted) { if (selectedFilter) *selectedFilter = dialog.selectedFilter(); *imageSize = q->currentText(); delete q; delete sizeLabel; return dialog.selectedFiles().value(0); } delete q; delete sizeLabel; return QString(); }
void KSwitchLanguageDialogPrivate::addLanguageButton(const QString & languageCode, bool primaryLanguage) { QString labelText = primaryLanguage ? i18n("Primary language:") : i18n("Fallback language:"); KLanguageButton *languageButton = new KLanguageButton(page); fillApplicationLanguages(languageButton); languageButton->setCurrentItem(languageCode); QObject::connect( languageButton, SIGNAL(activated(const QString &)), p, SLOT(languageOnButtonChanged(const QString &)) ); LanguageRowData languageRowData; KPushButton *removeButton = 0; if (!primaryLanguage) { removeButton = new KPushButton(i18n("Remove"), page); QObject::connect( removeButton, SIGNAL(clicked()), p, SLOT(removeButtonClicked()) ); } languageButton->setToolTip(primaryLanguage ? i18n("This is the main application language which will be used first, before any other languages.") : i18n("This is the language which will be used if any previous languages do not contain a proper translation.")); int numRows = languagesLayout->rowCount(); QLabel *languageLabel = new QLabel(labelText, page); languagesLayout->addWidget( languageLabel, numRows + 1, 1, Qt::AlignLeft ); languagesLayout->addWidget( languageButton, numRows + 1, 2, Qt::AlignLeft ); if (!primaryLanguage) { languagesLayout->addWidget( removeButton, numRows + 1, 3, Qt::AlignLeft ); languageRowData.setRowWidgets( languageLabel, languageButton, removeButton ); removeButton->show(); } languageRows.insert(removeButton, languageRowData); languageButtons.append(languageButton); languageButton->show(); languageLabel->show(); }
void MainWindow::on_actionKupo_triggered() { QSound::play(":/sound/moogle.wav"); QMessageBox messageBox; QSpacerItem* horizontalSpacer = new QSpacerItem(200, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); messageBox.setIconPixmap(QPixmap(":/icon/mog")); messageBox.setText("Kupo !"); messageBox.setWindowTitle("Kupo ?"); QGridLayout* layout = (QGridLayout*)messageBox.layout(); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); messageBox.exec(); }
void MainWindow::on_actionHelp_triggered() { QSound::play(":/sound/moogle.wav"); QMessageBox messageBox; QSpacerItem* horizontalSpacer = new QSpacerItem(300, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); messageBox.setIconPixmap(QPixmap(":/icon/mog")); messageBox.setText("Input the number of cards you obtained since your last reset, and the number of times you've loaded the World Map since your last reset, in order.\nFor example, if you just started the game, obtained the 3 cards from Ticketmaster, went once on the World Map, obtained one card from a random encounter in the Ice Cavern, and went one more time on the World Map before reaching Dali, you would input 3 / 1 / 1 / 1 in this order.\nIf you need help on a specific part of the window, simply hover your mouse on it, a tooltip should appear."); messageBox.setWindowTitle("Help meeeeeee, kupo..."); QGridLayout* layout = (QGridLayout*)messageBox.layout(); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); messageBox.exec(); }
void PreferenceDialog::on_seeInfoButton_clicked() { QMessageBox msgBox; msgBox.setText(tr("This data will help improve this application and won't be shared with anyone.")); msgBox.setDetailedText(uinfo->printJSON()); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); //Fixed size hack QSpacerItem* horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); QGridLayout* layout = (QGridLayout*)msgBox.layout(); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); msgBox.exec(); }
void ItemHandlerMultiLine::Handle (const QDomElement& item, QWidget *pwidget) { QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ()); QLabel *label = new QLabel (XSD_->GetLabel (item)); label->setWordWrap (false); const QVariant& value = XSD_->GetValue (item); QTextEdit *edit = new QTextEdit (); XSD_->SetTooltip (edit, item); edit->setPlainText (value.toStringList ().join ("\n")); edit->setObjectName (item.attribute ("property")); edit->setMinimumWidth (QApplication::fontMetrics () .width ("thisismaybeadefaultsetting")); connect (edit, SIGNAL (textChanged ()), this, SLOT (updatePreferences ())); edit->setProperty ("ItemHandler", QVariant::fromValue<QObject*> (this)); edit->setProperty ("SearchTerms", label->text ()); int row = lay->rowCount (); QString pos = item.attribute ("position"); if (pos == "bottom") { lay->addWidget (label, row, 0, Qt::AlignLeft); lay->addWidget (edit, row + 1, 0); } else if (pos == "right") { lay->addWidget (label, row, 0, Qt::AlignRight | Qt::AlignTop); lay->addWidget (edit, row, 1); } else if (pos == "left") { lay->addWidget (label, row, 1, Qt::AlignLeft | Qt::AlignTop); lay->addWidget (edit, row, 0); } else if (pos == "top") { lay->addWidget (edit, row, 0); lay->addWidget (label, row + 1, 0, Qt::AlignLeft); } else { lay->addWidget (label, row, 0, Qt::AlignRight | Qt::AlignTop); lay->addWidget (edit, row, 1); } lay->setContentsMargins (2, 2, 2, 2); }
void MaterialAirGapInspectorView::createLayout() { QWidget* hiddenWidget = new QWidget(); this->stackedWidget()->addWidget(hiddenWidget); QWidget* visibleWidget = new QWidget(); this->stackedWidget()->addWidget(visibleWidget); QGridLayout* mainGridLayout = new QGridLayout(); mainGridLayout->setContentsMargins(7, 7, 7, 7); mainGridLayout->setSpacing(14); visibleWidget->setLayout(mainGridLayout); int row = mainGridLayout->rowCount(); QLabel * label = nullptr; // Name label = new QLabel("Name: "); label->setObjectName("H2"); mainGridLayout->addWidget(label, row, 0); ++row; m_nameEdit = new OSLineEdit(); mainGridLayout->addWidget(m_nameEdit, row, 0, 1, 3); ++row; // Standards Information m_standardsInformationWidget = new StandardsInformationMaterialWidget(m_isIP, mainGridLayout, row); ++row; // Thermal Resistance label = new QLabel("Thermal Resistance: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_thermalResistance = new OSQuantityEdit(m_isIP); connect(this, &MaterialAirGapInspectorView::toggleUnitsClicked, m_thermalResistance, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_thermalResistance,row++,0,1,3); // Stretch mainGridLayout->setRowStretch(100,100); mainGridLayout->setColumnStretch(100,100); }
void MainWindow::on_actionAbout_triggered() { QSound::play(":/sound/moogle.wav"); QMessageBox messageBox; QSpacerItem* horizontalSpacer = new QSpacerItem(300, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); messageBox.setIconPixmap(QPixmap(":/icon/mog")); messageBox.setTextFormat(Qt::RichText); messageBox.setText("RNG Masters, a RNG manipulation tool for Tetra Masters in Final Fantasy IX.\nCoded in C++ with Qt. Hope you enjoy this program !\nYou can contact me on <a href='http://forums.qhimm.com/index.php?action=profile;u=25024'>forums.qhimm.com</a> (froggy25) or on <a href='http://datacrystal.romhacking.net/wiki/User_talk:Mantidactyle'>datacrystal.romhacking.net</a> (Mantidactyle).\nShout out to the FFIX speedrunning community, you guys rock !"); messageBox.setWindowTitle("About"); QGridLayout* layout = (QGridLayout*)messageBox.layout(); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); messageBox.exec(); }
void TreeModel::saveNewData(QWidget *widgetContainer, const QModelIndex &parentIndex) { TreeItem *m_parent = itemFromIndex(parentIndex); if (m_parent != NULL) { int totalChilds = m_parent->childCount(); QGridLayout *gridLayout = dynamic_cast<QGridLayout*>(widgetContainer->layout()); for (int i = 0; i < gridLayout->rowCount(); i++) { QWidgetItem *widgetItem = dynamic_cast<QWidgetItem*>(gridLayout->itemAtPosition(i,3)); if (widgetItem) { QLabel *label = dynamic_cast<QLabel*>(widgetItem->widget()); QWidgetItem *widgetItem2 = dynamic_cast<QWidgetItem*>(gridLayout->itemAtPosition(i,1)); if (label and widgetItem2) { for (int j = 0; j < totalChilds; j++) { if (label->text() == m_parent->child(j)->getUID()) { QLineEdit *lineEdit = qobject_cast<QLineEdit*>(widgetItem2->widget()); QComboBox *comboBox = qobject_cast<QComboBox*>(widgetItem2->widget()); if (lineEdit) m_parent->child(j)->setValue(lineEdit->text()); else if (comboBox) { QString valAux = ""; if (comboBox->currentText() == "TRUE") valAux = "1"; else if (comboBox->currentText() == "FALSE") valAux = "0"; m_parent->child(j)->setValue(valAux); } TreeItem *item = new TreeItem(m_parent->child(j)); m_parent->removeRow(j); m_parent->insertRow(j, item); } } } } } emit modelModified(); } }
void HgPluginSettingsWidget::setupUI() { m_diffProg = new QLineEdit; m_diffBrowseButton = new QPushButton(xi18nc("@label", "Browse")); QLabel *diffProgLabel = new QLabel(xi18nc("@label", "Visual Diff Executable")); QGridLayout *layout = new QGridLayout; layout->addWidget(diffProgLabel, 0, 0); layout->addWidget(m_diffProg, 0, 1); layout->addWidget(m_diffBrowseButton, 0, 2); layout->setRowStretch(layout->rowCount(), 1); setLayout(layout); }
NumberChoiceLive::NumberChoiceLive() { QGridLayout *layout = new QGridLayout(this); QHBoxLayout *lastRow = new QHBoxLayout(); prizeBronze = new QPixmap("media/images/Prize5.png"); prizeSilver = new QPixmap("media/images/Prize10.png"); prizeGold = new QPixmap("media/images/Prize25.png"); noButtons = 25; int cols = qCeil(qSqrt(noButtons)); // The closest square root value (works out best fit for the items) int cellSwitch = noButtons - (noButtons % cols); // The cell at which the last row starts /* Assign and randomise prizes */ int i = 0; // Keep track of the current array item int x = qCeil((noButtons*0.3)+0.5); // The point at which the prizes switch from silver to bronze, I'm thinking maybe about 30% of the total number are silver prizes prizes = new char[noButtons]; prizes[0] = 'G'; // Since we only want 1 gold we shall assign that now for (i = 1; i < x; i++) prizes[i] = 'S'; // Assign silver prizes for (;i < noButtons; i++) prizes[i] = 'B'; // Assing the rest as silver prizes qsrand(time(0)); for (i = 0; i < noButtons; i++) { // Shuffle prizes int j = qrand() % noButtons; char cur = prizes[i]; prizes[i] = prizes[j]; prizes[j] = cur; } connect(this, SIGNAL(resetAll(bool)), this, SLOT(randomizePrizes())); numbers = new QLabelArray[noButtons]; for (int i = 0; i < noButtons; i++) { //numbers[i] = new QLabel(QString::number(i+1), this); numbers[i] = new QLabel(this); numbers[i]->setPixmap(outlineText(QString::number(i+1))); numbers[i]->setStyleSheet("qproperty-alignment: AlignCenter;"); if (i < cellSwitch) layout->addWidget(numbers[i], i / cols, i % cols); // To work out rows we divide the current item number by the number of items. To work out columns we take the remainder from the devision (ie use modulus). else lastRow->addWidget(numbers[i]); } if (cellSwitch != 0) layout->addLayout(lastRow, layout->rowCount(), 0, 1, cols); // Add the last row in seperately, this allows us to centre the buttons is there are less than the number of columns setLayout(layout); }
bool SeafileApplet::detailedYesOrNoBox(const QString& msg, const QString& detailed_text, QWidget *parent, bool default_val) { QMessageBox *msgBox = new QMessageBox(QMessageBox::Question, getBrand(), msg, QMessageBox::Yes | QMessageBox::No, parent != 0 ? parent : main_win_); msgBox->setDetailedText(detailed_text); // Turns out the layout box in the QMessageBox is a grid // You can force the resize using a spacer this way: QSpacerItem* horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); QGridLayout* layout = (QGridLayout*)msgBox->layout(); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); msgBox->setDefaultButton(default_val ? QMessageBox::Yes : QMessageBox::No); return msgBox->exec() == QMessageBox::Yes; }
void XmlSettingsDialog::ParsePage (const QDomElement& page) { QString sectionTitle = GetLabel (page); Titles_ << sectionTitle; QWidget *baseWidget = new QWidget; Pages_->addWidget (baseWidget); QGridLayout *lay = new QGridLayout; lay->setContentsMargins (0, 0, 0, 0); baseWidget->setLayout (lay); baseWidget->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); ParseEntity (page, baseWidget); QSpacerItem *verticalSpacer = new QSpacerItem (10, 20, QSizePolicy::Minimum, QSizePolicy::Minimum); lay->addItem (verticalSpacer, lay->rowCount (), 0); }
WSI_DebugTools::WSI_DebugTools(WorkspaceSettings& settings) : WSI_Base(settings), mWidget(nullptr) { // create a QWidget mWidget = new QWidget(); QGridLayout* layout = new QGridLayout(mWidget); #ifndef QT_DEBUG layout->addWidget(new QLabel(tr("Warning: Some of these settings may only work in DEBUG mode!")), 0, 0); #endif // stretch the last row layout->setRowStretch(layout->rowCount(), 1); // load from settings revert(); }
void ItemHandlerColor::Handle (const QDomElement& item, QWidget *pwidget) { QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ()); QString labelString = XSD_->GetLabel (item); QLabel *label = new QLabel (labelString); label->setWordWrap (false); ColorPicker *picker = new ColorPicker (labelString); picker->setObjectName (item.attribute ("property")); picker->SetCurrentColor (XSD_->GetValue (item).value<QColor> ()); connect (picker, SIGNAL (currentColorChanged (const QColor&)), this, SLOT (updatePreferences ())); picker->setProperty ("ItemHandler", QVariant::fromValue<QObject*> (this)); int row = lay->rowCount (); lay->setColumnMinimumWidth (0, 10); lay->setColumnStretch (0, 1); lay->setColumnStretch (1, 10); lay->addWidget (label, row, 0); lay->addWidget (picker, row, 1, Qt::AlignLeft); }