void Layoutpainter::CreateanewTable()
{
QString subtext, collx, rowx,largo;
bool ok;
int colonne
= QInputDialog::getInteger(0, tr
("New Table cool"),tr
("Cool:"),
3,
1,
10,
1,
&ok
);
int righe
= QInputDialog::getInteger(0, tr
("New Table row"),tr
("Row:"),
3,
1,
100,
1,
&ok
);
largo = "100%";
if (colonne > 0 && righe > 0) {
tables.clear();
tables.
append(QString("<table border=\"1\" align=\"left\" width=\"%1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#ffffff\">").
arg(largo
));
for (int i=0;i<righe;i++){
for (int o=0;o<colonne;o++){
tables.
append(QString("<td><p></p></td>"));
}
}
tables.
append(QString("</table>"));
subtext = tables.join("\n");
textCursor().insertFragment(fragment);
}
}
void Layoutpainter::CreateanewTable()
{
QString subtext, collx, rowx,largo;
bool ok;
int colonne = QInputDialog::getInteger(0, tr("New Table cool"),tr("Cool:"), 3, 1, 10, 1, &ok);
int righe = QInputDialog::getInteger(0, tr("New Table row"),tr("Row:"), 3, 1, 100, 1, &ok);
largo = "100%";
if (colonne > 0 && righe > 0) {
QStringList tables;
tables.clear();
tables.append(QString("<table border=\"1\" align=\"left\" width=\"%1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#ffffff\">").arg(largo));
for (int i=0;i<righe;i++){
tables.append(QString("<tr>"));
for (int o=0;o<colonne;o++){
tables.append(QString("<td><p></p></td>"));
}
tables.append(QString("</tr>"));
}
tables.append(QString("</table>"));
subtext = tables.join("\n");
QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(subtext);
textCursor().insertFragment(fragment);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks