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. I want to show a variable in the QStatusBar after calling a funtion

I want to show a variable in the QStatusBar after calling a funtion

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 324 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.
  • D Offline
    D Offline
    developer_96
    wrote on last edited by
    #1

    Hello,
    i want to show a variable in the QStatusBar which is given from a function. Do you know how ?

    For Example i have a function:

    int numer()
    {
    int f = 1;
    return f;
    }
    

    Now i want to call this function and show the variable in the status bar like :

    f4f7a0ee-1d0a-4fb6-99b9-cccf4a6853b0-grafik.png

    Do you know how to solve that?
    Regards

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

      Hi,

      Use QStatusBar::showMessage.

      statusBar->showMessage(QString("Number = %1").arg(numer()));
      

      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
      4
      • D Offline
        D Offline
        developer_96
        wrote on last edited by
        #3

        thank you @SGaist and how it would be with more variables?

        jsulmJ 1 Reply Last reply
        0
        • D developer_96

          thank you @SGaist and how it would be with more variables?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @developer_96 Like documented https://doc.qt.io/qt-5/qstring.html#arg

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

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