私は、QTextEdit
クラスから派生した複雑なリッチテキストエディタを作成しています。埋め込みテーブルにさまざまな書式を挿入、サイズ変更、および適用することができる必要があります。QTextTableで行の高さを変更する方法
設定列幅(setColumnWidthConstraints)の機能が見つかりました。 しかし、change _rows_ heights
には誰もいません。
これを達成する方法はありますか?
例コード:
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);
}
あなたは(QTextFrameFormat :: setHeightメソッドを使用することができます –
@Cool_Coderこれはフレームの高さを変更しました(つまり、枠線が表示される場所)。しかし、私はテーブルの別の行の高さを指定する必要があります。 – eraxillan
私はそれにコメントすることができるようにいくつかのコードを表示してくださいできますか? –