Important: Please read the Qt Code of Conduct -

Display text in main window on menu action trigger()

  • Hello,

    I'm brand new to Qt, but I've been following tutorials and have gotten this far. I'm trying to...have it so that when you click one of the menu items, it will display text about whatever you clicked on the main window, and clear it out when choosing another topic. The problem is I have NO idea how to make Qt do that. cout doesn't work lol. I can't seem to find a tutorial on it either. Any chance I could get some help? I can share source if needed.

    Here's where I'm stuck:

    void MainWindow::on_actionMajor_triggered()

    Here's a screenshot of what I have so far.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    To show something on the console when using Qt, you would usually call qDebug() << "Message"; Not that you can't use stdout or stderr, it's just the common practice.

    If you want to show a simple message, you can use e.g. a QLabel or QMainWindow's status bar depending on how you want to show your message.

    Hope it helps

Log in to reply