本文整理汇总了C++中spreadsheetgui::SheetView类的典型用法代码示例。如果您正苦于以下问题:C++ SheetView类的具体用法?C++ SheetView怎么用?C++ SheetView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SheetView类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDelete
bool ViewProviderSheet::onDelete(const std::vector<std::string> &)
{
// If view is closed, delete the object
if (view.isNull())
return true;
// View is not closed, delete cell contents instead if it is active
if (Gui::Application::Instance->activeDocument()) {
Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow();
SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast<SpreadsheetGui::SheetView>(activeWindow);
if (sheetView) {
Sheet * sheet = sheetView->getSheet();
QModelIndexList selection = sheetView->selectedIndexes();
if (selection.size() > 0) {
Gui::Command::openCommand("Clear cell(s)");
std::vector<Range> ranges = sheetView->selectedRanges();
std::vector<Range>::const_iterator i = ranges.begin();
for (; i != ranges.end(); ++i) {
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.clear('%s')", sheet->getNameInDocument(),
i->rangeString().c_str());
}
Gui::Command::commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
}
}
}
return false;
}
示例2: activated
void CmdSpreadsheetSetAlias::activated(int iMsg)
{
if (getActiveGuiDocument()) {
Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow();
SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast<SpreadsheetGui::SheetView>(activeWindow);
if (sheetView) {
Sheet * sheet = sheetView->getSheet();
QModelIndexList selection = sheetView->selectedIndexes();
if (selection.size() == 1) {
std::vector<Range> range;
range.push_back(Range(selection[0].row(), selection[0].column(),
selection[0].row(), selection[0].column()));
std::auto_ptr<PropertiesDialog> dialog(new PropertiesDialog(sheet, range, sheetView));
dialog->selectAlias();
if (dialog->exec() == QDialog::Accepted)
dialog->apply();
}
}
}
}
示例3: setBackgroundColor
void WorkbenchHelper::setBackgroundColor(const QColor & color)
{
Gui::Document * doc = Gui::Application::Instance->activeDocument();
if (doc) {
Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow();
SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast<SpreadsheetGui::SheetView>(activeWindow);
if (sheetView) {
Sheet * sheet = sheetView->getSheet();
std::vector<Range> ranges = sheetView->selectedRanges();
// Execute mergeCells commands
if (ranges.size() > 0) {
std::vector<Range>::const_iterator i = ranges.begin();
Gui::Command::openCommand("Set background color");
for (; i != ranges.end(); ++i)
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.setBackground('%s', (%f,%f,%f))", sheet->getNameInDocument(),
i->rangeString().c_str(), color.redF(), color.greenF(), color.blueF());
Gui::Command::commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
}
}
}
}
示例4: activated
void CmdSpreadsheetMergeCells::activated(int iMsg)
{
Q_UNUSED(iMsg);
if (getActiveGuiDocument()) {
Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow();
SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast<SpreadsheetGui::SheetView>(activeWindow);
if (sheetView) {
Sheet * sheet = sheetView->getSheet();
std::vector<Range> ranges = sheetView->selectedRanges();
// Execute mergeCells commands
if (ranges.size() > 0) {
Gui::Command::openCommand("Merge cells");
std::vector<Range>::const_iterator i = ranges.begin();
for (; i != ranges.end(); ++i)
if (i->size() > 1)
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.mergeCells('%s')", sheet->getNameInDocument(),
i->rangeString().c_str());
Gui::Command::commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
}
}
}
}
示例5: isActive
bool CmdSpreadsheetSplitCell::isActive()
{
if (getActiveGuiDocument()) {
Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow();
SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast<SpreadsheetGui::SheetView>(activeWindow);
if (sheetView) {
QModelIndex current = sheetView->currentIndex();
Sheet * sheet = sheetView->getSheet();
if (current.isValid())
return sheet->isMergedCell(CellAddress(current.row(), current.column()));
}
}
return false;
}