本文整理汇总了C++中ToolButton::isChecked方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolButton::isChecked方法的具体用法?C++ ToolButton::isChecked怎么用?C++ ToolButton::isChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolButton
的用法示例。
在下文中一共展示了ToolButton::isChecked方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initRectLabel
void SubToolBar::initRectLabel() {
m_rectLabel = new QLabel(this);
QButtonGroup* rectBtnGroup = new QButtonGroup();
rectBtnGroup->setExclusive(true);
QList<ToolButton*> btnList;
//rectangle, oval...
ToolButton* fineLine = new ToolButton();
fineLine->setObjectName("FineLine");
rectBtnGroup->addButton(fineLine);
btnList.append(fineLine);
ToolButton* mediumLine = new ToolButton();
mediumLine->setObjectName("MediumLine");
rectBtnGroup->addButton(mediumLine);
btnList.append(mediumLine);
ToolButton* thickLine = new ToolButton();
thickLine->setObjectName("ThickLine");
rectBtnGroup->addButton(thickLine);
btnList.append(thickLine);
//separator line...
QLabel* vSeparatorLine = new QLabel();
vSeparatorLine->setFixedSize(1, 16);
vSeparatorLine->setObjectName("VerticalSeparatorLine");
//blur, mosaic...
ToolButton* blurBtn = new ToolButton();
blurBtn->setObjectName("BlurBtn");
ToolButton* mosaicBtn = new ToolButton();
mosaicBtn->setObjectName("MosaicBtn");
connect(blurBtn, &ToolButton::clicked, this, [=]{
ConfigSettings::instance()->setValue("effect", "is_blur", blurBtn->isChecked());
if (blurBtn->isChecked()) {
mosaicBtn->setChecked(false);
ConfigSettings::instance()->setValue("effect", "is_mosaic", false);
}
});
connect(mosaicBtn, &ToolButton::clicked, this, [=]{
ConfigSettings::instance()->setValue("effect", "is_mosaic", mosaicBtn->isChecked());
if (mosaicBtn->isChecked()) {
blurBtn->setChecked(false);
ConfigSettings::instance()->setValue("effect", "is_blur", false);
}
});
int lineWidthIndex = ConfigSettings::instance()->value("rectangle",
"linewidth_index").toInt();
btnList[lineWidthIndex]->setChecked(true);
QHBoxLayout* rectLayout = new QHBoxLayout();
rectLayout->setMargin(0);
rectLayout->setSpacing(0);
rectLayout->addSpacing(1);
for (int i = 0; i < btnList.length(); i++) {
rectLayout->addWidget(btnList[i]);
rectLayout->addSpacing(BUTTON_SPACING);
connect(btnList[i], &ToolButton::clicked, this, [=]{
ConfigSettings::instance()->setValue(m_currentType, "linewidth_index", i);
});
}
rectLayout->addSpacing(16);
rectLayout->addWidget(vSeparatorLine);
rectLayout->addSpacing(16);
rectLayout->addWidget(blurBtn);
rectLayout->addSpacing(BUTTON_SPACING);
rectLayout->addWidget(mosaicBtn);
rectLayout->addStretch();
m_rectLabel->setLayout(rectLayout);
addWidget(m_rectLabel);
connect(this, &SubToolBar::shapeChanged, this, [=]{
int lineIndex = ConfigSettings::instance()->value(m_currentType,
"linewidth_index").toInt();
btnList[lineIndex]->setChecked(true);
});
}