コード例 #1
0
void XYChartBackgroundPainter::updateLinePolygons()
{
    m_linePolygons.clear();

    Dimension* xAxis = m_xyChartCore->xAxis();
    QList<Dimension*> dimensions = m_xyChartCore->dimensionsList();
    QAbstractTableModel* model = m_xyChartCore->model();

    const int xAxisColumn = xAxis->dataColumn();

    foreach(Dimension* dimension, dimensions)
    {
        const int column = dimension->dataColumn();
        QPolygonF line;
        for (int row = 0; row < model->rowCount(); row++)
        {
            const qreal key = model->data(model->index(row, xAxisColumn)).toReal();
            const qreal value = model->data(model->index(row, column)).toReal();
            // Skip "NULL" values
            if (qIsNaN(value))
                continue;

            line << m_xyChartCore->translatePoint(QPointF(key, value));
        }

        m_linePolygons << line;
    }

    emit linePolygonsUpdated();
}
コード例 #2
0
void UUpdateWidget::slot_downloadFileFinished()
{
    m_toolBarActions.at(eINSTALL_UPDATES_ACTION)->setEnabled(false);

    m_currentDownloadFile++;

    QAbstractTableModel *model = (UUpdatesModel *)m_updatesTableView->model();

    if (m_currentDownloadFile == model->rowCount()) {
        Q_EMIT signal_downloadUpdatesFinished();

        return;
    }

    m_downloader->set_progressBar(m_progressBarList.at(m_currentDownloadFile));

    QModelIndex index = model->index(m_currentDownloadFile, UUpdatesModel::ePACKAGE);

    QString packageName = model->data(index, Qt::DisplayRole).toString();
    if (packageName.contains('/') == true) {
        int indx = packageName.indexOf('/');
        m_downloader->setDir(packageName.remove(indx, packageName.size() - indx));
    } else {
        m_downloader->setDir("");
    }

    index = model->index(m_currentDownloadFile, UUpdatesModel::ePACKAGE);

    createFolders(index.data().toString());

    index = model->index(m_currentDownloadFile, UUpdatesModel::eURI);
    m_downloader->slot_downloadFile(model->data(index, Qt::DisplayRole).toUrl());
}