void Layoutpainter::SetColumLarge()
{
if (textCursor().currentTable()) {
QTextTableCell existingcell
= textCursor
().
currentTable()->cellAt
(textCursor
());
int cellcoolcursoris = existingcell.column(); /* int value start from zero */
bool ok;
int LargeSet
= QInputDialog::getInteger(0, tr
("Set Cell Width"),
tr("Point Length:"),Get_Cell_Width(tbforms,cellcoolcursoris), 1, 2000, 1, &ok);
if (ok && LargeSet > 0) {
QVector<QTextLength> constraints = tbforms.columnWidthConstraints();
for (int i = 0; i < constraints.size(); ++i) {
if (i == cellcoolcursoris) {
}
}
tbforms.setColumnWidthConstraints(constraints);
textCursor().currentTable()->setFormat(tbforms);
}
}
}
qreal Layoutpainter
::Get_Cell_Width( QTextTableFormat TableFormat ,
int position
) {
qreal notfound = 0;
QVector<QTextLength> constraints = TableFormat.columnWidthConstraints();
for (int i = 0; i < constraints.size(); ++i) {
if (i == position) {
return langecell.rawValue();
}
}
}
return notfound;
}
void Layoutpainter::MergeCellByCursorPosition()
{
if (textCursor().currentTable()) {
textCursor().currentTable()->mergeCells(textCursor());
}
}
void Layoutpainter::RemoveCoolByCursorPosition()
{
if (textCursor().currentTable()) {
QTextTableCell existingcell
= textCursor
().
currentTable()->cellAt
(textCursor
());
int cellcoolcursoris = existingcell.column(); /* int value start from zero */
int cellrowcursoris = existingcell.row(); /* int value start from zero */
textCursor().currentTable()->removeColumns(cellcoolcursoris,1);
}
}
void Layoutpainter::RemoveRowByCursorPosition()
{
if (textCursor().currentTable()) {
QTextTableCell existingcell
= textCursor
().
currentTable()->cellAt
(textCursor
());
int cellcoolcursoris = existingcell.column(); /* int value start from zero */
int cellrowcursoris = existingcell.row(); /* int value start from zero */
textCursor().currentTable()->removeRows(cellrowcursoris,1);
}
}
void Layoutpainter::AppendTableRows()
{
bool ok = false;
if (textCursor().currentTable()) {
QTextTableCell existingcell
= textCursor
().
currentTable()->cellAt
(textCursor
());
int cellcoolcursoris = existingcell.column(); /* int value start from zero */
int cellrowcursoris = existingcell.row(); /* int value start from zero */
int approwtot
= QInputDialog::getInteger(0, tr
("Append NR. line row"),tr
("Row:"),
1,
1,
100,
1,
&ok
);
if (ok && approwtot > 0) {
textCursor().currentTable()->insertRows(cellrowcursoris + 1,approwtot);
}
}
}
void Layoutpainter::AppendTableCools()
{
bool ok = false;
if (textCursor().currentTable()) {
QTextTableCell existingcell
= textCursor
().
currentTable()->cellAt
(textCursor
());
int cellcoolcursoris = existingcell.column(); /* int value start from zero */
int cellrowcursoris = existingcell.row(); /* int value start from zero */
int appcooltot
= QInputDialog::getInteger(0, tr
("Table append Column"),tr
("Cool:"),
1,
1,
10,
1,
&ok
);
if (ok && appcooltot > 0) {
textCursor().currentTable()->insertColumns(cellcoolcursoris + 1,appcooltot);
}
}
}
void Layoutpainter::SetTableCellColor()
{
if (textCursor().currentTable()) {
bool ok;
QTextTableCell existingcell
= textCursor
().
currentTable()->cellAt
(textCursor
());
/* reformat this -> existingcell */
/* get color */
QColor col
= QColorDialog::getRgba(textCursor
().
currentTable()->cellAt
(textCursor
()).
format().
background().
color().
rgba(),
&ok,
0);
if (!col.isValid()) {
return;
}
existformat.setBackground(stylesin);
existingcell.setFormat(existformat);
}
}
void Layoutpainter::SetColumLarge()
{
if (textCursor().currentTable()) {
QTextTableCell existingcell = textCursor().currentTable()->cellAt(textCursor());
QTextTableFormat tbforms = textCursor().currentTable()->format();
int cellcoolcursoris = existingcell.column(); /* int value start from zero */
bool ok;
int LargeSet = QInputDialog::getInteger(0, tr("Set Cell Width"),
tr("Point Length:"),Get_Cell_Width(tbforms,cellcoolcursoris), 1, 2000, 1, &ok);
if (ok && LargeSet > 0) {
QVector<QTextLength> constraints = tbforms.columnWidthConstraints();
for (int i = 0; i < constraints.size(); ++i) {
if (i == cellcoolcursoris) {
constraints.replace(i,QTextLength(QTextLength::FixedLength, LargeSet));
}
}
tbforms.setColumnWidthConstraints(constraints);
textCursor().currentTable()->setFormat(tbforms);
}
}
}
qreal Layoutpainter::Get_Cell_Width( QTextTableFormat TableFormat , int position )
{
qreal notfound = 0;
QVector<QTextLength> constraints = TableFormat.columnWidthConstraints();
for (int i = 0; i < constraints.size(); ++i) {
if (i == position) {
QTextLength langecell = constraints.value(i);
if (langecell.type() == QTextLength::FixedLength) {
return langecell.rawValue();
}
}
}
return notfound;
}
void Layoutpainter::MergeCellByCursorPosition()
{
if (textCursor().currentTable()) {
textCursor().currentTable()->mergeCells(textCursor());
}
}
void Layoutpainter::RemoveCoolByCursorPosition()
{
if (textCursor().currentTable()) {
QTextTableCell existingcell = textCursor().currentTable()->cellAt(textCursor());
int cellcoolcursoris = existingcell.column(); /* int value start from zero */
int cellrowcursoris = existingcell.row(); /* int value start from zero */
textCursor().currentTable()->removeColumns(cellcoolcursoris,1);
}
}
void Layoutpainter::RemoveRowByCursorPosition()
{
if (textCursor().currentTable()) {
QTextTableCell existingcell = textCursor().currentTable()->cellAt(textCursor());
int cellcoolcursoris = existingcell.column(); /* int value start from zero */
int cellrowcursoris = existingcell.row(); /* int value start from zero */
textCursor().currentTable()->removeRows(cellrowcursoris,1);
}
}
void Layoutpainter::AppendTableRows()
{
bool ok = false;
if (textCursor().currentTable()) {
QTextTableCell existingcell = textCursor().currentTable()->cellAt(textCursor());
int cellcoolcursoris = existingcell.column(); /* int value start from zero */
int cellrowcursoris = existingcell.row(); /* int value start from zero */
int approwtot = QInputDialog::getInteger(0, tr("Append NR. line row"),tr("Row:"), 1, 1, 100, 1, &ok);
if (ok && approwtot > 0) {
textCursor().currentTable()->insertRows(cellrowcursoris + 1,approwtot);
}
}
}
void Layoutpainter::AppendTableCools()
{
bool ok = false;
if (textCursor().currentTable()) {
QTextTableCell existingcell = textCursor().currentTable()->cellAt(textCursor());
int cellcoolcursoris = existingcell.column(); /* int value start from zero */
int cellrowcursoris = existingcell.row(); /* int value start from zero */
int appcooltot = QInputDialog::getInteger(0, tr("Table append Column"),tr("Cool:"), 1, 1, 10, 1, &ok);
if (ok && appcooltot > 0) {
textCursor().currentTable()->insertColumns(cellcoolcursoris + 1,appcooltot);
}
}
}
void Layoutpainter::SetTableCellColor()
{
if (textCursor().currentTable()) {
bool ok;
QTextTableCell existingcell = textCursor().currentTable()->cellAt(textCursor());
/* reformat this -> existingcell */
QTextCharFormat existformat = existingcell.format();
/* get color */
QColor col = QColorDialog::getRgba(textCursor().currentTable()->cellAt(textCursor()).format().background().color().rgba(),&ok, 0);
if (!col.isValid()) {
return;
}
QBrush stylesin(col);
existformat.setBackground(stylesin);
existingcell.setFormat(existformat);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks