本文整理汇总了C++中QCheckBox类的典型用法代码示例。如果您正苦于以下问题:C++ QCheckBox类的具体用法?C++ QCheckBox怎么用?C++ QCheckBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QCheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
DeviceState::DeviceState(QWidget *parent) :
QWidget(parent), tabs(this)
{
/* UI stuff */
resize(500,400);
setWindowIcon(QIcon(":/resources/windowicon.png"));
setWindowTitle(tr("Device Settings"));
QFormLayout* layout = new QFormLayout(this);
layout->addWidget(&tabs);
this->setLayout(layout);
/* Loading the tabs */
QScrollArea* currentArea = 0;
QWidget* panel;
QFile fin(":/resources/deviceoptions");
fin.open(QFile::Text | QFile::ReadOnly);
while(!fin.atEnd())
{
QString line = QString(fin.readLine());
line = line.trimmed();
/* Continue on a comment or an empty line */
if(line[0] == '#' || line.length() == 0)
continue;
if(line[0] == '[')
{
QString buffer;
for(int i = 1; line[i] != ']'; i++)
buffer.append(line[i]);
buffer = buffer.trimmed();
panel = new QWidget();
currentArea = new QScrollArea();
layout = new QFormLayout(panel);
currentArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
currentArea->setWidget(panel);
currentArea->setWidgetResizable(true);
tabs.addTab(currentArea, buffer);
continue;
}
QStringList elements = line.split(";");
QString tag = elements[0].trimmed();
QString title = elements[1].trimmed();
QString type = elements[2].trimmed();
QString defVal = elements[3].trimmed();
elements = type.split("(");
if(elements[0].trimmed() == "text")
{
QLineEdit* temp = new QLineEdit(defVal, currentArea);
layout->addRow(title, temp);
inputs.insert(tag, QPair<InputType, QWidget*>(Text, temp));
temp->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
QSizePolicy::Fixed));
QObject::connect(temp, SIGNAL(textChanged(QString)),
this, SLOT(input()));
}
else if(elements[0].trimmed() == "check")
{
QCheckBox* temp = new QCheckBox(title, currentArea);
layout->addRow(temp);
if(defVal.toLower() == "true")
temp->setChecked(true);
else
temp->setChecked(false);
inputs.insert(tag, QPair<InputType, QWidget*>(Check, temp));
QObject::connect(temp, SIGNAL(toggled(bool)),
this, SLOT(input()));
}
else if(elements[0].trimmed() == "slider")
示例2: tr
// ---------------------------------------------------------------
void PackageDialog::slotCreate()
{
if(NameEdit->text().isEmpty()) {
QMessageBox::critical(this, tr("Error"), tr("Please insert a package name!"));
return;
}
QCheckBox *p;
QListIterator<QCheckBox *> i(BoxList);
if(!LibraryCheck->isChecked()) {
int count=0;
while(i.hasNext()){
p = i.next();
if(p->isChecked())
count++;
}
if(count < 1) {
QMessageBox::critical(this, tr("Error"), tr("Please choose at least one project!"));
return;
}
}
QString s(NameEdit->text());
QFileInfo Info(s);
if(Info.extension().isEmpty())
s += ".qucs";
NameEdit->setText(s);
QFile PkgFile(s);
if(PkgFile.exists())
if(QMessageBox::information(this, tr("Info"),
tr("Output file already exists!")+"\n"+tr("Overwrite it?"),
tr("&Yes"), tr("&No"), 0,1,1))
return;
if(!PkgFile.open(QIODevice::ReadWrite)) {
QMessageBox::critical(this, tr("Error"), tr("Cannot create package!"));
return;
}
QDataStream Stream(&PkgFile);
// First write header.
char Header[HEADER_LENGTH];
memset(Header, 0, HEADER_LENGTH);
strcpy(Header, "Qucs package " PACKAGE_VERSION);
PkgFile.writeBlock(Header, HEADER_LENGTH);
// Write project files to package.
i.toFront();
while(i.hasNext()) {
p = i.next();
if(p->isChecked()) {
s = p->text() + "_prj";
Stream << Q_UINT32(CODE_DIR) << s.latin1();
s = QucsSettings.QucsHomeDir.absPath() + QDir::separator() + s;
if(insertDirectory(s, Stream) < 0) {
PkgFile.close();
PkgFile.remove();
return;
}
Stream << Q_UINT32(CODE_DIR_END) << Q_UINT32(0);
}
}
// Write user libraries to package if desired.
if(LibraryCheck->isChecked())
if(insertLibraries(Stream) < 0) {
PkgFile.close();
PkgFile.remove();
return;
}
// Calculate checksum and write it to package file.
PkgFile.at(0);
QByteArray Content = PkgFile.readAll();
Q_UINT16 Checksum = qChecksum(Content.data(), Content.size());
PkgFile.at(HEADER_LENGTH-sizeof(Q_UINT16));
Stream << Checksum;
PkgFile.close();
QMessageBox::information(this, tr("Info"),
tr("Successfully created Qucs package!"));
accept();
}
示例3: dialSettings
//-------------------------------------------------------------------------------------------------
void ExchangeRate::slotShowSettings()
{
QDialog dialSettings(this, Qt::WindowCloseButtonHint);
QLabel *lblPrecision = new QLabel(tr("Precision:"), &dialSettings);
QSpinBox *sbPrecision = new QSpinBox(&dialSettings);
sbPrecision->setRange(0, 10);
sbPrecision->setValue(iPrecision);
QHBoxLayout *hblPrecision = new QHBoxLayout;
hblPrecision->addWidget(lblPrecision, 0, Qt::AlignRight);
hblPrecision->addWidget(sbPrecision, 0, Qt::AlignLeft);
QCheckBox *chbProxy = new QCheckBox(tr("Use proxy"), &dialSettings);
chbProxy->setChecked(bUseProxy);
lblType = new QLabel(tr("Type:"), &dialSettings);
cbType = new QComboBox(&dialSettings);
cbType->addItems(QStringList("HTTP") << "SOCKS5");
cbType->setCurrentIndex(bProxyIsSocks);
lblServer = new QLabel(tr("Server:"), &dialSettings);
leServer = new QLineEdit(&dialSettings);
leServer->setText(strServer);
lblPort = new QLabel(tr("Port:"), &dialSettings);
sbPort = new QSpinBox(&dialSettings);
sbPort->setRange(1, 65535);
sbPort->setValue(iPort);
chbAuth = new QCheckBox(tr("Authorization"), &dialSettings);
chbAuth->setChecked(bAuth);
lblUser = new QLabel(tr("User:"), &dialSettings);
leUser = new QLineEdit(&dialSettings);
leUser->setText(strUser);
lblPassword = new QLabel(tr("Password:"), &dialSettings);
lePassword = new QLineEdit(&dialSettings);
lePassword->setEchoMode(QLineEdit::Password);
lePassword->setText(strPassword);
if (!bUseProxy)
slotToggleProxy(false); //disable proxy widgets
else if (!bAuth)
slotToggleAuth(false); //disable auth widgets
QGroupBox *gbProxy = new QGroupBox(tr("Proxy"), &dialSettings);
QGridLayout *glProxy = new QGridLayout(gbProxy);
glProxy->addWidget(chbProxy, 0, 1);
glProxy->addWidget(lblType, 1, 0);
glProxy->addWidget(cbType, 1, 1);
glProxy->addWidget(lblServer, 2, 0);
glProxy->addWidget(leServer, 2, 1);
glProxy->addWidget(lblPort, 3, 0);
glProxy->addWidget(sbPort, 3, 1);
glProxy->addWidget(chbAuth, 4, 1);
glProxy->addWidget(lblUser, 5, 0);
glProxy->addWidget(leUser, 5, 1);
glProxy->addWidget(lblPassword, 6, 0);
glProxy->addWidget(lePassword, 6, 1);
QPushButton *pbOk = new QPushButton(style()->standardIcon(QStyle::SP_DialogApplyButton), "OK", this);
QVBoxLayout *vblStg = new QVBoxLayout(&dialSettings);
vblStg->addLayout(hblPrecision);
vblStg->addWidget(gbProxy);
vblStg->addWidget(pbOk, 0, Qt::AlignHCenter);
dialSettings.setFixedHeight(dialSettings.minimumSizeHint().height());
//connects
connect(chbProxy, SIGNAL(toggled(bool)), this, SLOT(slotToggleProxy(bool)));
connect(chbAuth, SIGNAL(toggled(bool)), this, SLOT(slotToggleAuth(bool)));
connect(pbOk, SIGNAL(clicked()), &dialSettings, SLOT(accept()));
if (dialSettings.exec() == QDialog::Accepted)
{
iPrecision = sbPrecision->value();
bUseProxy = chbProxy->isChecked();
bProxyIsSocks = cbType->currentIndex();
strServer = leServer->text();
iPort = sbPort->value();
bAuth = chbAuth->isChecked();
strUser = leUser->text();
strPassword = lePassword->text();
if (bUseProxy)
{
QNetworkProxy netProxy(bProxyIsSocks ? QNetworkProxy::Socks5Proxy : QNetworkProxy::HttpProxy, strServer, iPort);
if (bAuth)
{
netProxy.setUser(strUser);
netProxy.setPassword(strPassword);
}
nam->setProxy(netProxy);
}
else
nam->setProxy(QNetworkProxy());
QSettings stg(strAppStg, QSettings::IniFormat);
stg.setIniCodec("UTF-8");
stg.beginGroup("Settings");
stg.setValue("Precision", iPrecision);
stg.setValue("UseProxy", bUseProxy ? "1" : "0");
stg.setValue("ProxyType", bProxyIsSocks ? "SOCKS5" : "HTTP");
stg.setValue("Server", strServer);
//.........这里部分代码省略.........
示例4: KDialogBase
ServerListDialog::ServerListDialog(QWidget *parent, const char *name)
: KDialogBase(Plain, i18n("Server List"), Ok|Close, Ok, parent, name, false)
{
setButtonOK(KGuiItem(i18n("C&onnect"), "connect_creating", i18n("Connect to the server"), i18n("Click here to connect to the selected IRC network and channel.")));
QFrame* mainWidget = plainPage();
m_serverList = new ServerListView(mainWidget);
QWhatsThis::add(m_serverList, i18n("This shows the listof configured IRC networks. An IRC network is a collection of cooperating servers. You need only connect to one of the servers in the network to be connected to the entire IRC network. Once connected, Konversation will automatically join the channels shown. When Konversation is started for the first time, the Freenode network and the <i>#kde</i> channel are already entered for you."));
m_serverList->setAllColumnsShowFocus(true);
m_serverList->setRootIsDecorated(true);
m_serverList->setResizeMode(QListView::AllColumns);
m_serverList->addColumn(i18n("Network"));
m_serverList->addColumn(i18n("Identity"));
m_serverList->addColumn(i18n("Channels"));
m_serverList->setSelectionModeExt(KListView::Extended);
m_serverList->setShowSortIndicator(true);
m_serverList->setSortColumn(0);
m_serverList->setDragEnabled(true);
m_serverList->setAcceptDrops(true);
m_serverList->setDropVisualizer(true);
m_serverList->header()->setMovingEnabled(false);
m_addButton = new QPushButton(i18n("&New..."), mainWidget);
QWhatsThis::add(m_addButton, i18n("Click here to define a new Network, including the server to connect to, and the Channels to automatically join once connected."));
m_editButton = new QPushButton(i18n("&Edit..."), mainWidget);
m_delButton = new QPushButton(i18n("&Delete"), mainWidget);
QCheckBox* showAtStartup = new QCheckBox(i18n("Show at application startup"), mainWidget);
showAtStartup->setChecked(Preferences::showServerList());
connect(showAtStartup, SIGNAL(toggled(bool)), this, SLOT(setShowAtStartup(bool)));
QGridLayout* layout = new QGridLayout(mainWidget, 5, 2, 0, spacingHint());
layout->addMultiCellWidget(m_serverList, 0, 3, 0, 0);
layout->addWidget(m_addButton, 0, 1);
layout->addWidget(m_editButton, 1, 1);
layout->addWidget(m_delButton, 2, 1);
layout->addMultiCellWidget(showAtStartup, 4, 4, 0, 1);
layout->setRowStretch(3, 10);
m_serverList->setFocus();
m_selectedItem = false;
m_selectedServer = ServerSettings("");
// Load server list
updateServerList();
connect(m_serverList, SIGNAL(aboutToMove()), this, SLOT(slotAboutToMove()));
connect(m_serverList, SIGNAL(moved()), this, SLOT(slotMoved()));
connect(m_serverList, SIGNAL(doubleClicked(QListViewItem *, const QPoint&, int)), this, SLOT(slotOk()));
connect(m_serverList, SIGNAL(selectionChanged()), this, SLOT(updateButtons()));
connect(m_serverList, SIGNAL(expanded(QListViewItem*)), this, SLOT(slotSetGroupExpanded(QListViewItem*)));
connect(m_serverList, SIGNAL(collapsed(QListViewItem*)), this, SLOT(slotSetGroupCollapsed(QListViewItem*)));
connect(m_addButton, SIGNAL(clicked()), this, SLOT(slotAdd()));
connect(m_editButton, SIGNAL(clicked()), this, SLOT(slotEdit()));
connect(m_delButton, SIGNAL(clicked()), this, SLOT(slotDelete()));
updateButtons();
KConfig* config = kapp->config();
config->setGroup("ServerListDialog");
QSize newSize = size();
newSize = config->readSizeEntry("Size", &newSize);
resize(newSize);
m_serverList->setSelected(m_serverList->firstChild(), true);
}
示例5: QDialog
NewAccountDialog::NewAccountDialog(const QList<QString>& allKeychains, const QList<QString>& selectedKeychains, QWidget* parent)
: QDialog(parent)
{
if (allKeychains.isEmpty()) {
throw std::runtime_error(tr("You must first create at least one keychain.").toStdString());
}
keychainSet = selectedKeychains.toSet();
QList<QString> keychains = allKeychains;
qSort(keychains.begin(), keychains.end());
// Buttons
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel);
okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setEnabled(false);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
// Account Name
QLabel* nameLabel = new QLabel();
nameLabel->setText(tr("Account Name:"));
nameEdit = new QLineEdit();
connect(nameEdit, &QLineEdit::textChanged, [this](const QString& /*text*/) { updateEnabled(); });
QHBoxLayout* nameLayout = new QHBoxLayout();
nameLayout->setSizeConstraint(QLayout::SetNoConstraint);
nameLayout->addWidget(nameLabel);
nameLayout->addWidget(nameEdit);
// Keychain List Widget
QLabel* selectionLabel = new QLabel(tr("Select keychains:"));
keychainListWidget = new QListWidget();
for (auto& keychain: keychains)
{
QCheckBox* checkBox = new QCheckBox(keychain);
checkBox->setCheckState(selectedKeychains.count(keychain) ? Qt::Checked : Qt::Unchecked);
connect(checkBox, &QCheckBox::stateChanged, [=](int state) { updateSelection(keychain, state); });
QListWidgetItem* item = new QListWidgetItem();
keychainListWidget->addItem(item);
keychainListWidget->setItemWidget(item, checkBox);
}
// Minimum Signatures
QLabel *minSigLabel = new QLabel();
minSigLabel->setText(tr("Minimum Signatures:"));
minSigComboBox = new QComboBox();
minSigLineEdit = new QLineEdit();
minSigLineEdit->setAlignment(Qt::AlignRight);
minSigComboBox->setLineEdit(minSigLineEdit);
QHBoxLayout* minSigLayout = new QHBoxLayout();
minSigLayout->setSizeConstraint(QLayout::SetNoConstraint);
minSigLayout->addWidget(minSigLabel);
minSigLayout->addWidget(minSigComboBox);
updateMinSigs();
// Creation Time
QDateTime localDateTime = QDateTime::currentDateTime();
QLabel* creationTimeLabel = new QLabel(tr("Creation Time ") + "(" + localDateTime.timeZoneAbbreviation() + "):");
creationTimeEdit = new QDateTimeEdit(QDateTime::currentDateTime());
creationTimeEdit->setDisplayFormat("yyyy.MM.dd hh:mm:ss");
creationTimeEdit->setCalendarPopup(true);
calendarWidget = new QCalendarWidget(this);
creationTimeEdit->setCalendarWidget(calendarWidget);
QHBoxLayout* creationTimeLayout = new QHBoxLayout();
creationTimeLayout->setSizeConstraint(QLayout::SetNoConstraint);
creationTimeLayout->addWidget(creationTimeLabel);
creationTimeLayout->addWidget(creationTimeEdit);
// Main Layout
QVBoxLayout *mainLayout = new QVBoxLayout();
mainLayout->setSizeConstraint(QLayout::SetNoConstraint);
mainLayout->addLayout(nameLayout);
mainLayout->addWidget(selectionLabel);
mainLayout->addWidget(keychainListWidget);
mainLayout->addLayout(minSigLayout);
mainLayout->addLayout(creationTimeLayout);
mainLayout->addWidget(buttonBox);
setLayout(mainLayout);
}
示例6: tr
void
AddIntervalDialog::createClicked()
{
const RideFile *ride = context->currentRide();
if (!ride) {
QMessageBox::critical(this, tr("Select Ride"), tr("No ride selected!"));
return;
}
int maxIntervals = (int) countSpinBox->value();
double windowSizeSecs = (hrsSpinBox->value() * 3600.0
+ minsSpinBox->value() * 60.0
+ secsSpinBox->value());
double windowSizeMeters = (kmsSpinBox->value() * 1000.0
+ msSpinBox->value());
if (windowSizeSecs == 0.0) {
QMessageBox::critical(this, tr("Bad Interval Length"),
tr("Interval length must be greater than zero!"));
return;
}
bool byTime = typeTime->isChecked();
QList<AddedInterval> results;
if (methodBestPower->isChecked()) {
if (peakPowerStandard->isChecked())
findPeakPowerStandard(ride, results);
else
findBests(byTime, ride, (byTime?windowSizeSecs:windowSizeMeters), maxIntervals, results, "");
}
else
findFirsts(byTime, ride, (byTime?windowSizeSecs:windowSizeMeters), maxIntervals, results);
// clear the table
clearResultsTable(resultsTable);
// populate the table
resultsTable->setRowCount(results.size());
int row = 0;
foreach (const AddedInterval &interval, results) {
double secs = interval.start;
double mins = floor(secs / 60);
secs = secs - mins * 60.0;
double hrs = floor(mins / 60);
mins = mins - hrs * 60.0;
// check box
QCheckBox *c = new QCheckBox;
c->setCheckState(Qt::Checked);
resultsTable->setCellWidget(row, 0, c);
// start time
QString start = "%1:%2:%3";
start = start.arg(hrs, 0, 'f', 0);
start = start.arg(mins, 2, 'f', 0, QLatin1Char('0'));
start = start.arg(round(secs), 2, 'f', 0, QLatin1Char('0'));
QTableWidgetItem *t = new QTableWidgetItem;
t->setText(start);
t->setFlags(t->flags() & (~Qt::ItemIsEditable));
resultsTable->setItem(row, 1, t);
QTableWidgetItem *n = new QTableWidgetItem;
n->setText(interval.name);
n->setFlags(n->flags() | (Qt::ItemIsEditable));
resultsTable->setItem(row, 2, n);
// hidden columns - start, stop
QString strt = QString("%1").arg(interval.start); // can't use secs as it gets modified
QTableWidgetItem *st = new QTableWidgetItem;
st->setText(strt);
resultsTable->setItem(row, 3, st);
QString stp = QString("%1").arg(interval.stop); // was interval.start+x
QTableWidgetItem *sp = new QTableWidgetItem;
sp->setText(stp);
resultsTable->setItem(row, 4, sp);
row++;
}
示例7: QCheckBox
QWidget* QgsCheckboxSearchWidgetWrapper::createWidget( QWidget* parent )
{
QCheckBox* c = new QCheckBox( parent );
c->setChecked( Qt::PartiallyChecked );
return c;
}
示例8: QWidget
//.........这里部分代码省略.........
toolbar_opts->setMinimumSize(QSize(30, 30));
toolbar_opts->setStyleSheet("QToolBar{border:0px;}");
m_find_replace_text_action = createAction(QIcon(m_theme +"img16/edit_buscar.png"), tr("Buscar") +"/"+ tr("Reemplazar"), true, toolbar_opts);
m_find_replace_text_action->setPriority(QAction::LowPriority);
m_find_replace_text_action->setShortcut(QKeySequence::Find);
connect(m_find_replace_text_action, SIGNAL(triggered(bool)), this, SLOT(on_show_find_replace(bool)));
toolbar_opts->addAction(m_find_replace_text_action);
m_rich_plain_action = createAction(QIcon(m_theme +"img16/script.png"), tr("Editor") +"/"+ tr("Código"), true, toolbar_opts);
connect(m_rich_plain_action, SIGNAL(triggered(bool)), this, SLOT(on_show_source(bool)));
toolbar_opts->addAction(m_rich_plain_action);
m_smiles_action = createAction(QIcon(m_theme +"img16/smile.png"), tr("Smiles"), true, toolbar_opts);
connect(m_smiles_action, SIGNAL(triggered(bool)), list_smile, SLOT(setVisible(bool)));
toolbar_opts->addAction(m_smiles_action);
toolbar_layout->addWidget(toolbar_opts);
toolbar_layout->setStretch(0, 1);
main_layout->addLayout(toolbar_layout);
QHBoxLayout *edit_smiles_layout = new QHBoxLayout();
edit_smiles_layout->setContentsMargins(0, 0, 0, 0);
edit_smiles_layout->setSpacing(4);
QWidget *rich_edit = new QWidget();
QVBoxLayout *rich_edit_layout = new QVBoxLayout(rich_edit);
rich_edit_layout->setContentsMargins(0, 0, 0, 0);
rich_edit_layout->addWidget(editor_rich_text);
pag_stacked->addWidget(rich_edit);
QWidget *plain_edit = new QWidget();
QVBoxLayout *plain_edit_layout = new QVBoxLayout(plain_edit);
plain_edit_layout->setContentsMargins(0, 0, 0, 0);
plain_edit_layout->addWidget(editor_plain_text);
pag_stacked->addWidget(plain_edit);
connect(pag_stacked, SIGNAL(currentChanged(int)), this, SLOT(pagIndexChanged(int)));
edit_smiles_layout->addWidget(pag_stacked);
edit_smiles_layout->addWidget(list_smile);
main_layout->addLayout(edit_smiles_layout);
QGridLayout *gridLayout = new QGridLayout(toolbar_find_replace);
gridLayout->setSpacing(4);
gridLayout->setContentsMargins(0, 0, 0, 0);
QLabel *lb_find = new QLabel(tr("Buscar")+":", toolbar_find_replace);
gridLayout->addWidget(lb_find, 0, 0, 1, 1);
txt_find = new QLineEdit(toolbar_find_replace);
txt_find->setMinimumSize(QSize(0, 24));
connect(txt_find, SIGNAL(textChanged(QString)), this, SLOT(txtFindTextChanged(QString)));
gridLayout->addWidget(txt_find, 0, 1, 1, 1);
QToolButton *btnFindBack = createToolButton(QIcon(m_theme +"img16/edit_buscar_anterior.png"), tr("Buscar anterior"), toolbar_find_replace);
btnFindBack->setShortcut(QKeySequence::FindPrevious);
connect(btnFindBack, SIGNAL(clicked()), this, SLOT(btnFindBack_clicked()));
gridLayout->addWidget(btnFindBack, 0, 2, 1, 1);
QToolButton *btnFindNext = createToolButton(QIcon(m_theme +"img16/edit_buscar_siguiente.png"), tr("Buscar siguiente"), toolbar_find_replace);
btnFindBack->setShortcut(QKeySequence::FindNext);
connect(btnFindNext, SIGNAL(clicked()), this, SLOT(btnFindNext_clicked()));
gridLayout->addWidget(btnFindNext, 0, 3, 1, 1);
chkCaseSensitive = new QCheckBox(tr("Coincidir mayúsculas/minúsculas"), toolbar_find_replace);
chkCaseSensitive->setChecked(false);
connect(chkCaseSensitive, SIGNAL(toggled(bool)), this, SLOT(chkCaseSensitive_toggled(bool)));
gridLayout->addWidget(chkCaseSensitive, 0, 5, 1, 1);
QCheckBox *chkReplace = new QCheckBox(tr("Reemplazar por") +":", toolbar_find_replace);
chkReplace->setChecked(false);
connect(chkReplace, SIGNAL(toggled(bool)), this, SLOT(chkReplace_toggled(bool)));
gridLayout->addWidget(chkReplace, 1, 0, 1, 1);
txt_replace = new QLineEdit(toolbar_find_replace);
txt_replace->setEnabled(false);
txt_replace->setMinimumSize(QSize(0, 24));
gridLayout->addWidget(txt_replace, 1, 1, 1, 1);
btnReplace = createToolButton(QIcon(m_theme +"img16/edit_reemplazar.png"), tr("Reemplazar"), toolbar_find_replace);
btnReplace->setEnabled(false);
connect(btnReplace, SIGNAL(clicked()), this, SLOT(btnReplace_clicked()));
gridLayout->addWidget(btnReplace, 1, 2, 1, 1);
btnReplaceAndNext = createToolButton(QIcon(m_theme +"img16/edit_reemplazar.png"), tr("Reemplazar siguiente"), toolbar_find_replace);
btnReplaceAndNext->setEnabled(false);
connect(btnReplaceAndNext, SIGNAL(clicked()), this, SLOT(btnReplaceAndNext_clicked()));
gridLayout->addWidget(btnReplaceAndNext, 1, 3, 1, 1);
btnReplaceAll = createToolButton(QIcon(m_theme +"img16/edit_reemplazar.png"), tr("Reemplazar todo"), toolbar_find_replace);
btnReplaceAll->setEnabled(false);
connect(btnReplaceAll, SIGNAL(clicked()), this, SLOT(btnReplaceAll_clicked()));
gridLayout->addWidget(btnReplaceAll, 1, 4, 1, 1);
chkWholeWords = new QCheckBox(tr("Solo palabras completas"), toolbar_find_replace);
gridLayout->addWidget(chkWholeWords, 1, 5, 1, 1);
main_layout->addWidget(toolbar_find_replace);
#ifndef QT_NO_CLIPBOARD
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
#endif
showSource(m_initialPag == RichTextIndex ? false : true);
showFindReplace(false);
showSmiles(false);
setTabStopWidth(40);
fontChanged(editor_rich_text->font());
colorChanged(editor_rich_text->textColor());
alignmentChanged(editor_rich_text->alignment());
}
示例9: w
void importDialog::afterCreateGroup()
{
ui->stackedWidget->setCurrentIndex(ui->stackedWidget->currentIndex()+1);
ui->btnImportar->setEnabled(true);
MainWindow w(_empDir + "/Divisas.dbf");
QSqlQuery q(QSqlDatabase::database("dbfEditor"));
if(!q.exec("Select * from d_Divisas"))
{
QMessageBox::critical(this,"Error",q.lastError().text());
return;
}
q.first();
QSqlQueryModel * modelMoneda = new QSqlQueryModel(this);
modelMoneda->setQuery("SELECT * FROM monedas;",QSqlDatabase::database("grupo"));
QSqlQueryModel * modelPais = new QSqlQueryModel(this);
modelPais->setQuery("SELECT * FROM paises;",QSqlDatabase::database("grupo"));
QWidget* container = new QWidget(this);
QVBoxLayout * _layout = new QVBoxLayout(container);
do
{
QSqlRecord r = q.record();
QString codigo = r.value("CCODDIV").toString().trimmed();
QString desc = r.value("CDETDIV").toString().trimmed();
QComboBox * combo = new QComboBox(this);
combo->setModel(modelMoneda);
combo->setModelColumn(1);
QComboBox * combo2 = new QComboBox(this);
combo2->setModel(modelPais);
combo2->setModelColumn(1);
QLabel * label = new QLabel(desc,this);
QHBoxLayout * lay = new QHBoxLayout(this);
QCheckBox * check = new QCheckBox(this);
check->setChecked(true);
lay->addWidget(check);
lay->addWidget(label);
lay->addWidget(combo);
lay->addWidget(combo2);
_layout->addLayout(lay);
_combos.insert(combo,codigo);
_combosMonedaPais.insert(combo2,codigo);
_validDivisas.insert(combo,check);
combo->setCurrentIndex(0);
}while(q.next());
_layout->addSpacerItem(new QSpacerItem(1,1,QSizePolicy::Preferred,QSizePolicy::Expanding));
container->setLayout(_layout);
ui->scrollArea->setWidget(container);
w.openDb(_empDir + "/Ivas.dbf");
if(!q.exec("Select * from d_Ivas"))
{
QMessageBox::critical(this,"Error",q.lastError().text());
return;
}
q.first();
QSqlQueryModel * q2 = new QSqlQueryModel(this);
q2->setQuery("SELECT * FROM tiposiva;",QSqlDatabase::database("grupo"));
QWidget* container2 = new QWidget(this);
QVBoxLayout * _layout2 = new QVBoxLayout(container);
do
{
QSqlRecord r = q.record();
QString codigo = r.value("CTIPOIVA").toString().trimmed();
QString desc = r.value("CDETIVA").toString().trimmed();
QComboBox * combo = new QComboBox(this);
combo->setModel(q2);
combo->setModelColumn(2);
QLabel * label = new QLabel(desc,this);
QHBoxLayout * lay = new QHBoxLayout(this);
lay->addWidget(label);
lay->addWidget(combo);
_layout2->addLayout(lay);
_combos2.insert(combo,codigo);
combo->setCurrentIndex(0);
}while(q.next());
_layout2->addSpacerItem(new QSpacerItem(1,1,QSizePolicy::Preferred,QSizePolicy::Expanding));
container2->setLayout(_layout2);
ui->scrollIva->setWidget(container2);
w.openDb(ui->txtRutaBD->text() + "/dbf/Naciones.dbf");
if(!q.exec("Select * from d_Naciones"))
//.........这里部分代码省略.........
示例10: switch
void SettingWidget::createValueWidget()
{
rsArgument* argument = task->getArgument(option->name);
switch(option->type) {
case G_OPTION_ARG_FILENAME:
case G_OPTION_ARG_STRING:
case G_OPTION_ARG_STRING_ARRAY:
case G_OPTION_ARG_CALLBACK:
case G_OPTION_ARG_INT:
case G_OPTION_ARG_INT64:
case G_OPTION_ARG_DOUBLE:
{
// Display text box if number of values is not restricted
if ( option->allowedValues == NULL ) {
if ( option->nLines < 2 ) {
QLineEdit *w = new QLineEdit();
valueWidget = w;
w->setPlaceholderText(option->cli_arg_description);
connect(w, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
if ( argument != NULL ) {
w->setText(argument->value);
} else if ( option->defaultValue != NULL ) {
w->setText(option->defaultValue);
}
} else { // create a QTextEdit field instead
QPlainTextEdit *w = new QPlainTextEdit();
valueWidget = w;
connect(w, SIGNAL(textChanged()), this, SLOT(textChanged()));
if ( argument != NULL ) {
w->setPlainText(argument->value);
} else if ( option->defaultValue != NULL ) {
w->setPlainText(option->defaultValue);
}
QFontMetrics m(w->font()) ;
int rowHeight = m.lineSpacing() ;
w->setFixedHeight(option->nLines * rowHeight) ;
w->setLineWrapMode(QPlainTextEdit::NoWrap);
}
} else { // if the allowed values are restricted display radio buttons instead
QWidget *w = new QWidget();
QBoxLayout *wLayout = new QBoxLayout(QBoxLayout::TopToBottom);
QButtonGroup *buttonGroup = new QButtonGroup();
buttonGroup->setExclusive(true);
valueWidget = w;
connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(buttonClicked(int)));
// go through all options and add a radio button for them
rsUIOptionValue** values = option->allowedValues;
for (size_t i=0; values[i] != NULL; i++ ) {
// add radio button
QRadioButton *b = new QRadioButton(QString("'")+QString(values[i]->name)+QString("'"));
QFont f("Arial", 12, QFont::Bold);
b->setFont(f);
buttonGroup->addButton(b, (int)i);
wLayout->addWidget(b);
// set it to checked if it is the default or set value
b->setChecked(false);
if ( argument != NULL ) {
if ( ! strcmp(argument->value,values[i]->name) ) {
b->setChecked(true);
}
} else if ( ! strcmp(option->defaultValue,values[i]->name) ) {
b->setChecked(true);
}
// add its description
QLabel *label = new QLabel(values[i]->description);
label->setIndent(22);
label->setWordWrap(true);
label->setContentsMargins(0, 0, 0, 4);
QFont f2("Arial", 11, QFont::Normal);
label->setFont(f2);
wLayout->addWidget(label);
}
w->setLayout(wLayout);
}
}
break;
/*
case G_OPTION_ARG_INT:
case G_OPTION_ARG_INT64:
valueWidget = new QSpinBox();
break;
case G_OPTION_ARG_DOUBLE:
valueWidget = new QDoubleSpinBox();
break;
*/
case G_OPTION_ARG_NONE:
{
QCheckBox *w = new QCheckBox("Enabled"); // new SwitchWidget();
valueWidget = w;
connect(w, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
if ( argument != NULL ) {
w->setCheckState(Qt::Checked);
} else {
w->setCheckState(Qt::Unchecked);
}
}
//.........这里部分代码省略.........
示例11: QDialog
OptionDlg::OptionDlg(QWidget *parent)
: QDialog(parent)
{
readConfigure("etc/conf.xml");
readTargets("etc/targets.xml");
// 创建控件
tabWidget = new QTabWidget;
tabGeneral = new QWidget;
tabNetwork = new QWidget;
tabTargets = new QWidget;
tabWidget->addTab(tabGeneral, tr("General"));
tabWidget->addTab(tabNetwork, tr("Network"));
tabWidget->addTab(tabTargets, tr("Targets"));
// tab general
labelRecursiveLayer = new QLabel(tr("&Recursive layer:"));
spinBoxRecursiveLayer = new QSpinBox();
spinBoxRecursiveLayer->setValue(recursiveLayer);
labelRecursiveLayer->setBuddy(spinBoxRecursiveLayer);
labelMinFileSize = new QLabel(tr("&Minimum file size(Kb):"));
spinBoxMinFileSize = new QSpinBox();
spinBoxMinFileSize->setValue(minFileSize);
labelMinFileSize->setBuddy(spinBoxMinFileSize);
checkBoxSaveInSingleDir = new QCheckBox(tr("&Save targets in single directory"));
checkBoxSaveInSingleDir->setChecked(saveInSingleDir);
labelFileExistsAction = new QLabel(tr("&Do what when file exists:"));
comboBoxFileExistsAction = new QComboBox();
comboBoxFileExistsAction->addItem(tr("Overwrite"), feaOverwrite);
comboBoxFileExistsAction->addItem(tr("Ignore"), feaIgnore);
comboBoxFileExistsAction->setCurrentIndex(fileExistsAction);
labelFileExistsAction->setBuddy(comboBoxFileExistsAction);
gridLayoutGeneral = new QGridLayout();
gridLayoutGeneral->addWidget(labelRecursiveLayer, 0, 0, 1, 1);
gridLayoutGeneral->addWidget(spinBoxRecursiveLayer, 0, 1, 1, 1);
gridLayoutGeneral->addWidget(labelMinFileSize, 1, 0, 1, 1);
gridLayoutGeneral->addWidget(spinBoxMinFileSize, 1, 1, 1, 1);
gridLayoutGeneral->addWidget(checkBoxSaveInSingleDir, 2, 0, 1, 2);
gridLayoutGeneral->addWidget(labelFileExistsAction, 3, 0, 1, 1);
gridLayoutGeneral->addWidget(comboBoxFileExistsAction, 3, 1, 1, 1);
boxLayoutGeneral = new QVBoxLayout;
boxLayoutGeneral->addLayout(gridLayoutGeneral);
boxLayoutGeneral->addStretch();
tabGeneral->setLayout(boxLayoutGeneral);
// tab Network
checkBoxUseProxy = new QCheckBox(tr("&Enable proxy"));
checkBoxUseProxy->setChecked(useProxy);
connect(checkBoxUseProxy, SIGNAL(stateChanged(int)), this, SLOT(useProxyOrNot(int)));
labelHost = new QLabel(tr("&Host:"));
editHost = new QLineEdit();
editHost->setText(proxyHost);
labelHost->setBuddy(editHost);
labelPort = new QLabel(tr("&Port:"));
spinBoxPort = new QSpinBox();
spinBoxPort->setMaximum(65535);
spinBoxPort->setValue(proxyPort);
labelPort->setBuddy(spinBoxPort);
labelUsername = new QLabel(tr("&Username:"));
editUsername = new QLineEdit();
editUsername->setText(proxyUsername);
labelUsername->setBuddy(labelUsername);
labelPassword = new QLabel(tr("Pass&word:"));
editPassword = new QLineEdit();
editPassword->setText(proxyPassword);
editPassword->setEchoMode(QLineEdit::Password);
labelPassword->setBuddy(editPassword);
// 启用不启用代理
useProxyOrNot(checkBoxUseProxy->checkState());
gridLayoutNetwork = new QGridLayout();
gridLayoutNetwork->addWidget(checkBoxUseProxy, 0, 0, 1, 2);
gridLayoutNetwork->addWidget(labelHost, 1, 0, 1, 1);
gridLayoutNetwork->addWidget(editHost, 1, 1, 1, 1);
gridLayoutNetwork->addWidget(labelPort, 2, 0, 1, 1);
gridLayoutNetwork->addWidget(spinBoxPort, 2, 1, 1, 1);
gridLayoutNetwork->addWidget(labelUsername, 3, 0, 1, 1);
gridLayoutNetwork->addWidget(editUsername, 3, 1, 1, 1);
gridLayoutNetwork->addWidget(labelPassword, 4, 0, 1, 1);
gridLayoutNetwork->addWidget(editPassword, 4, 1, 1, 1);
boxLayoutNetwork = new QVBoxLayout;
boxLayoutNetwork->addLayout(gridLayoutNetwork);
boxLayoutNetwork->addStretch();
tabNetwork->setLayout(boxLayoutNetwork);
// tab targets
boxLayoutTargets = new QVBoxLayout;
//.........这里部分代码省略.........
示例12: clearButtonGroup
void ROMSelectionDialog::refreshROMInfos() {
QString controlROMFileName = synthProfile.controlROMFileName;
QString pcmROMFileName = synthProfile.pcmROMFileName;
clearButtonGroup(controlROMGroup);
clearButtonGroup(pcmROMGroup);
controlROMRow = -1;
pcmROMRow = -1;
QStringList fileFilter = ui->fileFilterCombo->itemData(ui->fileFilterCombo->currentIndex()).value<QStringList>();
QStringList dirEntries = synthProfile.romDir.entryList(fileFilter);
ui->romInfoTable->clearContents();
ui->romInfoTable->setRowCount(dirEntries.size());
int row = 0;
for (QStringListIterator it(dirEntries); it.hasNext();) {
QString fileName = it.next();
FileStream file;
if (!file.open((synthProfile.romDir.absolutePath() + QDir::separator() + fileName).toUtf8())) continue;
const ROMInfo *romInfoPtr = ROMInfo::getROMInfo(&file);
if (romInfoPtr == NULL) continue;
const ROMInfo &romInfo = *romInfoPtr;
QButtonGroup *romGroup;
QString romType;
switch (romInfo.type) {
case ROMInfo::PCM:
romType = QString("PCM");
romGroup = &pcmROMGroup;
if (pcmROMRow == -1) pcmROMRow = row;
break;
case ROMInfo::Control:
romType = QString("Control");
romGroup = &controlROMGroup;
if (controlROMRow == -1) controlROMRow = row;
break;
case ROMInfo::Reverb:
romType = QString("Reverb");
romGroup = NULL;
break;
default:
MT32Emu::ROMInfo::freeROMInfo(romInfoPtr);
continue;
}
if (fileName == controlROMFileName) {
controlROMRow = row;
} else if (fileName == pcmROMFileName) {
pcmROMRow = row;
}
int column = 0;
QCheckBox *checkBox = new QCheckBox();
if (romInfo.type != ROMInfo::Reverb) {
romGroup->addButton(checkBox);
romGroup->setId(checkBox, row);
} else checkBox->setDisabled(true);
ui->romInfoTable->setCellWidget(row, column++, checkBox);
if (controlROMRow == row || pcmROMRow == row) {
checkBox->setChecked(true);
}
QTableWidgetItem *item = new QTableWidgetItem(fileName);
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
ui->romInfoTable->setItem(row, column++, item);
item = new QTableWidgetItem(QString(romInfo.shortName));
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
ui->romInfoTable->setItem(row, column++, item);
item = new QTableWidgetItem(QString(romInfo.description));
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
ui->romInfoTable->setItem(row, column++, item);
item = new QTableWidgetItem(romType);
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
ui->romInfoTable->setItem(row, column++, item);
item = new QTableWidgetItem(QString(romInfo.sha1Digest));
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
ui->romInfoTable->setItem(row, column++, item);
MT32Emu::ROMInfo::freeROMInfo(romInfoPtr);
row++;
}
ui->romInfoTable->setRowCount(row);
ui->romInfoTable->resizeColumnsToContents();
}
示例13: KMainWindow
Window::Window(QWidget *parent)
: KMainWindow(parent)
{
QWidget* widget = new QWidget;
setCentralWidget(widget);
resize(500, 400);
m_actions
<< new QAction(KIcon("document-save"), i18n("Save"), this)
<< new QAction(i18n("Discard"), this)
;
QVBoxLayout* mainLayout = new QVBoxLayout(widget);
// KMessageWidget
m_messageWidget = new KMessageWidget(this);
m_messageWidget->hide();
mainLayout->addWidget(m_messageWidget);
// Message buttons
{
QGroupBox* groupBox = new QGroupBox();
groupBox->setTitle(i18n("Show/hide message widget"));
mainLayout->addWidget(groupBox);
QVBoxLayout* layout = new QVBoxLayout(groupBox);
createMessageButton(layout, i18n("Error"), SLOT(showErrorMessage()));
createMessageButton(layout, i18n("Warning"), SLOT(showWarningMessage()));
createMessageButton(layout, i18n("Information"), SLOT(showInformationMessage()));
createMessageButton(layout, i18n("Positive"), SLOT(showPositiveMessage()));
}
// Text
{
QGroupBox* groupBox = new QGroupBox();
groupBox->setTitle(i18n("Text"));
mainLayout->addWidget(groupBox);
QVBoxLayout* layout = new QVBoxLayout(groupBox);
m_edit = new KTextEdit;
m_edit->setClickMessage(i18n("Use default text"));
layout->addWidget(m_edit);
}
// Options
{
QGroupBox* groupBox = new QGroupBox();
groupBox->setTitle(i18n("Options"));
mainLayout->addWidget(groupBox);
QVBoxLayout* layout = new QVBoxLayout(groupBox);
QCheckBox* wordwrapCheckBox = new QCheckBox(i18n("Word wrap"));
layout->addWidget(wordwrapCheckBox);
connect(wordwrapCheckBox, SIGNAL(toggled(bool)), m_messageWidget, SLOT(setWordWrap(bool)));
QCheckBox* showActionsCheckBox = new QCheckBox(i18n("Show action buttons"));
layout->addWidget(showActionsCheckBox);
connect(showActionsCheckBox, SIGNAL(toggled(bool)), SLOT(showActions(bool)));
QCheckBox* showCloseButtonCheckBox = new QCheckBox(i18n("Show close button"));
showCloseButtonCheckBox->setChecked(true);
layout->addWidget(showCloseButtonCheckBox);
connect(showCloseButtonCheckBox, SIGNAL(toggled(bool)),m_messageWidget, SLOT(setCloseButtonVisible(bool)));
m_animatedShowCheckBox = new QCheckBox(i18n("Animated"));
m_animatedShowCheckBox->setChecked(true);
layout->addWidget(m_animatedShowCheckBox);
QLabel* iconLabel = new QLabel("Icon:");
layout->addWidget(iconLabel);
m_iconComboBox = new QComboBox;
iconLabel->setBuddy(m_iconComboBox);
QStringList names = QStringList() << QString() << "preferences-system-network" << "document-save" << "system-users";
Q_FOREACH(const QString &name, names) {
QIcon icon = QIcon::fromTheme(name);
m_iconComboBox->addItem(icon, name.isEmpty() ? "none" : name);
}
connect(m_iconComboBox, SIGNAL(activated(int)), SLOT(setIconFromComboBox(int)));
layout->addWidget(m_iconComboBox);
}
示例14: QDialog
ACLEditor::ACLEditor(int channelid, const MumbleProto::ACL &mea, QWidget *p) : QDialog(p) {
QLabel *l;
bAddChannelMode = false;
iChannel = channelid;
Channel *pChannel = Channel::get(iChannel);
if (pChannel == NULL) {
g.l->log(Log::Warning, tr("Failed: Invalid channel"));
QDialog::reject();
return;
}
msg = mea;
setupUi(this);
if (!g.s.bExpert) {
qtwTab->removeTab(2);
qtwTab->removeTab(1);
qsbChannelPosition->hide();
qlChannelPosition->hide();
}
qcbChannelTemporary->hide();
iId = mea.channel_id();
setWindowTitle(tr("Mumble - Edit %1").arg(Channel::get(iId)->qsName));
qleChannelName->setText(pChannel->qsName);
if (channelid == 0) qleChannelName->setEnabled(false);
rteChannelDescription->setText(pChannel->qsDesc);
qsbChannelPosition->setRange(INT_MIN, INT_MAX);
qsbChannelPosition->setValue(pChannel->iPosition);
QGridLayout *grid = new QGridLayout(qgbACLpermissions);
l=new QLabel(tr("Deny"), qgbACLpermissions);
grid->addWidget(l,0,1);
l=new QLabel(tr("Allow"), qgbACLpermissions);
grid->addWidget(l,0,2);
int idx=1;
for (int i=0;i< ((iId == 0) ? 30 : 16);++i) {
ChanACL::Perm perm = static_cast<ChanACL::Perm>(1 << i);
QString name = ChanACL::permName(perm);
if (! name.isEmpty()) {
QCheckBox *qcb;
l = new QLabel(name, qgbACLpermissions);
grid->addWidget(l,idx,0);
qcb=new QCheckBox(qgbACLpermissions);
qcb->setToolTip(tr("Deny %1").arg(name));
qcb->setWhatsThis(tr("This revokes the %1 privilege. If a privilege is both allowed and denied, it is denied.<br />%2").arg(name).arg(ChanACL::whatsThis(perm)));
connect(qcb, SIGNAL(clicked(bool)), this, SLOT(ACLPermissions_clicked()));
grid->addWidget(qcb,idx,1);
qlACLDeny << qcb;
qcb=new QCheckBox(qgbACLpermissions);
qcb->setToolTip(tr("Allow %1").arg(name));
qcb->setWhatsThis(tr("This grants the %1 privilege. If a privilege is both allowed and denied, it is denied.<br />%2").arg(name).arg(ChanACL::whatsThis(perm)));
connect(qcb, SIGNAL(clicked(bool)), this, SLOT(ACLPermissions_clicked()));
grid->addWidget(qcb,idx,2);
qlACLAllow << qcb;
qlPerms << perm;
++idx;
}
}
示例15: QCheckBox
QWidget *ServerDialog::createPackageTab() {
disable_lua_checkbox = new QCheckBox(tr("Disable Lua"));
disable_lua_checkbox->setChecked(Config.DisableLua);
disable_lua_checkbox->setToolTip(tr("The setting takes effect after reboot"));
extension_group = new QButtonGroup;
extension_group->setExclusive(false);
QStringList extensions = Sanguosha->getExtensions();
QSet<QString> ban_packages = Config.BanPackages.toSet();
QGroupBox *box1 = new QGroupBox(tr("General package"));
QGroupBox *box2 = new QGroupBox(tr("Card package"));
QGridLayout *layout1 = new QGridLayout;
QGridLayout *layout2 = new QGridLayout;
box1->setLayout(layout1);
box2->setLayout(layout2);
int i = 0, j = 0;
int row = 0, column = 0;
foreach (QString extension, extensions) {
const Package *package = Sanguosha->findChild<const Package *>(extension);
if (package == NULL)
continue;
bool forbid_package = Config.value("ForbidPackages").toStringList().contains(extension);
QCheckBox *checkbox = new QCheckBox;
checkbox->setObjectName(extension);
checkbox->setText(Sanguosha->translate(extension));
checkbox->setChecked(!ban_packages.contains(extension) && !forbid_package);
checkbox->setEnabled(!forbid_package);
extension_group->addButton(checkbox);
switch (package->getType()) {
case Package::GeneralPack: {
row = i / 5;
column = i % 5;
i++;
layout1->addWidget(checkbox, row, column + 1);
break;
}
case Package::CardPack: {
row = j / 5;
column = j % 5;
j++;
layout2->addWidget(checkbox, row, column + 1);
break;
}
default:
break;
}
}
QWidget *widget = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(disable_lua_checkbox);
layout->addWidget(box1);
layout->addWidget(box2);
widget->setLayout(layout);
return widget;
}