示例#1
0
void MInputContext::setLanguage(const QString &language)
{
    QLocale newLocale(language);
    Qt::LayoutDirection oldDirection = inputDirection();

    if (newLocale != inputLocale) {
        inputLocale = newLocale;
        emitLocaleChanged();
    }

    Qt::LayoutDirection newDirection = inputDirection();
    if (newDirection != oldDirection) {
        emitInputDirectionChanged(newDirection);
    }
}
示例#2
0
int main(int argc, const char * argv[])
{
    IFunction *targetFunction = selectFunction();   // Выбор целевой функции
    
    Point startPoint = inputPoint(*targetFunction);   // Ввод стартовой точки
    Point direction = inputDirection(*targetFunction, true); // Направление принимаем за единичный вектор
    
    double precision = inputPrecision();    // Ввод точности
    
    Point min = Newton().optimize(*targetFunction, startPoint, direction, precision);
    
    cout << "Minimum is:\t";
    min.print(precision);
    cout << endl << "F(min) is:\t";
    cout << targetFunction->value(min);
    
    return 0;
}