Important: Please read the Qt Code of Conduct -

Tab stop width in Qt text object

  • Hi everybody,

    It's been few days I'm working around how to modify tab stop width and set it in a QLabel object.
    Searching in the forum and in Google, really few posts could be found about it, but what I've learned is that QLabel is not the best object to use for this purpose, maybe it could be a better idea using QTextEdit, even if it much more than I need (just display one line of text).

    So, to explain my purpose, I just want to read text from a Xml file and write it in a label that will be displayed in the UI. In the text there could be an escape character like '\t', so my application knows it has to put a tab spacing at that point, in a manner that on the left there is the "label id" and on the right the specific "value" of the label; something like this:

                                   label1_Model                  Model_ABCD
                                   label2_Id                     Serial
                                   label3_Rev                    0.00

    Any idea of what could be the best way to do that?

    Many thanks

Log in to reply