⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 metric.ui.h

📁 Linux下的基于X11的图形开发环境。
💻 H
字号:
/****************************************************************************** ui.h extension file, included from the uic-generated form implementation.**** If you wish to add, delete or rename functions respectively slots use** Qt Designer which will update this file, preserving your code. Create an** init() function in place of a constructor, and a destroy() function in** place of a destructor.*****************************************************************************/#include <qvalidator.h>void ConversionForm::init(){    numberLineEdit->setValidator( new QDoubleValidator( numberLineEdit ) );    numberLineEdit->setText( "10" );    convert();    numberLineEdit->selectAll();}void ConversionForm::convert(){    enum MetricUnits {	Kilometers,	Meters,	Centimeters,	Millimeters    };    enum OldUnits {	Miles,	Yards,	Feet,	Inches    };    // Retrieve the input    double input = numberLineEdit->text().toDouble();    double scaledInput = input;    // internally convert the input to millimeters    switch ( fromComboBox->currentItem() ) {    case Kilometers:	scaledInput *= 1000000;	break;    case Meters:	scaledInput *= 1000;	break;    case Centimeters:	scaledInput *= 10;	break;    }    //convert to inches    double result = scaledInput * 0.0393701;    switch ( toComboBox->currentItem() ) {    case Miles:	result /= 63360;	break;    case Yards:	result /= 36;	break;    case Feet:	result /= 12;	break;    }    // set the result    int decimals = decimalsSpinBox->value();    resultLineEdit->setText( QString::number( result, 'f', decimals ) );    numberLineEdit->setText( QString::number( input, 'f', decimals ) );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -