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

📄 fraction.cpp

📁 嵌入式Qt下的一个计算器源码
💻 CPP
字号:
/******************************************************************************** Copyright (C) 2000-2006 TROLLTECH ASA. All rights reserved.**** This file is part of the Phone Edition of the Qtopia Toolkit.**** Licensees holding a valid license agreement from Trolltech or any of its** authorized distributors may use this file in accordance with** the License Agreement provided with the Licensed Software.**** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for**   information about Trolltech's Commercial License Agreements.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.********** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#ifdef ENABLE_FRACTION#include <QDesktopWidget>#include <qtopia/qtopiaapplication.h>#include "../doubleinstruction.h"#include "fraction.h"FormFraction::FormFraction(QWidget *parent, Qt::WFlags fl)	:FractionInputWidget(parent,fl) {	    setObjectName( "Fraction" ); // No tr    InputWidgetLayout = new QGridLayout(this);    InputWidgetLayout->setSpacing( 3 );    InputWidgetLayout->setMargin( 0 );     QSizePolicy mySizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);        //FractionInputWidget *siw = new FractionInputWidget(this);    setSizePolicy(mySizePolicy);    init(0,0);}void FormFraction::init(int fromRow, int fromCol){    //FractionInputWidget::init(fromRow, fromCol);    QRect screenRect = QtopiaApplication::desktop()->availableGeometry();    bool portrait = screenRect.width() < screenRect.height();    if ( portrait ) {  //portrait mode        FractionInputWidget::init(fromRow+1, fromCol);        //grid->addWidget(siw, 1, 0, 4, 4);    } else { //landscape mode        FractionInputWidget::init(fromRow, fromCol);        //grid->addWidget(siw, 0, 0, 4, 4);    }        QFont big(font());    big.setPointSize(qMin(big.pointSize()*2, 18));    QPushButton *PBMPlus = new QPushButton(this);    PBMPlus->setSizePolicy(sizePolicy());    PBMPlus->setText(tr("M+"));    PBMPlus->setFont(big);    QPushButton *PBMC = new QPushButton(this);    PBMC->setSizePolicy(sizePolicy());    PBMC->setText(tr("MC"));    PBMC->setFont(big);    QPushButton *PBMR = new QPushButton(this);    PBMR->setSizePolicy(sizePolicy());    PBMR->setText(tr("MR"));    PBMR->setFont(big);    QPushButton *PBCE = new QPushButton(this);    PBCE->setSizePolicy(sizePolicy());    PBCE->setText(tr("CE"));    PBCE->setFont(big);    if (portrait) {        InputWidgetLayout->addWidget(PBCE, 0, 3);        InputWidgetLayout->addWidget(PBMC, 0, 1);        InputWidgetLayout->addWidget(PBMR, 0, 2);        InputWidgetLayout->addWidget(PBMPlus, 0, 0);    } else {        InputWidgetLayout->addWidget(PBCE, 0, 4);        InputWidgetLayout->addWidget(PBMC, 1, 4);        InputWidgetLayout->addWidget(PBMR, 2, 4);        InputWidgetLayout->addWidget(PBMPlus, 3, 4);    }    connect (PBCE, SIGNAL(clicked()), this, SLOT(CEClicked()));    connect (PBMR, SIGNAL(clicked()), this, SLOT(MRClicked()));    connect (PBMC, SIGNAL(clicked()), this, SLOT(MCClicked()));    connect (PBMPlus, SIGNAL(clicked()), this, SLOT(MPlusClicked()));}void FormFraction::showEvent ( QShowEvent *e ) {    systemEngine->setAccType("Fraction"); // No tr        QWidget::showEvent(e);}void FormFraction::CEClicked() {    systemEngine->dualReset();}void FormFraction::MCClicked() {    systemEngine->memoryReset();}void FormFraction::MRClicked() {    systemEngine->memoryRecall();}void FormFraction::MPlusClicked() {    systemEngine->memorySave();}#endif //ENABLE_FRACTION

⌨️ 快捷键说明

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