Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Editing qlabel text after show dialog
Qt 6.11 is out! See what's new in the release blog

Editing qlabel text after show dialog

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bagipro
    wrote on last edited by
    #1

    I have a code
    @void Eng::show(int type,Words* w)
    {
    exec();
    ui->label1->setText("example text");
    //...
    }@

    But it doesn't work, but if i write

    @@void Eng::show(int type,Words* w)
    {
    ui->label1->setText("example text");
    exec();
    //...
    }@@

    All edits correctly, but i need to edit text after showing.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      exec will "block" until you close the dialog.

      So what would you like to achieve ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        exec() is a blocking call that waits for your dialog to close. So a call to setText after that does have an effect, it's just that the dialog is no longer visible.
        To edit the label you need to do it while the exec is still executing, either in any events of your dialog or via a signal/slot connection triggered by some action.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved