Strange QMessageBox output



  • 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...



  • 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;
    }
    


  • Found. Just need to set minimum size for widget.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.