本文整理汇总了C++中QTextBrowser::setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextBrowser::setStyleSheet方法的具体用法?C++ QTextBrowser::setStyleSheet怎么用?C++ QTextBrowser::setStyleSheet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser::setStyleSheet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shaderMenuCallback
void OpenGLQtMenu::shaderMenuCallback(QObject* obj) {
QSize id = qobject_cast<QAction*>(obj)->data().toSize();
int shaderId = id.width();
int type = id.height();
const std::vector<Shader*> shaders{ShaderManager::getPtr()->getShaders()};
auto it = std::find_if(shaders.begin(), shaders.end(), [shaderId](Shader* shader) -> bool {
return static_cast<int>(shader->getID()) == shaderId;
});
if (it != shaders.end()) {
ShaderObject* shaderObj;
switch (type) {
case 1:
shaderObj = (*it)->getVertexShaderObject();
break;
case 2:
shaderObj = (*it)->getGeometryShaderObject();
break;
case 3:
shaderObj = (*it)->getFragmentShaderObject();
break;
default:
return;
}
QMainWindow* win =
static_cast<InviwoApplicationQt*>(InviwoApplication::getPtr())->getMainWindow();
QTextBrowser* shadercode = new QTextBrowser(nullptr);
shadercode->setText(shaderObj->print(true).c_str());
shadercode->setStyleSheet("font: 12pt \"Courier\";");
QDialog* dialog = new QDialog(win);
QGridLayout* layout = new QGridLayout(dialog);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->addWidget(shadercode);
dialog->setLayout(layout);
dialog->resize(600, 800);
dialog->exec();
delete dialog;
}
}
示例2: QDialog
AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(tr("Bluecherry Client - About"));
setFixedSize(500, 400);
setModal(true);
QGridLayout *layout = new QGridLayout(this);
QLabel *logo = new QLabel;
logo->setPixmap(QPixmap(QLatin1String(":/images/logo.png"))
.scaled(130, 130, Qt::KeepAspectRatio, Qt::SmoothTransformation));
logo->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
layout->addWidget(logo, 0, 0);
QLabel *text = new QLabel;
text->setText(tr("Bluecherry DVR Client<br>Version %1").arg(QApplication::applicationVersion()));
text->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
QFont font = text->font();
font.setPixelSize(15);
text->setFont(font);
layout->addWidget(text, 0, 1);
layout->setColumnStretch(1, 1);
QTextBrowser *license = new QTextBrowser;
license->setHtml(getLicenseText());
license->setStyleSheet(QLatin1String("font-size: 12px"));
license->setReadOnly(true);
license->setOpenExternalLinks(true);
license->setTabChangesFocus(true);
layout->addWidget(license, 1, 0, 1, 2);
font = QFont();
font.setStyleHint(QFont::SansSerif);
font.setPixelSize(13);
license->setFont(font);
}