当前位置:首页 > 嵌入式Linux大作业任务书 - 图文
result = sqrt(operand); }
else if(clickedOperator == tr(\ result = pow(operand,2.0); }
else if(clickedOperator == tr(\ {
if(operand == 0.0){ abortOperation(); return; }
result = 1.0/operand; }
display->setText(QString::number(result)); waitingForOperand = true; }
在这个槽函数里卖弄,根据按钮上面的信息如“Sqrt”,”x\\262”, ”1/x”,选择对应的操作流程,这里使用了if/else语句实现,将结果在display中输出。
下面是最后一个函数,按键“=“的实现,将运算结果显示在display中,并把所有保存的运算值都清零(sumSoFar和factorSoFar)。
void Calculator::equalClicked() {
double operand=display->text().toDouble(); if(!pendingMultiplicativeOperator.isEmpty()){
if(!calculate(operand,pendingMultiplicativeOperator)){ abortOperation(); return; }
operand = factorSoFar; factorSoFar = 0.0;
pendingMultiplicativeOperator.clear(); }
if(!pendingAdditiveOperator.isEmpty()) {
if(!calculate(operand,pendingAdditiveOperator)){ abortOperation(); return; }
pendingAdditiveOperator.clear();
- 21 -
}else{
sumSoFar = operand; }
display->setText(QString::number(sumSoFar)); sumSoFar = 0.0;
waitingForOperand = true; }
3.使用QTE生成能在开发板上运行的GUI程序 测试触摸屏
配置Arm端环境变量:
- 22 -
更改ts.conf配置文件
- 23 -
安装完毕触摸屏环境后,将WINDOWS下的工程文件复制到Fedora中,进行以下操作: /usr/local/Trolltech/Qt-embedded-4.4.0/bin/qmake -project
/usr/local/Trolltech/Qt-embedded-4.4.0/bin/qmake
- 24 -
共分享92篇相关文档