本文整理汇总了C++中QCheckBox::setTristate方法的典型用法代码示例。如果您正苦于以下问题:C++ QCheckBox::setTristate方法的具体用法?C++ QCheckBox::setTristate怎么用?C++ QCheckBox::setTristate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCheckBox
的用法示例。
在下文中一共展示了QCheckBox::setTristate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QGroupBox
//! [7]
QGroupBox *Window::createNonExclusiveGroup()
{
QGroupBox *groupBox = new QGroupBox(tr("Non-Exclusive Checkboxes"));
groupBox->setFlat(true);
//! [7]
//! [8]
QCheckBox *checkBox1 = new QCheckBox(tr("&Checkbox 1"));
QCheckBox *checkBox2 = new QCheckBox(tr("C&heckbox 2"));
checkBox2->setChecked(true);
QCheckBox *tristateBox = new QCheckBox(tr("Tri-&state button"));
tristateBox->setTristate(true);
//! [8]
tristateBox->setCheckState(Qt::PartiallyChecked);
//! [9]
QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(checkBox1);
vbox->addWidget(checkBox2);
vbox->addWidget(tristateBox);
vbox->addStretch(1);
groupBox->setLayout(vbox);
return groupBox;
}
示例2: parseGenrePanel
void BrowseWidget::parseGenrePanel(const QString &id, QNetworkReply *reply) {
Q_UNUSED(id);
auto api = API::sharedAPI()->sharedAniListAPI();
auto request_url = reply->request().url().toDisplayString();
if (request_url.startsWith(api->API_GENRES.toDisplayString())) {
auto data = reply->readAll();
auto array = QJsonDocument::fromJson(data).array();
auto width = 0;
auto metric = this->fontMetrics();
for (auto value : array) {
auto object = value.toObject();
QCheckBox *chk = new QCheckBox(this);
chk->setText(object.value("genre").toString());
chk->setTristate();
width = qMax(width, metric.width(chk->text()));
m_ui->genre_list->addWidget(chk);
}
m_ui->genre_area->setMinimumWidth(width * 2);
}
}
示例3: drv_checkbox
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;
}
示例4: createEditor
QWidget* DSiNo::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QCheckBox *editor = new QCheckBox( parent );
editor->setText( index.model()->headerData( index.column(), Qt::Horizontal ).toString() );
editor->setTristate( false );
editor->setPalette( option.palette );
editor->setFont( option.font );
editor->setBackgroundRole( QPalette::Background );
return editor;
}
示例5: OnAlignCheckBoxStateChanged
void AlignsPropertyGridWidget::OnAlignCheckBoxStateChanged(int state)
{
if (activeMetadata == NULL)
{
// No control already assinged.
return;
}
QCheckBox* senderWidget = dynamic_cast<QCheckBox*>(QObject::sender());
if (senderWidget == NULL)
{
Logger::Error("OnCheckBoxStateChanged - sender is NULL!");
return;
}
// After the first change don't allow the checkbox to be tristate.
senderWidget->setTristate(false);
PROPERTYGRIDWIDGETSITER iter = propertyGridWidgetsMap.find(senderWidget);
if (iter == propertyGridWidgetsMap.end())
{
Logger::Error("OnCheckBoxStateChanged - unable to find attached property in the propertyGridWidgetsMap!");
return;
}
// Don't update the property if the text wasn't actually changed.
bool isPropertyValueDiffers = false;
bool curValue = PropertiesHelper::GetAllPropertyValues<bool>(this->activeMetadata, iter->second.getProperty().name(),
isPropertyValueDiffers);
// In case we have differences in property values for different widgets - force update the states too.
bool newValue = (state == Qt::Checked);
if ((curValue == newValue) && !isPropertyValueDiffers)
{
return;
}
BaseCommand* command = new ChangeAlignPropertyCommand(activeMetadata, iter->second, newValue);
CommandsController::Instance()->ExecuteCommand(command);
SafeRelease(command);
}
示例6: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget wgt;
QCheckBox* pchkNormal = new QCheckBox("&Normal Check Box");
pchkNormal->setChecked(true);
QCheckBox* pchkTristate = new QCheckBox("&Tristate Check Box");
pchkTristate->setTristate(true);
pchkTristate->setCheckState(Qt::PartiallyChecked);
QVBoxLayout* pvbxLayout = new QVBoxLayout;
pvbxLayout->addWidget(pchkNormal);
pvbxLayout->addWidget(pchkTristate);
wgt.setLayout(pvbxLayout);
wgt.show();
return a.exec();
}
示例7: styleFile
//.........这里部分代码省略.........
connect(ui->actionEAR, SIGNAL(triggered(bool)),
SLOT(toggleAnimeRecognition(bool)));
connect(ui->actionExport, SIGNAL(triggered()), SLOT(exportListJSON()));
connect(ui->actionUpdate, SIGNAL(triggered()), FvUpdater::sharedUpdater(),
SLOT(CheckForUpdatesNotSilent()));
connect(window_watcher, SIGNAL(title_found(QString)), SLOT(watch(QString)));
connect(watch_timer, SIGNAL(timeout()), SLOT(updateEpisode()));
connect(event_timer, SIGNAL(timeout()), SLOT(eventTick()));
connect(ui->torrentTable, SIGNAL(customContextMenuRequested(QPoint)),
SLOT(torrentContextMenu(QPoint)));
connect(ui->torrentFilter, SIGNAL(textChanged(QString)),
SLOT(filterTorrents(QString)));
connect(ui->chkHideUnknown, SIGNAL(toggled(bool)),
SLOT(filterTorrents(bool)));
connect(ui->refreshButton, SIGNAL(clicked()), SLOT(refreshTorrentListing()));
connect(ui->actionEAR, SIGNAL(toggled(bool)), SLOT(applyEAR()));
connect(ui->tabWidget, &QTabWidget::currentChanged, [&, this]( // NOLINT
int tab) {
if (tab != 0) {
this->over->removeDrawing("blank_table");
this->over->removeDrawing("no anime");
ui->listTabs->show();
ui->listFilterLineEdit->show();
} else {
this->filterList(3);
if (hasUser && (User::sharedUser()->getAnimeList().count() == 0)) {
this->addNoAnimePrompt();
}
}
});
ui->actionEAR->setChecked(
settings->getValue(Settings::AnimeRecognitionEnabled, D_ANIME_RECOGNITION)
.toBool());
this->toggleAnimeRecognition(ui->actionEAR->isChecked());
QString genrelist =
"Action, Adult, Adventure, Cars, Comedy, Dementia, Demons, Doujinshi, "
"Drama, Ecchi, Fantasy, Game, Gender Bender, Harem, Hentai, Historical, "
"Horror, Josei, Kids, Magic, Martial Arts, Mature, Mecha, Military, "
"Motion Comic, Music, Mystery, Mythological , Parody, Police, "
"Psychological, Romance, Samurai, School, Sci-Fi, Seinen, Shoujo, Shoujo "
"Ai, Shounen, Shounen Ai, Slice of Life, Space, Sports, Super Power, "
"Supernatural, Thriller, Tragedy, Vampire, Yaoi, Yuri";
QStringList genres = genrelist.split(", ");
for (QString genre : genres) {
QCheckBox *chk = new QCheckBox();
chk->setText(genre);
chk->setTristate(true);
ui->genreList->addWidget(chk);
}
connect(ui->listFilterLineEdit, SIGNAL(textChanged(QString)),
SLOT(filterList(QString)));
connect(ui->listFilterLineEdit, SIGNAL(returnPressed()), SLOT(showSearch()));
connect(ui->listTabs, SIGNAL(currentChanged(int)), SLOT(filterList(int)));
connect(ui->browseButton, SIGNAL(clicked()), SLOT(loadBrowserData()));
this->show();
createActions();
initTray();
trayIcon->show();
int result = API::sharedAPI()->verifyAPI();
if (result == AniListAPI::OK) {
connect(API::sharedAPI()->sharedAniListAPI(), &AniListAPI::access_granted,
[&, this]() { // NOLINT
progress_bar->setValue(10);
progress_bar->setFormat("Access granted");
loadUser();
event_timer->start(1000);
});
connect(API::sharedAPI()->sharedAniListAPI(), &AniListAPI::access_denied,
[&, this](QString error) { // NOLINT
qCritical() << error;
if (isVisible()) {
QMessageBox::critical(this, "Shinjiru", tr("Error: ") + error);
}
});
} else if (result == AniListAPI::NO_CONNECTION) {
qDebug() << "Starting Shinjiru in offline mode";
hasUser = User::sharedUser()->loadLocal();
}
reloadRules();
}