コード例 #1
0
Legend ExportImageDialog::getLegendForSettings()
{
    Legend legend;

    // set font for legend labels
    legend.setFont(QFont("Courier New", 8));

    // set background color
    QColor bgColor = legend.getBgColor();
    bgColor.setAlpha(160);
    legend.setBgColor(bgColor);

    // set legend orientation
    if(m_DialogUI->legendOrientationComboBox->currentIndex() == 1) // orientation: vertical
    {
        legend.setOrientation(Legend::LO_VERTICAL);
    }

    // set legend type
    Legend::LEGEND_TYPE type = static_cast<Legend::LEGEND_TYPE>(m_DialogUI->legendTypeComboBox->currentIndex());
    legend.setType(type);

    // set legend position
    Legend::LEGEND_POSITION pos = static_cast<Legend::LEGEND_POSITION>(m_DialogUI->legendPositionComboBox->currentIndex());
    legend.setPosition(pos);

    return legend;
}