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


C++ Painter::foreground方法代码示例

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


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

示例1: fromXML

Painter Painter::fromXML(const QDomElement& e, QString filename)
{
    Painter FP;

    if (e.hasAttribute("zoomUnder") || e.hasAttribute("zoomUpper"))
        FP.zoomBoundary(e.attribute("zoomUnder","0").toDouble(),e.attribute("zoomUpper","10e6").toDouble());
    if (e.hasAttribute("foregroundColor"))
    {
        FP.foreground(
            toColor(e.attribute("foregroundColor")),e.attribute("foregroundScale").toDouble(),e.attribute("foregroundOffset").toDouble());
        if (e.hasAttribute("foregroundDashDown"))
            FP.foregroundDash(e.attribute("foregroundDashDown").toDouble(),e.attribute("foregroundDashUp").toDouble());
    }
    if (e.hasAttribute("fillWithIcon"))
        FP.foregroundUseIcon(e.attribute("fillWithIcon") == "yes");
    if (e.hasAttribute("backgroundColor"))
        FP.background(
            toColor(e.attribute("backgroundColor")),e.attribute("backgroundScale").toDouble(),e.attribute("backgroundOffset").toDouble());
    if (e.attribute("interior") == "yes")
        FP.BackgroundInterior = true;
    if (e.attribute("exterior") == "yes")
        FP.BackgroundExterior = true;
    if (e.hasAttribute("touchupColor"))
    {
        FP.touchup(
            toColor(e.attribute("touchupColor")),e.attribute("touchupScale").toDouble(),e.attribute("touchupOffset").toDouble());
        if (e.hasAttribute("touchupDashDown"))
            FP.touchupDash(e.attribute("touchupDashDown").toDouble(),e.attribute("touchupDashUp").toDouble());
    }
    if (e.hasAttribute("fillColor"))
        FP.foregroundFill(toColor(e.attribute("fillColor")));
    if (e.hasAttribute("icon"))
    {
        QString iconFilename = e.attribute("icon");
        if (!QFileInfo(iconFilename).isAbsolute())
            iconFilename = QFileInfo(filename).absolutePath().append("/").append(iconFilename);
        FP.setIcon(iconFilename,e.attribute("iconScale", "0.0").toDouble(),e.attribute("iconOffset", "0.0").toDouble());
    }
    if (e.attribute("drawTrafficDirectionMarks") == "yes")
        FP.drawTrafficDirectionMarks(true);
    if (e.hasAttribute("trafficDirectionMarksColor"))
        FP.TrafficDirectionMarksColor = toColor((e.attribute("trafficDirectionMarksColor")));
    if (e.hasAttribute("labelColor"))
    {
        FP.label(
            toColor(e.attribute("labelColor")),e.attribute("labelScale").toDouble(),e.attribute("labelOffset").toDouble());
        FP.setLabelFont(e.attribute("labelFont"));
        FP.labelTag(e.attribute("labelTag"));
        if (e.hasAttribute("labelHalo"))
            FP.labelHalo((e.attribute("labelHalo") == "yes"));
        if (e.hasAttribute("labelArea"))
            FP.labelArea((e.attribute("labelArea") == "yes"));
        if (e.hasAttribute("labelBackgroundColor"))
            FP.labelBackground(toColor(e.attribute("labelBackgroundColor")));
        if (e.hasAttribute("labelBackgroundTag"))
            FP.labelBackgroundTag(e.attribute("labelBackgroundTag"));
    }

    QDomNode n = e.firstChild();
    QList<QPair<QString,QString> > Pairs;
    while (!n.isNull())
    {
        if (n.isElement())
        {
            QDomElement t = n.toElement();
            if (t.tagName() == "selector")
            {
                if (!t.attribute("key").isEmpty())
                    Pairs.push_back(qMakePair(t.attribute("key"),t.attribute("value")));
                else
                {
                    FP.setSelector(t.attribute("expr"));
                    return FP;
                }
            }
        }
        n = n.nextSibling();
    }
    if (Pairs.size() == 1)
        FP.setSelector(Pairs[0].first+"="+Pairs[0].second);
    else if (Pairs.size())
    {
        bool Same = true;
        for (int i=1; i<Pairs.size(); ++i)
            if (Pairs[0].first != Pairs[i].first)
                Same = false;
        if (Same)
        {
            QStringList Options;
            for (int i=0; i<Pairs.size(); ++i)
                Options.push_back(Pairs[i].second);
            FP.setSelector("["+ Pairs[0].first +"] isoneof ("+ Options.join(",") + ")");
        }
        else
        {
            QStringList Options;
            for (int i=0; i<Pairs.size(); ++i)
                Options.push_back(Pairs[i].first+"="+Pairs[i].second);
            FP.setSelector(Options.join(" or "));
        }
//.........这里部分代码省略.........
开发者ID:chxyfish,项目名称:merkaartor,代码行数:101,代码来源:Painter.cpp


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