static PyObject *meth_QTextTable_insertColumns(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { int a0; int a1; QTextTable *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "Bii", &sipSelf, sipType_QTextTable, &sipCpp, &a0, &a1)) { Py_BEGIN_ALLOW_THREADS sipCpp->insertColumns(a0,a1); Py_END_ALLOW_THREADS Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QTextTable, sipName_insertColumns, doc_QTextTable_insertColumns); return NULL; }
void TextEditWidget::sl_InsertColumnAction_Triggered() { QTextTable* table = textField->textCursor().currentTable(); if (!table) { WARNING("Wrong button state"); return; } QTextTableCell currentCell = table->cellAt(textField->textCursor()); table->insertColumns(currentCell.column() + 1, 1); QTextTableCell cell = table->cellAt(0, currentCell.column() + 1); textField->setTextCursor(cell.firstCursorPosition()); }
// Добавление столбцов в таблицу void TableFormatter::onTableAddColClicked(void) { QTextCursor cursor(textArea->textCursor()); QTextTable *table = cursor.currentTable(); if(table) { QTextTableCell cell=table->cellAt(cursor); // Выясняется текущая ячейка int cellColCursor=cell.column(); // Текущий номер столбца (счет с нуля) bool ok=false; int addNum=QInputDialog::getInt(editor, tr("Append columns to table"),tr("Append columns:"), 1, 1, 100, 1, &ok); if(ok && addNum > 0) table->insertColumns(cellColCursor + 1,addNum); } }