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

📄 sa01form.ui.h

📁 linux下qt编程的一个入门小程序。qt是跨平台的图形编程环境。
💻 H
字号:
/****************************************************************************** ui.h extension file, included from the uic-generated form implementation.**** If you want to add, delete, or rename functions or slots, use** Qt Designer to update this file, preserving your code.**** You should not define a constructor or destructor in this file.** Instead, write your code in functions called init() and destroy().** These will automatically be called by the form's constructor and** destructor.*****************************************************************************/void sa01Form::caculate(){    enum OPERATOR    { ADD, SUB, MUTIPLY, DIVID    };        double num1 = num1LineEdit->text().toDouble();    double num2 = num2LineEdit->text().toDouble();    double result = 0.0;    switch(operatorComboBox->currentItem())    {    case ADD: result = num1 + num2; break;case SUB:    result = num1 - num2;    break;case MUTIPLY:    result = num1 * num2;    break;case DIVID:    result = num1 / num2;    break;default:    break;};        resultLineEdit->setText( QString::number( result, 'f', 5 ) ); }#include <qvalidator.h>void sa01Form::init(){        num1LineEdit->setValidator( new QDoubleValidator( num1LineEdit ) ); num2LineEdit->setValidator( new QDoubleValidator( num2LineEdit ) ); num1LineEdit->setText("0.0"); num2LineEdit->setText("0.0"); resultLineEdit->setText("0.0");       num1LineEdit->selectAll();}

⌨️ 快捷键说明

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