Sto scrivendo il complicato editor di testo RTF derivato dalla classe QTextEdit
. Deve essere in grado di inserire, ridimensionare e applicare varie formattazioni alle tabelle incorporate.Come modificare l'altezza della riga in QTextTable
Ho trovato la funzione per impostare le larghezze delle colonne (setColumnWidthConstraints). Ma non c'è nessuno a change _rows_ heights
.
Esiste un modo per raggiungere questo obiettivo?
codice Esempio:
void CustomTextEdit::insertTable (int rows_cnt, int columns_cnt)
{
QTextCursor cursor = textCursor();
QTextTableFormat table_format;
table_format.setCellPadding (5);
// TODO: This call just changed the frame border height, not table itself.
//table_format.setHeight (50);
// Setup columns widths - all is working perfectly.
QVector <QTextLength> col_widths;
for (int i = 0; i < columns_cnt; ++i)
col_widths << QTextLength (QTextLength::PercentageLength, 100.0/columns_cnt);
table_format.setColumnWidthConstraints (col_widths);
// ...But there is no similar function as setRowHeighConstraints for rows!
// Insert our table with specified format settings
cursor.insertTable (rows_cnt, columns_cnt, table_format);
}
si potrebbe usare QTextFrameFormat :: setHeight (qreal height) –
@Cool_Coder Questo ha appena modificato l'altezza di _all_ il frame (cioè dove verrà mostrato il bordo). Ma ho bisogno di specificare l'altezza per ogni riga separata della tabella. – eraxillan
puoi mostrare qualche codice in modo che io possa commentarlo? –