FET Forum

FET Development => Suggestions => Topic started by: GUEFFAZ ABDELKRIM on January 19, 2026, 09:30:01 AM

Title: preview the table
Post by: GUEFFAZ ABDELKRIM on January 19, 2026, 09:30:01 AM
(https://a.top4top.io/p_3671o4t681.png) (https://top4top.io/)
Title: Re: preview the table
Post by: Liviu Lalescu on January 19, 2026, 04:24:10 PM
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.
Title: Re: preview the table
Post by: GUEFFAZ ABDELKRIM on January 19, 2026, 04:47:33 PM
دائما الافكار تتحسن بالتطبيق . أكيد ستصل الى حل هذا الاقتراح .
Title: Re: preview the table
Post by: Volker Dirr on January 19, 2026, 05:24:08 PM
Aa ASCII art? Sounds fine. The "only" problem is, that the characters must have the same width or a font with non-proportional letters.
Title: Re: preview the table
Post by: Liviu Lalescu on January 19, 2026, 05:34:25 PM
Yes, art, but UTF, not ASCII. Maybe they have some nice colored Xs and 0s with same width. And also same frame lines.
Title: Re: preview the table
Post by: Volker Dirr on January 19, 2026, 05:41:16 PM
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.
Title: Re: preview the table
Post by: Liviu Lalescu on January 19, 2026, 05:44:36 PM
Great! (Volker)

@Darren McDonald , @g.theodoroy , @gradgrind , maybe you have ideas/suggestions? Or other forum/FET users?
Title: Re: preview the table
Post by: Liviu Lalescu on January 19, 2026, 06:22:16 PM
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?).
Title: Re: preview the table
Post by: g.theodoroy on January 19, 2026, 06:32:20 PM
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
------------------------------------------
Title: Re: preview the table
Post by: Liviu Lalescu on January 19, 2026, 06:39:02 PM
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.
Title: Re: preview the table
Post by: Volker Dirr on January 19, 2026, 06:49:41 PM
✓ or ✔ and ✗ or .
☒ and ☐
● and ○
★ and ☆
...

maybe select able in the setting.
Title: Re: preview the table
Post by: Liviu Lalescu on January 19, 2026, 06:55:50 PM
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).
Title: Re: preview the table
Post by: Liviu Lalescu on January 19, 2026, 07:23:29 PM
This is how it looks (attached screenshot):

How could we make the table more compact (there is too much space between the rows...)?
Title: Re: preview the table
Post by: Liviu Lalescu on January 19, 2026, 07:35:58 PM
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.

Title: Re: preview the table
Post by: Volker Dirr on January 19, 2026, 08:47:10 PM
TextEdit->setWordWrapMode(QTextOption::NoWrap);
Title: Re: preview the table
Post by: g.theodoroy on January 20, 2026, 06:42:38 AM


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>
Title: Re: preview the table
Post by: Liviu Lalescu on January 20, 2026, 07:44:10 AM
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.)
Title: Re: preview the table
Post by: g.theodoroy on January 20, 2026, 08:00:59 AM
Set value to &nbsp; (non-breaking space)


Or set width of <td> table cell for fixed width
Title: Re: preview the table
Post by: GUEFFAZ ABDELKRIM on January 20, 2026, 08:02:08 AM
(https://k.top4top.io/p_3672lggvp1.jpg) (https://top4top.io/)
Title: Re: preview the table
Post by: Liviu Lalescu on January 20, 2026, 08:08:49 AM
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?
Title: Re: preview the table
Post by: g.theodoroy on January 20, 2026, 08:21:19 AM
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">&nbsp;</td>
        <td width="5">&nbsp;</td>
        <td width="5">&nbsp;</td>
    </tr>
</table>


✔ width="5" works
✔ No CSS required
✔ Compatible with Qt rich text
Title: Re: preview the table
Post by: g.theodoroy on January 20, 2026, 08:29:43 AM
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">&nbsp;</td>
    <td width="5" bgcolor="green">&nbsp;</td>
    <td width="5" bgcolor="green">&nbsp;</td>
    <td width="5" bgcolor="green">&nbsp;</td>
    <td width="5" bgcolor="green">&nbsp;</td>
    <td width="5" bgcolor="green">&nbsp;</td>
  </tr>

    ...

</table>

🔍 Notes (Important for Qt)

    width="5" → Works

    font-size:3px → ❌ Ignored

    <font size="1"> → ✅ Smallest reliable font

    bgcolor → ✅ Supported

    &nbsp; → Prevents cell collapse

Qt does not support true 3px fonts, the minimum is roughly 6–7 px, depending on DPI.
Title: Re: preview the table
Post by: gradgrind on January 20, 2026, 08:38:35 AM
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.
Title: Re: preview the table
Post by: Liviu Lalescu on January 20, 2026, 09:00:00 AM
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?
Title: Re: preview the table
Post by: GUEFFAZ ABDELKRIM on January 20, 2026, 09:04:33 AM
nice
Title: Re: preview the table
Post by: Željko Vrabec on January 20, 2026, 10:28:11 AM
Hi guys!

It's really nice and useful feature! Liviu I'm very pleased with your OS :)
Title: Re: preview the table
Post by: Liviu Lalescu on January 20, 2026, 10:32:56 AM
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?
Title: Re: preview the table
Post by: GUEFFAZ ABDELKRIM on January 20, 2026, 10:37:10 AM
بعد التجربة أخي ليفيو ;D  ;D  ;D
Title: Re: preview the table
Post by: Liviu Lalescu on January 20, 2026, 02:40:48 PM
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.
Title: Re: preview the table
Post by: Liviu Lalescu on January 20, 2026, 08:01:12 PM
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!  :)
Title: Re: preview the table
Post by: Liviu Lalescu on January 22, 2026, 03:38:58 PM
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!