main.cpp

来自「c++ GUI Programming with QT4书中的源码」· C++ 代码 · 共 36 行

CPP
36
字号
#include <QtGui>#include "currencymodel.h"int main(int argc, char *argv[]){    QApplication app(argc, argv);    QMap<QString, double> currencyMap;    currencyMap.insert("AUD", 1.3259);    currencyMap.insert("CHF", 1.2970);    currencyMap.insert("CZK", 24.510);    currencyMap.insert("DKK", 6.2168);    currencyMap.insert("EUR", 0.8333);    currencyMap.insert("GBP", 0.5661);    currencyMap.insert("HKD", 7.7562);    currencyMap.insert("JPY", 112.92);    currencyMap.insert("NOK", 6.5200);    currencyMap.insert("NZD", 1.4697);    currencyMap.insert("SEK", 7.8180);    currencyMap.insert("SGD", 1.6901);    currencyMap.insert("USD", 1.0000);    CurrencyModel currencyModel;    currencyModel.setCurrencyMap(currencyMap);    QTableView tableView;    tableView.setModel(&currencyModel);    tableView.setAlternatingRowColors(true);    tableView.setWindowTitle(QObject::tr("Currencies"));    tableView.show();    return app.exec();}

⌨️ 快捷键说明

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