本文整理汇总了C++中spreadsheetgui::SheetView::selectedIndexes方法的典型用法代码示例。如果您正苦于以下问题:C++ SheetView::selectedIndexes方法的具体用法?C++ SheetView::selectedIndexes怎么用?C++ SheetView::selectedIndexes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spreadsheetgui::SheetView
的用法示例。
在下文中一共展示了SheetView::selectedIndexes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: activated
void CmdSpreadsheetStyleUnderline::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();
QModelIndexList selection = sheetView->selectedIndexes();
if (selection.size() > 0) {
bool allUnderline = true;
for (QModelIndexList::const_iterator it = selection.begin(); it != selection.end(); ++it) {
const Cell * cell = sheet->getCell(CellAddress((*it).row(), (*it).column()));
if (cell) {
std::set<std::string> style;
cell->getStyle(style);
if (style.find("underline") == style.end()) {
allUnderline = false;
break;
}
}
}
std::vector<Range> ranges = sheetView->selectedRanges();
std::vector<Range>::const_iterator i = ranges.begin();
Gui::Command::openCommand("Set underline text");
for (; i != ranges.end(); ++i) {
if (!allUnderline)
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.setStyle('%s', 'underline', 'add')", sheet->getNameInDocument(),
i->rangeString().c_str());
else
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.setStyle('%s', 'underline', 'remove')", sheet->getNameInDocument(),
i->rangeString().c_str());
}
Gui::Command::commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
}
}
}
}
示例4: isActive
bool CmdSpreadsheetSetAlias::isActive()
{
if (getActiveGuiDocument()) {
Gui::MDIView* activeWindow = Gui::getMainWindow()->activeWindow();
if (activeWindow) {
SpreadsheetGui::SheetView * sheetView = freecad_dynamic_cast<SpreadsheetGui::SheetView>(activeWindow);
if (sheetView) {
QModelIndexList selection = sheetView->selectedIndexes();
if (selection.size() == 1)
return true;
}
}
}
return false;
}