コード例 #1
0
ファイル: Style.cpp プロジェクト: mailru/icqdesktop
        QBrush getPreloaderBrush()
        {
            QLinearGradient grad(0, 0, 0.5, 0);
            grad.setCoordinateMode(QGradient::StretchToDeviceMode);
            grad.setSpread(QGradient::ReflectSpread);

            QColor colorEdge(ql1s("#000000"));
            colorEdge.setAlphaF(0.07);
            grad.setColorAt(0, colorEdge);

            QColor colorCenter(ql1s("#000000"));
            colorCenter.setAlphaF(0.12);
            grad.setColorAt(0.5, colorCenter);

            grad.setColorAt(1, colorEdge);

            QBrush result(grad);
            result.setColor(Qt::transparent);

            return result;
        }
コード例 #2
0
ファイル: bfs.cpp プロジェクト: aleksandra290709/sipurina
void BFS::initializeAnimation(){
    setMenu(false);
    int r=255, g=255, b=0;
    int color_step= 25;
    m_operations.push_back([=,this](){ getNode(_currentNode)->setColor(QColor(r, g, b));colorNode(_currentNode); });
    r-=color_step;
    g-=color_step;
    QQueue<int> queue;
    queue.append(_currentNode);
    getNode(_currentNode)->setVisited(true);
    while(!queue.empty()){
        int curr = queue.at(0);
        queue.pop_front();
        NodeList list = getNeighbours(curr);
        for (auto iter : list){
            if(!getNode(iter)->visited()){
                getNode(iter)->setVisited(true);
                m_operations.push_back([=,this](){getEdge(curr, iter)->setColor(QColor(r,g,b)); colorEdge(curr, iter); emit highlightLine(10);});
            m_operations.push_back([=,this](){getNode(iter)->setColor(QColor(r,g,b)); colorNode(iter);});
                queue.append(iter);
            }
        }
        r-=color_step;
        g-=color_step;
    }

    m_animationInitialized= true;
    m_currentStepInAnimation= 0;
    m_numberOfStepsInAnimation= m_operations.size();
}