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. QMessageBox without Button
Forum Updated to NodeBB v4.3 + New Features

QMessageBox without Button

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 819 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.
  • nadimnadafN Offline
    nadimnadafN Offline
    nadimnadaf
    wrote on last edited by
    #1

    Hi @all,
    I used a QMessageBox but it add a button OK default

    QMessageBox msgBox;
    msgBox.setText("Updating Orb List...");
    msgBox.setStyleSheet("QDialog { border: 1px solid black;}");
    QTimer::singleShot(15000, &msgBox, SLOT(close()));
    msgBox.exec();
    

    I used this setStandardButtons(0); but it stuck. doesn't close a msgBox

    QMessageBox msgBox;
    msgBox.setText("Updating Orb List...");
    msgBox.setStyleSheet("QDialog { border: 1px solid black;}");
    msgBox.setStandardButtons(0);
    QTimer::singleShot(15000, &msgBox, SLOT(close()));
    msgBox.exec();
    

    Any Ideas?

    Thanks,
    Nadim

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

      Use accept instead of close. Also it's better to use predefined constants instead of magic numbers.

      msgBox.setStandardButtons(QMessageBox::NoButton);
      QTimer::singleShot(15000, &msgBox, &QMessageBox::accept);
      
      1 Reply Last reply
      2
      • nadimnadafN Offline
        nadimnadafN Offline
        nadimnadaf
        wrote on last edited by
        #3

        Thanks @Chris-Kawa. It Works as expect.

        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