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. Unable to set the the text in statusbar
Forum Updated to NodeBB v4.3 + New Features

Unable to set the the text in statusbar

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 3.5k Views 2 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
    Durgesh
    wrote on 27 Jan 2020, 06:51 last edited by
    #1

    I am trying to display text in the status bar on hover of QAction using below code.
    Debug log is outputted but the text has not been set.
    Please suggested how to set the text in status bar area on QActionHover.

    This is connect function:-
    connect(ui->PoewControl_actionNew, &QAction::hovered, this, &MainWindow::showMessage);

    SlotDefination:-
    void MainWindow::showMessage()
    {
    qDebug()<<"MainWindow::showMessage";
    ui->statusbar->showMessage("showMessage");
    }

    J 1 Reply Last reply 27 Jan 2020, 08:26
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 27 Jan 2020, 07:06 last edited by SGaist
      #2

      Hi and welcome to devnet,

      Is MainWindow a QMainWindow ? If so, then you should only call statusBar()->showMessage("My message");. QMainWindow already has a status bar. will create the status bar the first time you call statusBar() unless you called setStatusBar with a custom one.

      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
      2
      • D Offline
        D Offline
        Durgesh
        wrote on 27 Jan 2020, 08:10 last edited by
        #3

        I have used "statusBar()->showMessage("some string ")" instead of "ui->statusbar->showMessage("showMessage")"
        but still, the text is not displayed in statusbar.

        1 Reply Last reply
        0
        • D Durgesh
          27 Jan 2020, 06:51

          I am trying to display text in the status bar on hover of QAction using below code.
          Debug log is outputted but the text has not been set.
          Please suggested how to set the text in status bar area on QActionHover.

          This is connect function:-
          connect(ui->PoewControl_actionNew, &QAction::hovered, this, &MainWindow::showMessage);

          SlotDefination:-
          void MainWindow::showMessage()
          {
          qDebug()<<"MainWindow::showMessage";
          ui->statusbar->showMessage("showMessage");
          }

          J Offline
          J Offline
          JKSH
          Moderators
          wrote on 27 Jan 2020, 08:26 last edited by
          #4

          @Durgesh said in Unable to set the the text in statusbar:

          Debug log is outputted

          Good, this shows that your slot is getting called successfully

          but the text has not been set.

          I suggest you connect the signal, QStatusBar::messageChanged(QString) to a slot for debugging -- print every message to qDebug().

          After you make the connection, call showMessage() directly to make sure the QStatusBar is being displayed correctly.

          Finally, the documentation might contain some clues: https://doc.qt.io/qt-5/qstatusbar.html#showMessage

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          2

          1/4

          27 Jan 2020, 06:51

          • Login

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