本文整理汇总了C++中PageItem_Table类的典型用法代码示例。如果您正苦于以下问题:C++ PageItem_Table类的具体用法?C++ PageItem_Table怎么用?C++ PageItem_Table使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PageItem_Table类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetUniqueItem
PyObject *scribus_resizetablerow(PyObject* /* self */, PyObject* args)
{
char *Name = const_cast<char*>("");
int row;
double height;
if (!PyArg_ParseTuple(args, "id|es", &row, &height, "utf-8", &Name))
return nullptr;
if (!checkHaveDocument())
return nullptr;
PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
if (i == nullptr)
return nullptr;
PageItem_Table *table = i->asTable();
if (!table)
{
PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot resize row on a non-table item.","python error").toLocal8Bit().constData());
return nullptr;
}
if (row < 0 || row >= table->rows())
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Table row index out of bounds, must be >= 0 and < %1", "python error").arg(table->rows()).toLocal8Bit().constData());
return nullptr;
}
if (height <= 0.0)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Table row height must be > 0.0", "python error").toLocal8Bit().constData());
return nullptr;
}
table->resizeRow(row, height);
Py_RETURN_NONE;
}
示例2: updateStyleControls
void PropertiesPalette_Table::updateStyleControls()
{
if (m_item && m_item->isTable())
{
PageItem_Table* table = m_item->asTable();
tableStyleCombo->setEnabled(true);
cellStyleCombo->setEnabled(true);
buttonClearTableStyle->setEnabled(true);
buttonClearCellStyle->setEnabled(true);
// Fill in values.
if (m_doc->appMode != modeEditTable)
{
displayTableStyle(table->style());
cellStyleCombo->setEnabled(false);
buttonClearCellStyle->setEnabled(false);
}
else
{
// displayTableStyle(table->style());
displayCellStyle(table->activeCell().style());
}
}
else
{
tableStyleCombo->setEnabled(false);
cellStyleCombo->setEnabled(false);
buttonClearTableStyle->setEnabled(false);
buttonClearCellStyle->setEnabled(false);
}
}
示例3: on_buttonClearTableStyle_clicked
void PropertiesPalette_Table::on_buttonClearTableStyle_clicked()
{
if (!m_item || !m_item->isTable())
return;
PageItem_Table* table = m_item->asTable();
table->unsetDirectFormatting();
table->update();
}
示例4: on_buttonClearCellStyle_clicked
void PropertiesPalette_Table::on_buttonClearCellStyle_clicked()
{
if (!m_item || !m_item->isTable())
return;
m_doc->dontResize = true;
PageItem_Table* table = m_item->asTable();
table->activeCell().unsetDirectFormatting();
table->adjustTable();
table->update();
}
示例5: updateBorders
void PropertiesPalette_Table::updateBorders()
{
if (!m_doc || !m_item || !m_item->isTable())
return;
PageItem_Table* table = m_item->asTable();
TableSideSelector::Sides selectedSides = sideSelector->selection();
m_doc->dontResize = true;
if (m_doc->appMode != modeEditTable)
{
if (selectedSides & TableSideSelector::Left)
table->setLeftBorder(m_currentBorder);
if (selectedSides & TableSideSelector::Right)
table->setRightBorder(m_currentBorder);
if (selectedSides & TableSideSelector::Top)
table->setTopBorder(m_currentBorder);
if (selectedSides & TableSideSelector::Bottom)
table->setBottomBorder(m_currentBorder);
}
else
{
TableCell cell = table->activeCell();
if (selectedSides & TableSideSelector::Left)
cell.setLeftBorder(m_currentBorder);
if (selectedSides & TableSideSelector::Right)
cell.setRightBorder(m_currentBorder);
if (selectedSides & TableSideSelector::Top)
cell.setTopBorder(m_currentBorder);
if (selectedSides & TableSideSelector::Bottom)
cell.setBottomBorder(m_currentBorder);
}
table->adjustTable();
table->update();
}
示例6: PyErr_SetString
PyObject *scribus_newtable(PyObject* /* self */, PyObject* args)
{
double x, y, w, h;
int numRows, numColumns;
char *Name = const_cast<char*>("");
if (!PyArg_ParseTuple(args, "ddddii|es", &x, &y, &w, &h, &numRows, &numColumns, "utf-8", &Name))
return NULL;
if (!checkHaveDocument())
return NULL;
if (numRows < 1 || numColumns < 1)
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Both numRows and numColumns must be greater than 0.","python error").toLocal8Bit().constData());
return NULL;
}
int i = ScCore->primaryMainWindow()->doc->itemAdd(PageItem::Table, PageItem::Unspecified,
pageUnitXToDocX(x),
pageUnitYToDocY(y),
ValueToPoint(w),
ValueToPoint(h),
0, // Unused.
CommonStrings::None, // Unused.
CommonStrings::None); // Unused.
PageItem_Table *table = ScCore->primaryMainWindow()->doc->Items->at(i)->asTable();
table->insertRows(0, numRows - 1);
table->insertColumns(0, numColumns - 1);
table->adjustTableToFrame();
table->adjustFrameToTable();
if (strlen(Name) > 0)
{
QString objName = QString::fromUtf8(Name);
if (!ItemExists(objName))
ScCore->primaryMainWindow()->doc->Items->at(i)->setItemName(objName);
}
return PyString_FromString(table->itemName().toUtf8());
}
示例7: on_fillColor_activated
void PropertiesPalette_Table::on_fillColor_activated(const QString& colorName)
{
if (!m_item || !m_item->isTable())
return;
QString color = colorName;
if (colorName == CommonStrings::tr_NoneColor)
color = CommonStrings::None;
PageItem_Table* table = m_item->asTable();
if (m_doc->appMode != modeEditTable)
{
table->setFillColor(color);
table->setFillShade(fillShade->value());
}
else
{
TableCell cell = table->activeCell();
cell.setFillColor(color);
cell.setFillShade(fillShade->value());
}
table->update();
}
示例8: on_fillShade_valueChanged
void PropertiesPalette_Table::on_fillShade_valueChanged(int shade)
{
if (!m_item || !m_item->isTable())
return;
QString color = fillColor->currentColor();
if (color == CommonStrings::tr_NoneColor)
color = CommonStrings::None;
PageItem_Table* table = m_item->asTable();
if (m_doc->appMode != modeEditTable)
{
table->setFillColor(color);
table->setFillShade(shade);
}
else
{
TableCell cell = table->activeCell();
cell.setFillColor(color);
cell.setFillShade(shade);
}
table->update();
}
示例9: updateFillControls
void PropertiesPalette_Table::updateFillControls()
{
if (m_item && m_item->isTable())
{
PageItem_Table* table = m_item->asTable();
// Enable fill editing controls.
fillColor->setEnabled(true);
fillColorLabel->setEnabled(true);
fillShade->setEnabled(true);
fillShadeLabel->setEnabled(true);
// Fill in values.
if (m_doc->appMode != modeEditTable)
{
QString color = table->fillColor();
if (color == CommonStrings::None)
color = CommonStrings::tr_NoneColor;
setCurrentComboItem(fillColor, color);
fillShade->setValue(table->fillShade());
}
else
{
TableCell cell = table->activeCell();
QString color = cell.fillColor();
if (color == CommonStrings::None)
color = CommonStrings::tr_NoneColor;
setCurrentComboItem(fillColor, color);
fillShade->setValue(cell.fillShade());
}
}
else
{
// Disable fill editing controls.
fillColor->setEnabled(false);
fillColorLabel->setEnabled(false);
fillShade->setEnabled(false);
fillShadeLabel->setEnabled(false);
}
}
示例10: createObjectRect
//.........这里部分代码省略.........
currItem->annotation().setType(Annotation::Textfield);
currItem->setItemName( CommonStrings::itemName_TextField + QString("%1").arg(m_doc->TotalItems));
break;
case modeInsertPDFCheckbox:
currItem->annotation().setType(Annotation::Checkbox);
currItem->setItemName( CommonStrings::itemName_CheckBox + QString("%1").arg(m_doc->TotalItems));
break;
case modeInsertPDFCombobox:
currItem->annotation().setType(Annotation::Combobox);
currItem->annotation().setFlag(Annotation::Flag_Combo);
currItem->setItemName( CommonStrings::itemName_ComboBox + QString("%1").arg(m_doc->TotalItems));
break;
case modeInsertPDFListbox:
currItem->annotation().setType(Annotation::Listbox);
currItem->setItemName( CommonStrings::itemName_ListBox + QString("%1").arg(m_doc->TotalItems));
break;
case modeInsertPDFTextAnnotation:
currItem->annotation().setType(Annotation::Text);
currItem->setItemName( CommonStrings::itemName_TextAnnotation + QString("%1").arg(m_doc->TotalItems));
break;
case modeInsertPDFLinkAnnotation:
currItem->annotation().setType(Annotation::Link);
currItem->annotation().setZiel(m_doc->currentPage()->pageNr());
currItem->annotation().setAction("0 0");
currItem->setItemName( CommonStrings::itemName_LinkAnnotation + QString("%1").arg(m_doc->TotalItems));
currItem->setTextFlowMode(PageItem::TextFlowDisabled);
break;
}
break;
case modeDrawTable2:
// TODO: Figure out what these conditions actually do.
if ((m_doc->m_Selection->count() == 0) && (m_view->HaveSelRect) && (!m_view->MidButt))
{
m_view->HaveSelRect = false;
// Calculate table rectangle.
FRect tableRect = adjustedRect(canvasPressCoord, canvasCurrCoord);
if (tableRect.width() < 6 || tableRect.height() < 6)
{
// Ignore tiny tables.
m_view->requestMode(submodePaintingDone);
break;
}
// Show table insert dialog.
// qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
InsertTable *dia = new InsertTable(m_view, static_cast<int>(tableRect.height()/6), static_cast<int>(tableRect.width()/6));
if (!dia->exec())
{
m_view->requestMode(submodePaintingDone);
delete dia;
dia = 0;
break;
}
int numRows = dia->Rows->value();
int numColumns = dia->Cols->value();
delete dia;
dia = 0;
// Add the table item.
// TODO: This should be done in an undo transaction.
m_doc->dontResize = true;
z = m_doc->itemAdd(PageItem::Table, PageItem::Unspecified,
tableRect.x(),
tableRect.y(),
tableRect.width(),
tableRect.height(),
0, // Unused.
CommonStrings::None, // Unused.
CommonStrings::None); // Unused.
PageItem_Table *table = m_doc->Items->at(z)->asTable();
table->insertRows(0, numRows - 1);
table->insertColumns(0, numColumns - 1);
table->adjustTableToFrame();
table->adjustFrameToTable();
m_doc->dontResize = false;
m_doc->setRedrawBounding(table);
}
break;
case modeInsertPDF3DAnnotation:
if (modifiers == Qt::ShiftModifier)
{
z = m_doc->itemAddArea(PageItem::OSGFrame, PageItem::Unspecified, Rxp, Ryp, 1, m_doc->itemToolPrefs().imageFillColor, m_doc->itemToolPrefs().imageStrokeColor);
}
else
{
z = m_doc->itemAdd(PageItem::OSGFrame, PageItem::Unspecified, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().imageFillColor, m_doc->itemToolPrefs().imageStrokeColor);
}
currItem = m_doc->Items->at(z);
currItem->setIsAnnotation(true);
currItem->AutoName = false;
currItem->annotation().setType(Annotation::Annot3D);
currItem->setItemName( tr("3DAnnot") + QString("%1").arg(m_doc->TotalItems));
break;
}
if (z >= 0)
{
SetupDrawNoResize(z);
newObject = m_doc->Items->at(z);
newObject->ContourLine = newObject->PoLine.copy();
}
return newObject;
}
示例11: TableBorder
void PropertiesPalette_Table::on_sideSelector_selectionChanged()
{
if (!m_item || !m_item->isTable())
return;
/*
* Figure out the selection state. Either
*
* 1) Some sides are selected and they all have the same border, or
* 2) Some sides are selected but they have different borders, or
* 3) No sides are selected.
*/
State borderState = Unset;
m_currentBorder = TableBorder();
TableSideSelector::Sides selectedSides = sideSelector->selection();
PageItem_Table* table = m_item->asTable();
if (selectedSides & TableSideSelector::Left)
{
if (borderState == Unset && !table->leftBorder().isNull())
{
m_currentBorder = table->leftBorder();
borderState = Set;
}
else if (m_currentBorder != table->leftBorder())
borderState = TriState;
}
if (selectedSides & TableSideSelector::Right)
{
if (borderState == Unset && !table->rightBorder().isNull())
{
m_currentBorder = table->rightBorder();
borderState = Set;
}
else if (m_currentBorder != table->rightBorder())
borderState = TriState;
}
if (selectedSides & TableSideSelector::Top)
{
if (borderState == Unset && !table->topBorder().isNull())
{
m_currentBorder = table->topBorder();
borderState = Set;
}
else if (m_currentBorder != table->topBorder())
borderState = TriState;
}
if (selectedSides & TableSideSelector::Bottom)
{
if (borderState == Unset && !table->bottomBorder().isNull())
{
m_currentBorder = table->bottomBorder();
borderState = Set;
}
else if (m_currentBorder != table->bottomBorder())
borderState = TriState;
}
if (borderState == Set)
{
/// Some sides selected and they have same border.
addBorderLineButton->setEnabled(true);
removeBorderLineButton->setEnabled(true);
borderLineList->setEnabled(true);
}
else if (borderState == TriState)
{
/// Some sides selected but they have different border.
m_currentBorder = TableBorder();
addBorderLineButton->setEnabled(true);
removeBorderLineButton->setEnabled(true);
borderLineList->setEnabled(true);
}
else
{
/// No sides selected.
m_currentBorder = TableBorder();
addBorderLineButton->setEnabled(false);
removeBorderLineButton->setEnabled(false);
borderLineList->setEnabled(false);
}
updateBorderLineList();
}