亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? spreadsheet.cpp

?? 關于QT界面字動生成的介紹,包含了各種小例子,以及如何更好更快的學好QT
?? CPP
字號:
#include <qapplication.h>#include <qclipboard.h>#include <qdatastream.h>#include <qfile.h>#include <qlineedit.h>#include <qmessagebox.h>#include <qregexp.h>#include <qvariant.h>#include <algorithm>#include <vector>using namespace std;#include "cell.h"#include "spreadsheet.h"Spreadsheet::Spreadsheet(QWidget *parent, const char *name)    : QTable(parent, name){    autoRecalc = true;    setSelectionMode(Single);    clear();}void Spreadsheet::clear(){    setNumRows(0);    setNumCols(0);    setNumRows(NumRows);    setNumCols(NumCols);    for (int i = 0; i < NumCols; i++)        horizontalHeader()->setLabel(i, QChar('A' + i));    setCurrentCell(0, 0);}Cell *Spreadsheet::cell(int row, int col) const{    return (Cell *)item(row, col);}QString Spreadsheet::formula(int row, int col) const{    Cell *c = cell(row, col);    if (c)        return c->formula();    else        return "";}void Spreadsheet::setFormula(int row, int col,                             const QString &formula){    Cell *c = cell(row, col);    if (c) {        c->setFormula(formula);        updateCell(row, col);    } else {        setItem(row, col, new Cell(this, formula));    }}QString Spreadsheet::currentLocation() const{    return QChar('A' + currentColumn())           + QString::number(currentRow() + 1);}QString Spreadsheet::currentFormula() const{    return formula(currentRow(), currentColumn());}QWidget *Spreadsheet::createEditor(int row, int col,                                   bool initFromCell) const{    QLineEdit *lineEdit = new QLineEdit(viewport());    lineEdit->setFrame(false);    if (initFromCell)        lineEdit->setText(formula(row, col));    return lineEdit;}void Spreadsheet::endEdit(int row, int col, bool accepted,                          bool wasReplacing){    QLineEdit *lineEdit = (QLineEdit *)cellWidget(row, col);    if (!lineEdit)        return;    QString oldFormula = formula(row, col);    QString newFormula = lineEdit->text();    QTable::endEdit(row, col, false, wasReplacing);    if (accepted && newFormula != oldFormula) {        setFormula(row, col, newFormula);        somethingChanged();    }}void Spreadsheet::somethingChanged(){    if (autoRecalc)        recalculate();    emit modified();}bool Spreadsheet::writeFile(const QString &fileName){    QFile file(fileName);    if (!file.open(IO_WriteOnly)) {        QMessageBox::warning(this, tr("Spreadsheet"),                             tr("Cannot write file %1:\n%2.")                             .arg(file.name())                             .arg(file.errorString()));        return false;    }    QDataStream out(&file);    out.setVersion(5);    out << (Q_UINT32)MagicNumber;    QApplication::setOverrideCursor(waitCursor);    for (int row = 0; row < NumRows; ++row) {        for (int col = 0; col < NumCols; ++col) {            QString str = formula(row, col);            if (!str.isEmpty())                out << (Q_UINT16)row << (Q_UINT16)col << str;        }    }    QApplication::restoreOverrideCursor();    return true;}bool Spreadsheet::readFile(const QString &fileName){    QFile file(fileName);    if (!file.open(IO_ReadOnly)) {        QMessageBox::warning(this, tr("Spreadsheet"),                             tr("Cannot read file %1:\n%2.")                             .arg(file.name())                             .arg(file.errorString()));        return false;    }    QDataStream in(&file);    in.setVersion(5);    Q_UINT32 magic;    in >> magic;    if (magic != MagicNumber) {        QMessageBox::warning(this, tr("Spreadsheet"),                             tr("The file is not a "                                "Spreadsheet file."));        return false;    }    clear();    Q_UINT16 row;    Q_UINT16 col;    QString str;    QApplication::setOverrideCursor(waitCursor);    while (!in.atEnd()) {        in >> row >> col >> str;        setFormula(row, col, str);    }    QApplication::restoreOverrideCursor();    return true;}void Spreadsheet::cut(){    copy();    del();}void Spreadsheet::copy(){    QTableSelection sel = selection();    QString str;    for (int i = 0; i < sel.numRows(); ++i) {        if (i > 0)            str += "\n";        for (int j = 0; j < sel.numCols(); ++j) {            if (j > 0)                str += "\t";            str += formula(sel.topRow() + i, sel.leftCol() + j);        }    }    QApplication::clipboard()->setText(str);}QTableSelection Spreadsheet::selection(){    if (QTable::selection(0).isEmpty())        return QTableSelection(currentRow(), currentColumn(),                               currentRow(), currentColumn());    return QTable::selection(0);}void Spreadsheet::paste(){    QTableSelection sel = selection();    QString str = QApplication::clipboard()->text();    QStringList rows = QStringList::split("\n", str, true);    int numRows = rows.size();    int numCols = rows.first().contains("\t") + 1;    if (sel.numRows() * sel.numCols() != 1        && (sel.numRows() != numRows            || sel.numCols() != numCols)) {        QMessageBox::information(this, tr("Spreadsheet"),                tr("The information cannot be pasted because the "                   "copy and paste areas aren't the same size."));        return;    }    for (int i = 0; i < numRows; ++i) {        QStringList cols = QStringList::split("\t", rows[i], true);        for (int j = 0; j < numCols; ++j) {            int row = sel.topRow() + i;            int col = sel.leftCol() + j;            if (row < NumRows && col < NumCols)                setFormula(row, col, cols[j]);        }    }    somethingChanged();}void Spreadsheet::del(){    QTableSelection sel = selection();    for (int i = 0; i < sel.numRows(); ++i) {        for (int j = 0; j < sel.numCols(); ++j)            delete cell(sel.topRow() + i, sel.leftCol() + j);    }    clearSelection();}void Spreadsheet::selectRow(){    clearSelection();    QTable::selectRow(currentRow());}void Spreadsheet::selectColumn(){    clearSelection();    QTable::selectColumn(currentColumn());}void Spreadsheet::selectAll(){    clearSelection();    selectCells(0, 0, NumRows - 1, NumCols - 1);}void Spreadsheet::findNext(const QString &str, bool caseSensitive){    int row = currentRow();    int col = currentColumn() + 1;    while (row < NumRows) {        while (col < NumCols) {            if (text(row, col).contains(str, caseSensitive)) {                clearSelection();                setCurrentCell(row, col);                setActiveWindow();                return;            }            ++col;        }        col = 0;        ++row;    }    qApp->beep();}void Spreadsheet::findPrev(const QString &str, bool caseSensitive){    int row = currentRow();    int col = currentColumn() - 1;    while (row >= 0) {        while (col >= 0) {            if (text(row, col).contains(str, caseSensitive)) {                clearSelection();                setCurrentCell(row, col);                setActiveWindow();                return;            }            --col;        }        col = NumCols - 1;        --row;    }    qApp->beep();}void Spreadsheet::recalculate(){    int row;    for (row = 0; row < NumRows; ++row) {        for (int col = 0; col < NumCols; ++col) {            if (cell(row, col))                cell(row, col)->setDirty();        }    }    for (row = 0; row < NumRows; ++row) {        for (int col = 0; col < NumCols; ++col) {            if (cell(row, col))                updateCell(row, col);        }    }}void Spreadsheet::sort(const SpreadsheetCompare &compare){    vector<QStringList> rows;    QTableSelection sel = selection();    int i;    for (i = 0; i < sel.numRows(); ++i) {        QStringList row;        for (int j = 0; j < sel.numCols(); ++j)            row.push_back(formula(sel.topRow() + i,                                  sel.leftCol() + j));        rows.push_back(row);    }    stable_sort(rows.begin(), rows.end(), compare);    for (i = 0; i < sel.numRows(); ++i) {        for (int j = 0; j < sel.numCols(); ++j)            setFormula(sel.topRow() + i, sel.leftCol() + j,                       rows[i][j]);    }    clearSelection();    somethingChanged();}void Spreadsheet::setAutoRecalculate(bool on){    autoRecalc = on;    if (autoRecalc)        recalculate();}bool SpreadsheetCompare::operator()(const QStringList &row1,                                    const QStringList &row2) const{    for (int i = 0; i < NumKeys; ++i) {        int column = keys[i];        if (column != -1) {            if (row1[column] != row2[column]) {                if (ascending[i])                    return row1[column] < row2[column];                else                    return row1[column] > row2[column];            }        }    }    return false;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人综合婷婷国产精品久久 | 国精产品一区一区三区mba视频 | www.欧美.com| 一区二区三区高清| 中文在线一区二区| 久久一区二区三区国产精品| 在线观看中文字幕不卡| 91在线一区二区三区| 六月丁香婷婷色狠狠久久| 偷拍一区二区三区四区| 亚洲一区中文在线| 亚洲激情自拍偷拍| 一区二区在线观看视频在线观看| 中文一区在线播放| 久久精品免费在线观看| 国产调教视频一区| 国产精品毛片a∨一区二区三区| 精品电影一区二区| 久久精品综合网| 亚洲免费资源在线播放| 一区二区三区免费看视频| 中文字幕高清一区| 国产精品高潮呻吟| 亚洲精品成人少妇| 午夜精品在线看| 狠狠色丁香婷婷综合| 国产精品亚洲а∨天堂免在线| 国产成人三级在线观看| 成人精品小蝌蚪| www..com久久爱| 在线观看www91| 91精品国产一区二区三区香蕉| 91精品黄色片免费大全| 欧美精品一区二区久久久| 久久精品夜夜夜夜久久| 亚洲日本欧美天堂| 丝袜国产日韩另类美女| 国内精品免费**视频| 高清国产一区二区三区| 在线精品视频一区二区三四 | 中文字幕一区二区三区不卡 | 91精品一区二区三区久久久久久| 日韩一级二级三级| 欧美极品另类videosde| 国产精品美女久久久久久久| 亚洲猫色日本管| 青青青爽久久午夜综合久久午夜| 国产又粗又猛又爽又黄91精品| 91伊人久久大香线蕉| 欧美日韩精品综合在线| 国产亚洲成年网址在线观看| 亚洲自拍与偷拍| 国产精一品亚洲二区在线视频| 色综合中文综合网| 色狠狠一区二区三区香蕉| 欧美日韩成人在线一区| 中文字幕一区二区三区不卡| 蜜桃av一区二区三区| 国产精品小仙女| 这里只有精品99re| 亚洲欧美日韩久久精品| 韩国成人福利片在线播放| 国产成人鲁色资源国产91色综| 欧美视频一区二| 国产精品九色蝌蚪自拍| 精品在线播放午夜| 在线观看精品一区| 国产精品久久久久婷婷 | 欧美精品日韩一本| 亚洲啪啪综合av一区二区三区| 国产永久精品大片wwwapp| 制服丝袜亚洲网站| 亚洲精品写真福利| 99久久久无码国产精品| 久久久久久久国产精品影院| 天天色 色综合| 欧美三级中文字| 一区二区三区在线观看视频| 精品一区二区日韩| 欧美一级夜夜爽| 午夜亚洲国产au精品一区二区| www.色综合.com| 精品国产百合女同互慰| 免费国产亚洲视频| 日韩女优av电影| 男人的j进女人的j一区| 欧美日韩国产精选| 亚洲国产日韩在线一区模特| 色天天综合久久久久综合片| 亚洲欧美一区二区不卡| 99久久er热在这里只有精品15 | 欧美日韩的一区二区| 樱花草国产18久久久久| 欧美三区免费完整视频在线观看| 亚洲综合一区二区| 日韩一区二区高清| 成人免费不卡视频| 天天综合色天天综合色h| 日韩区在线观看| 成人午夜碰碰视频| 亚洲网友自拍偷拍| 久久久精品国产免大香伊| 99久久久精品| 蜜臀av在线播放一区二区三区| 日本一区二区三区在线不卡| 欧美性猛交xxxx黑人交| 久久99精品视频| 一区二区成人在线| 欧美精品一区二区三区视频| 91免费版pro下载短视频| 日本免费在线视频不卡一不卡二| 精品国产伦理网| 欧洲精品一区二区三区在线观看| 久久精品99国产精品| 亚洲欧美日韩国产一区二区三区| 日韩欧美在线一区二区三区| 91性感美女视频| 国产综合久久久久久鬼色| 亚洲一区免费观看| 国产精品美女久久久久高潮| 日韩一区二区免费在线电影| 91黄视频在线观看| 国产成人亚洲综合色影视| 日本aⅴ亚洲精品中文乱码| 日韩美女精品在线| 国产亚洲精品资源在线26u| 3751色影院一区二区三区| 一本色道久久综合亚洲精品按摩 | 成人国产视频在线观看| 美洲天堂一区二卡三卡四卡视频| 日韩一区有码在线| 国产日韩高清在线| 精品乱人伦小说| 欧美日韩国产片| 欧美在线观看一二区| 91麻豆国产自产在线观看| 国产经典欧美精品| 国产乱子伦视频一区二区三区 | 欧美日韩免费一区二区三区| 91免费版pro下载短视频| 成人免费毛片app| 懂色av中文字幕一区二区三区 | 91麻豆精品国产91久久久使用方法 | 国产精品66部| 精品一区二区免费看| 日韩成人精品在线| 日本伊人午夜精品| 毛片av一区二区三区| 午夜成人免费电影| 蜜桃传媒麻豆第一区在线观看| 午夜久久久久久| 日韩av一区二区三区四区| 丝袜a∨在线一区二区三区不卡 | 精品电影一区二区| 26uuu亚洲综合色| 国产视频一区二区在线观看| 国产丝袜欧美中文另类| 欧美国产综合一区二区| 亚洲成人你懂的| 性久久久久久久久| 麻豆精品国产传媒mv男同| 久久99日本精品| 国产精品一区二区三区99| 成人综合婷婷国产精品久久免费| 97成人超碰视| 欧美无乱码久久久免费午夜一区| 欧美日本免费一区二区三区| 日韩一区二区不卡| 欧美国产精品一区二区三区| 中文字幕一区二区三区在线播放 | 欧美韩国一区二区| 亚洲欧美区自拍先锋| 日韩在线a电影| 国产一本一道久久香蕉| 暴力调教一区二区三区| 欧美日韩一区二区欧美激情| 日韩欧美电影一区| 欧美高清在线精品一区| 一区二区久久久久| 美日韩一级片在线观看| 成人免费毛片a| 7777精品伊人久久久大香线蕉完整版 | 欧美精品一区二区高清在线观看| 国产无一区二区| 一区二区三区不卡在线观看| 青青草伊人久久| 成人18视频在线播放| 欧美一区二视频| 国产精品美女一区二区三区| 日本欧美久久久久免费播放网| 成人h动漫精品一区二| 欧美精品三级日韩久久| 综合欧美一区二区三区| 六月丁香婷婷色狠狠久久| 91在线观看下载| 久久精品欧美日韩精品| 三级亚洲高清视频| 色美美综合视频| 国产精品午夜在线观看| 精油按摩中文字幕久久|