コード例 #1
0
ファイル: led.cpp プロジェクト: foucar/CASS
void LED::setDiameter(double diameter)
{
  diameter_ = diameter;

  pixX_ = round(double(height())/heightMM());
  pixY_ = round(double(width())/widthMM());

  diamX_ = diameter_*pixX_;
  diamY_ = diameter_*pixY_;

  update();
}
コード例 #2
0
ファイル: screenruler.cpp プロジェクト: thisTerry/ScreenRuler
void ScreenRuler::UpdateDisplayPixelsPerCM()
{
    qreal horDotsPerCM = 44;
    qreal verDotsPerCM = 44;

#ifdef Q_OS_WIN
    EDIDReader reader;
    QString strManufacture = reader.GetManufactureName();
    horDotsPerCM = 10.0 * reader.GetScreenWidth() / reader.GetScreenWidthMM();
    verDotsPerCM = 10.0 * reader.GetScreenHeight() / reader.GetScreenHeightMM();

    if (reader.GetScreenWidthMM() == 0 || reader.GetScreenHeightMM() == 0)
    {
        QMessageBox msgBox(QMessageBox::Warning, 
            "Display Information", 
            "Read display information failed",
            QMessageBox::Ok, 
            this);
        msgBox.exec();
    }
    else
    {
        m_horDotsPerCM = horDotsPerCM;
        m_verDotsPerCM = verDotsPerCM;

        m_rulerDescription = QString("Manufacture: %1, Size: %2mm * %3mm, Resolution: %4 * %5.")
            .arg(reader.GetManufactureName())
            .arg(reader.GetScreenWidthMM())
            .arg(reader.GetScreenHeightMM())
            .arg(reader.GetScreenWidth())
            .arg(reader.GetScreenHeight());

        QString msgBoxTitle = tr("Display Information");
        QString msgBoxText;

        if (reader.HasMultiScreen())
        {
            msgBoxText = QString("This computer has multi-screen. For 1mV ECG wave draw 1cm.\n Please use this display:\n\n\tManufacture: %1\n\tSceen size: %2mm * %3mm\n\tResolution: %4 * %5")
                .arg(strManufacture)
                .arg(reader.GetScreenWidthMM())
                .arg(reader.GetScreenHeightMM())
                .arg(reader.GetScreenWidth())
                .arg(reader.GetScreenHeight());
        }
        else
        {
            msgBoxText = QString("This PC has only one screen. Display information:\n\n\tManufacture: %1\n\tSceen size: %2mm * %3mm\n\tResolution: %4 * %5")
                .arg(strManufacture)
                .arg(reader.GetScreenWidthMM())
                .arg(reader.GetScreenHeightMM())
                .arg(reader.GetScreenWidth())
                .arg(reader.GetScreenHeight());
        }

        QMessageBox msgBox(QMessageBox::Information, msgBoxTitle, msgBoxText, QMessageBox::Ok, this);
        //msgBox.exec();
    }
#else
    horDotsPerCM = width();
    horDotsPerCM = 10.0 * horDotsPerCM / widthMM();

    verDotsPerCM = height();
    verDotsPerCM = 10.0 * verDotsPerCM / heightMM();
#endif
}