(https://a.top4top.io/p_3671o4t681.png) (https://top4top.io/)
Dear GUEFFAZ, and
@Volker Dirr , and
@Vangelis Karafillidis , and to everybody: it is a good suggestion. I'll think of it. But what do you think if we could simply list a small text matrix of X's and O's? Or we could use some nice UTF-8 special characters? Suggestions?
The thing is that drawing the complete table is not in my experience, is complicated, and the table might be too large.
دائما الافكار تتحسن بالتطبيق . أكيد ستصل الى حل هذا الاقتراح .
Aa ASCII art? Sounds fine. The "only" problem is, that the characters must have the same width or a font with non-proportional letters.
Yes, art, but UTF, not ASCII. Maybe they have some nice colored Xs and 0s with same width. And also same frame lines.
Yes, UTF-8 characters of course. (But I never heard the term "UTF-ART". Other guys always call it only "ASCII-Art".)
I think that is a good variant.
Great! (Volker)
@Darren McDonald ,
@g.theodoroy ,
@gradgrind , maybe you have ideas/suggestions? Or other forum/FET users?
We might need to have two sets of symbols: without colors, and with colors, and this setting will be the one that the user chose when adding the constraints (or when modifying?).
You dont need to "invent wheel" once more !!!
You have data (D1H1.D2H1...)
You have ui in another form (QtableWidget)
Just conditionally show QtableWidget (only view - not edit)
-------------------------------------------
checkboxes QtextWidget
QtextWidget
QListWidget QtextWidget
QListWidget QtextWidget
QListWidget QtextWidget
QListWidget QtextWidget
QListWidget
QListWidget QtableWidget
QListWidget QtableWidget
QListWidget QtableWidget
Buttons Buttons Buttons Buttons
------------------------------------------
You are right, George, but:
- that table needs to be shown scaled down, and I am not sure how to do that;
- the text of the constraint might be useful to be copy/pasted, like for instance if the user wants to print all time constraints and uses this trick: selects all constraints, Remove, and copy/paste that text.
✓ or ✔ and ✗ or .
☒ and ☐
● and ○
★ and ☆
...
maybe select able in the setting.
Great! I think the second (squares) is suitable for not available times and preferred times. For selection of slots, maybe the circles (are they the same size?). Or, do they have a square with a check box in it?
We might also need a horizontal line and a vertical one (for a big square around the whole table and to divide a day in the Mornings-Afternoons mode).
This is how it looks (attached screenshot):
How could we make the table more compact (there is too much space between the rows...)?
Hmm... not so easy if there are many days... we get a wraparound...
It is possible to deactivate the wraparound - would that be a solution? But note that all the text of the detailed description of the constraint will not wrap around anymore, so you might need to scroll.
TextEdit->setWordWrapMode(QTextOption::NoWrap);
In Qt documentation
----------------------------------------
Quotehttps://doc.qt.io/qt-6/richtext-html-subset.html
Widgets automatically detect HTML markup and display rich text accordingly. For example, setting a label's text property with the string "<b>Hello</b> <i>Qt!</i>" will result in the label displaying text like this: Hello Qt!
When HTML markup is used for text, Qt follows the rules defined by the HTML 4 specification. This includes default properties for text layout, such as the direction of the text flow (left-to-right) which can be changed by applying the dir attribute to blocks of text.
---------------------------
Create html table as text of Qtextwidget
<table>
<tr>
<td bgcolor="red">X</td><td bgcolor="green"></td>
/tr>
</table>
Thank you, George! I was also thinking of this, but was uncertain.
How can I ensure the size of an empty cell? (see attached screenshot.)
Set value to (non-breaking space)
Or set width of <td> table cell for fixed width
(https://k.top4top.io/p_3672lggvp1.jpg) (https://top4top.io/)
Dear GUEFFAZ,
As Volker said, we would like better to just show a smaller table. I am not sure I can code a smaller preview of the exact table. We'll try this way, and if you won't like it we might try your suggestion.
Dear George, how to set the minimum/fixed width, for X and for empty? I would prefer also not to write in each cell, but only once for the whole table, is that possible?
from ChatGpt
query:
create table with cell width 5px for Qttextwidget
answer:
Best Working Solution (Use fixed-width table + column width)
Qt supports table formatting via HTML attributes, not CSS.
Example HTML for QTextEdit::setHtml():
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="5"> </td>
<td width="5"> </td>
<td width="5"> </td>
</tr>
</table>
✔ width="5" works
✔ No CSS required
✔ Compatible with Qt rich text
chatgpt query 2
create table with cell width 5px font-size 3px a colymn with value x , bgcolor red and six columns with nbsp bgcolor green and 7 rows for Qttextwidget
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5" bgcolor="red" align="center">
<font size="1">x</font>
</td>
<td width="5" bgcolor="green"> </td>
<td width="5" bgcolor="green"> </td>
<td width="5" bgcolor="green"> </td>
<td width="5" bgcolor="green"> </td>
<td width="5" bgcolor="green"> </td>
<td width="5" bgcolor="green"> </td>
</tr>
...
</table>
🔍 Notes (Important for Qt)
width="5" → Works
font-size:3px → ❌ Ignored
<font size="1"> → ✅ Smallest reliable font
bgcolor → ✅ Supported
→ Prevents cell collapse
Qt does not support true 3px fonts, the minimum is roughly 6–7 px, depending on DPI.
Thinking a bit further ...
If you were very ambitious you could use a QTextBrowser instead of a QTextEdit with an HTML table and use links in the cells, so that you could even edit the table:
- use something like #2_3 (coordinates) for the links,
- use images for the on/off cells,
- connect a change-state function to the QTextBrowser::anchorClicked signal,
- rewrite the HTML to reflect the change.
In this case images are perhaps better than text because the link would fill the whole cell, which might not be the case with text.
Hmm, Michael, it is more complicated; also, we just want a preview here, because it is easy to double-click on the constraint to edit it.
George, thank you! I followed some of these advice and I attach a screenshot (width=20). Looking really nice, isn't it?
nice
Hi guys!
It's really nice and useful feature! Liviu I'm very pleased with your OS :)
Thanks for your answers! :)
I am adding for all time constraints now, and with optional colors.
The table is nice? The width of the cells is 20. Is OK, or should be smaller or larger?
بعد التجربة أخي ليفيو ;D ;D ;D
Still working, I have some more work, but it is working out nicely. And now that we have beautiful constraints, I plan a feature to show the whole file in human readable form in a QTextEdit.
I will now take a few hours break, because of other places to go and because a break is needed, and hopefully continue later today. I'll let you know.
I concluded a working day. It is mostly done, but things remain. Maybe in 24 hours from now we'll have a snapshot, or maybe later.
Thank you! :)
The new snapshot is available. Please see the snapshot announcement: https://lalescu.ro/liviu/fet/forum/index.php?topic=6733.0
Thank everybody for the suggestions!