Using QTextEdit and html to display formatted log-text - c++

I need to display a large (and increasing) log-file with QTextEdit (alternatively with QTextBrowser, must be one of those 2, though) and format the output in 3 columns with following properties:
1. column: text top-right aligned, fixed width, always 1 line (height depends on 2. column)
2. column: text left aligned, dynamic width (scales with window size), can be multiline with "wordbreak" (height depending on lines of text), can contain clickable URLs
3. column: text top-left aligned, fixed width, always 1 line (height depends on 2. column)
Is there somehow a way to use QTextEdit html markup (or something else, maybe) to achieve this and then simply append new log entries whenever necessary without recreating everything?
As a picture often says more than a thousand words I added an image of how I think it should look:

Related

Combine elided and word wrap on qt

I am using a QLabel to show a text, and setting to word wrap property true, to show my text in lines when the size of the grid is smaller than the size of the text. But some words, when I define the minimum size to the grid, don't show all the letters.
Can I use Elided combined with word wrap property from QLabel?

How to make fixed width of column with Helvetica font?

Usually, I use iomanip and setw to make a column with a fixed width for output.
But it seems to be that it doesn't work with Helvetica font.
What to do with it here?
Helvetica is a proportional font which means that the letters have different widths.
BTW, for most GUIs, you'll need something more specialized than std::cout.
In order to make a fixed width column you will need to pad to get to the next column. This means adding up the widths of the characters and the spacing. Subtract this from the column width and this becomes your padding.
Many GUIs have functions for determining the pixel widths of a string of text.
An easier route, IMHO, is to use a grid type widget in your GUI. These have column capabilities that can be adjusted. Some have functions that will resize a column based on its contents. You only need to put the text into that column.
Another GUI technique is to use vertical "boxes" (sizers) for each column. Place your text into the box. Let the box figure out its alignment and padding.

How can you display rows in 'dynamic' sizes using tableview of Corona SDK

I am using tableview to display a list of items
e.g.
list =
[
{name='bob',
description='really long description that can be multiple rows',
image='an image from my server',
},
...
]
the above is just an example. I got my data from my server, including images of variable sizes. My question is how do I display the correct row size(height) once I got image from the server. I understand that I can wait until all data and image has been downloaded from server. Then precompute the height. But I want to be able to display the text first (as texts are more likely to be firstly downloaded), then once there is an image in it, I download it again. After the image is downloaded, I want to resize the row height. How can I do that?
Create a multi-line display.newText() of the width you expect to put in the table view. When the object is created, grab it's height and then remove the object. Use that height + some padding for the row height. There may be performance issues with this, so as an alternate, keep the text object and pass it in as a parameter when you create the row.

Wrap text around the image

Can a list of Label objects and picture be aligned such a way that if the label has space in the right side it should make use of the full length before wrapping to the next line.
This is because of that fact that I may not have pictures of full height of the pane always.
For shorter images I want to make use of the space at the bottom.Note that the text is a nodelist of label nodes.

How to resize width of columns to data and stretch the last section together in Qt TableView

Anyone knows how to fit the column width to the data in a TableView and then stretch the final column to the size remaining on the widget?
I've tried:
_ui->tableView->resizeColumnsToContents();
_ui->tableView->horizontalHeader()->setStretchLastSection(true);
But only the resizeColumnToContent() work. The last section is unstretched.
Is it even possible without having to dynamically calculate the width manually?
Nethermind. For prosperity here's the solution:
_ui->tableView->resizeColumnsToContents();
_ui->tableView->horizontalHeader()->setSectionResizeMode( 3, QHeaderView::Stretch );
In this case the last column is 3.