Important: Please read the Qt Code of Conduct -

QPlainTextEdit autoExpand & checkbox signal/slot

  • Hi community !

    Today I have 2 questions !

    • the first one is about QPlainTextEdit but I think it could be applied on other widgets.
      I would like to auto expand the widget when I add lines instead of having the scroll bar displaying. I can't find any option in the attributes to do that. I would love to avoid a line of code just by clicking on a checkbox in the attributes ^_^

    • the second one is about hiding/showing a widget via a QCheckBox or QPushButton.
      I have found that by connecting a toggled(bool) signal to the setHidden() slot of my widget would hide/show when checking the QcheckBox.
      But If I want a QPushButton to drive the show/hide state of my widget then the toggled signal doesn't work ...

    Thx !

  • Lifetime Qt Champion


    1. AFAIK, you have to do the expansion yourself
    2. You can connect your checkbox to the setVisible slot

    Hope it helps

  • I have found for the second one. If I want to drive the show/hide state with a QPushButton, i need the active the checkable state of the QPushButton.

    and for the expansion, that sucks that they don't have a simple attribute to allow it... that would be very handy.
    I will have a look on how I can write this expansion thing.

    Thx !

Log in to reply