本文整理汇总了C++中KnobGuiPtr::isLabelVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ KnobGuiPtr::isLabelVisible方法的具体用法?C++ KnobGuiPtr::isLabelVisible怎么用?C++ KnobGuiPtr::isLabelVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KnobGuiPtr
的用法示例。
在下文中一共展示了KnobGuiPtr::isLabelVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KnobGuiPtr
//.........这里部分代码省略.........
QHBoxLayout* fieldLayout = 0;
if (makeNewLine) {
///if new line is not turned off, create a new line
fieldContainer = new QWidget(page->second.tab);
fieldLayout = new QHBoxLayout(fieldContainer);
fieldLayout->setContentsMargins( TO_DPIX(3), 0, 0, TO_DPIY(NATRON_SETTINGS_VERTICAL_SPACING_PIXELS) );
fieldLayout->setSpacing( TO_DPIY(2) );
fieldLayout->setAlignment(Qt::AlignLeft);
} else {
///otherwise re-use the last row's widget and layout
assert(lastRowWidget);
fieldContainer = lastRowWidget;
fieldLayout = dynamic_cast<QHBoxLayout*>( fieldContainer->layout() );
}
assert(fieldContainer);
assert(fieldLayout);
///Create the label if needed
KnobClickableLabel* label = 0;
Label* warningLabel = 0;
std::string descriptionLabel;
KnobString* isStringKnob = dynamic_cast<KnobString*>( knob.get() );
bool isLabelKnob = isStringKnob && isStringKnob->isLabel();
if (isLabelKnob) {
descriptionLabel = isStringKnob->getValue();
} else {
descriptionLabel = knob->getLabel();
}
const std::string& labelIconFilePath = knob->getIconLabel();
QWidget *labelContainer = 0;
QHBoxLayout *labelLayout = 0;
const bool hasLabel = ret->isLabelVisible() || isLabelKnob;
if (hasLabel) {
if (makeNewLine) {
labelContainer = new QWidget(page->second.tab);
labelLayout = new QHBoxLayout(labelContainer);
labelLayout->setContentsMargins( TO_DPIX(3), 0, 0, TO_DPIY(NATRON_SETTINGS_VERTICAL_SPACING_PIXELS) );
labelLayout->setSpacing( TO_DPIY(2) );
}
label = new KnobClickableLabel(QString(), ret, page->second.tab);
warningLabel = new Label(page->second.tab);
warningLabel->setVisible(false);
QFontMetrics fm(label->font(), 0);
int pixSize = fm.height();
QPixmap stdErrorPix;
stdErrorPix = getStandardIcon(QMessageBox::Critical, pixSize, label);
warningLabel->setPixmap(stdErrorPix);
bool pixmapSet = false;
if ( !labelIconFilePath.empty() ) {
QPixmap pix;
if (labelIconFilePath == "dialog-warning") {
pix = getStandardIcon(QMessageBox::Warning, pixSize, label);
} else if (labelIconFilePath == "dialog-question") {
pix = getStandardIcon(QMessageBox::Question, pixSize, label);
} else if (labelIconFilePath == "dialog-error") {
pix = stdErrorPix;
} else if (labelIconFilePath == "dialog-information") {
pix = getStandardIcon(QMessageBox::Information, pixSize, label);
} else {
pix.load( QString::fromUtf8( labelIconFilePath.c_str() ) );
if (pix.width() != pixSize) {