当前位置: 首页>>代码示例>>C++>>正文


C++ QTextBrowser::setPalette方法代码示例

本文整理汇总了C++中QTextBrowser::setPalette方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextBrowser::setPalette方法的具体用法?C++ QTextBrowser::setPalette怎么用?C++ QTextBrowser::setPalette使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTextBrowser的用法示例。


在下文中一共展示了QTextBrowser::setPalette方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QWidget

InfoTab::InfoTab(QWidget *parent)
    : QWidget(parent)
{
    QTextBrowser *info = new QTextBrowser;
    info->setOpenExternalLinks(true);
    info->setFrameShape(QFrame::NoFrame);
    info->setFrameShadow(QFrame::Plain);

    info->setText(
        "<b>QIpMsg</b> &copy; 2007-2010 Yichi Zhang &lt;[email protected]&gt;<br><br>"
        "<b>" + tr("Version: %1").arg(VERSION) + "</b>" +
        "<br>" +
        tr("Compiled with Qt %1").arg(QT_VERSION_STR) + "<br><br>" +
        tr("Visit our web for updates:") + "<br>" +
        link("http://code.google.com/p/qipmsg") +
        "<br><br>" +
        tr("Join qipmsg group to report a bug or request new features:")
        + "<br>" +
        link("http://groups.google.com/group/qipmsg") +
        "<br><br>"
    );

    QPalette p = info->palette();
    p.setColor(QPalette::Base, palette().color(QPalette::Window));
    info->setPalette(p);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(info);

    setLayout(mainLayout);
}
开发者ID:louislevin12,项目名称:qipmsg,代码行数:31,代码来源:about_dialog.cpp

示例2: QDialog

/*!
    Constructs a new about box on top of given \a parent window.
*/
AboutBox::AboutBox(QWidget * parent) : QDialog(parent)
{
    setWindowTitle("About MaxCalc");

    tstring labelText = _T("MaxCalc v");
    labelText += Constants::VERSION;
    labelText += _T(" (");
    labelText += _T("built: ");
    tstring date = stringToWideString(__DATE__);
    labelText += date;
    labelText += _T(")<br>");
    labelText += Constants::COPYRIGHT;
    labelText += _T("<br><a href='");
    labelText += Constants::WEBSITE;
    labelText += _T("'>");
    labelText += Constants::WEBSITE;
    labelText += _T("</a>");

    QTextBrowser * label = new QTextBrowser;
    label->setHtml(QString::fromWCharArray(labelText.c_str()));
    label->setOpenExternalLinks(true);
    label->setFrameStyle(QFrame::NoFrame);
    QPalette p;
    p.setColor(QPalette::Base, p.color(QPalette::Background));
    label->setPalette(p);
    label->setLineWrapMode(QTextEdit::NoWrap);
    label->document()->adjustSize();
    label->setMinimumSize(label->document()->size().toSize());
    label->setMaximumSize(label->document()->size().toSize());

    QPushButton * closeButton = new QPushButton;
    closeButton->setText(tr("&Close"));

    QGridLayout * layout = new QGridLayout;
    layout->addWidget(label, 1, 0, 1, -1);
    layout->addItem(new QSpacerItem(20, 10, QSizePolicy::Minimum,
        QSizePolicy::Fixed), 2, 1, 1, 1);
    layout->addItem(new QSpacerItem(20, 20,
        QSizePolicy::Expanding), 3, 0, 1, 1);
    layout->addWidget(closeButton, 3, 1, 1, 1);
    layout->addItem(new QSpacerItem(20, 20,
        QSizePolicy::Expanding), 3, 2, 1, 1);    

    setLayout(layout);

    setMaximumSize(sizeHint());
    setMinimumSize(sizeHint());

    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
}
开发者ID:Mishamax,项目名称:maxcalc,代码行数:53,代码来源:aboutbox.cpp


注:本文中的QTextBrowser::setPalette方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。