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. Strange QMessageBox output
QtWS25 Last Chance

Strange QMessageBox output

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 1 Posters 387 Views
  • 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.
  • EngelardE Offline
    EngelardE Offline
    Engelard
    wrote on last edited by Engelard
    #1

    I just started with that feature of Qt, my code is dumb simple as a rock, but every time function with my MessageBox is called, it throw some strange output what i can't rly understand, whats wrong?

    alt text

    And app working fine, even msgBox workout well after clicking buttons and all.

    P.S. how can i set my close crest icon enabled? There is no buttons i have with ::NoRole, so that thing at top-right angle of MessageBox is always disabled, but i would like set some custom action on it(without adding another button).

    P.P.S. setWindowFlags(Qt::WindowCloseButtonHint); do nothing, don't helped at all. And i hoped that .exec(); might return something special for closed action, but didn't find such stuff. +as i said close button disabled so...

    1 Reply Last reply
    0
    • EngelardE Offline
      EngelardE Offline
      Engelard
      wrote on last edited by
      #3

      Found. Just need to set minimum size for widget.

      1 Reply Last reply
      1
      • EngelardE Offline
        EngelardE Offline
        Engelard
        wrote on last edited by Engelard
        #2

        Ah, forgot code, here is it:

        QMessageBox actReset;
        actReset.setIcon(QMessageBox::Question);
        actReset.setInformativeText("your selected actions will be changed after scan. "
                                    "Reset or keep it?");
        QAbstractButton *ys = actReset.addButton("reset by scan results", QMessageBox::ResetRole);
        QAbstractButton *no = actReset.addButton("keep my actions", QMessageBox::YesRole);
        
        int ex = actReset.exec();
        
        if(actReset.clickedButton() == ys)
        {
            ui->textBrowser1->append("reseting");
        }
        else if(actReset.clickedButton() == no)
        {
            ui->textBrowser1->append("keep actions!");
        }
        else
        {
            ui->textBrowser1->append("something went wrong");
            return;
        }
        
        1 Reply Last reply
        0
        • EngelardE Offline
          EngelardE Offline
          Engelard
          wrote on last edited by
          #3

          Found. Just need to set minimum size for widget.

          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