电子表格应用程序功能实现全解析
1. 实现编辑菜单功能
编辑菜单包含了多个实用的功能,以下是对这些功能实现的详细介绍:
- 剪切功能(Cut) :
void Spreadsheet::cut()
{
copy();
del();
}
剪切操作等同于先复制再删除。通过调用 copy() 函数复制选中内容,再调用 del() 函数删除选中内容。
- 复制功能(Copy) :
void Spreadsheet::copy()
{
QTableWidgetSelectionRange range = selectedRange();
QString str;
for (int i = 0; i < range.rowCount(); ++i) {
if (i > 0)
str += "\n";
for (int j = 0; j < range.columnCount(); ++j) {
if (j > 0)
str += "\t";
str += formula(range.topRow() + i, range.leftColumn() + j);
}
}
超级会员免费看
订阅专栏 解锁全文
1万+

被折叠的 条评论
为什么被折叠?



