Important: Please read the Qt Code of Conduct -

Problem when new an object in slot

  • hi guys,

    i wanna new a QLabel in a slot, and add it into another QWidget.
    but the QLabel didn't work, the problem is that, the text and image can not be displayed.
    i remember that, it's unavalable to new object in slot. if so, how can i solve this problem?
    i wanna add a QLabel when the signal is emited, do u guys have any good solution?

  • Moderators

    Fist good step is to show us your code. Then explain what you mean by "the text and image cannot be displayed" - so QLabel is created without errors, but not displayed? Also, what is this bit about unavailability?

    You would be better off adding the new QLabel into a QLayout, not QWidget, too.

Log in to reply