Home · Modules · Classes · Namespaces · Functions

QxtConfirmationMessage Class Reference
[QxtGui module]

The QxtConfirmationMessage class provides a confirmation message. More...

    #include <QxtConfirmationMessage>

Inherits QMessageBox.

Public Functions

Public Slots

Static Public Members

Additional Inherited Members


Detailed Description

The QxtConfirmationMessage class provides a confirmation message.

QxtConfirmationMessage is a confirmation message with checkable "Do not show again." option. A checked and accepted confirmation message is no more shown until reseted.

Example usage:

    void MainWindow::closeEvent(QCloseEvent* event)
    {
        static const QString text(tr("Are you sure you want to quit?"));
        if (QxtConfirmationMessage::confirm(this, tr("Confirm"), text) == QMessageBox::No)
            event->ignore();
    }

"QxtConfirmationMessage in action."

Note: QCoreApplication::organizationName and QCoreApplication::applicationName are used for storing settings. In case these properties are empty, "QxtGui" and "QxtConfirmationMessage" are used, respectively.


Member Function Documentation

QxtConfirmationMessage::QxtConfirmationMessage ( QWidget * parent = 0 )

Constructs a new QxtConfirmationMessage with parent.

QxtConfirmationMessage::QxtConfirmationMessage ( QMessageBox::Icon icon, const QString & title, const QString & text, const QString & confirmation = QString(), QMessageBox::StandardButtons buttons = QMessageBox::NoButton, QWidget * parent = 0, Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint )

Constructs a new QxtConfirmationMessage with icon, title, text, confirmation, buttons, parent and flags.

QxtConfirmationMessage::~QxtConfirmationMessage ()   [virtual]

Destructs the confirmation message.

QMessageBox::StandardButton QxtConfirmationMessage::confirm ( QWidget * parent, const QString & title, const QString & text, const QString & confirmation = QString(), QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton )   [static]

Opens an confirmation message box with the specified title, text and confirmation. The standard buttons are added to the message box. defaultButton specifies the button used when Enter is pressed. defaultButton must refer to a button that was given in buttons. If defaultButton is QMessageBox::NoButton, QMessageBox chooses a suitable default automatically.

Returns the identity of the standard button that was clicked. If Esc was pressed instead, the escape button is returned.

If parent is 0, the message box is an application modal dialog box. If parent is a widget, the message box is window modal relative to parent.

QString QxtConfirmationMessage::confirmationText () const

See also setConfirmationText().

int QxtConfirmationMessage::exec ()   [slot]

Shows the confirmation message if necessary. The confirmation message is not shown in case "Do not show again." has been checked while the same confirmation message was earlierly accepted.

A confirmation message is identified by the combination of title, QMessageBox::text and optional QMessageBox::informativeText.

A clicked button with role QDialogButtonBox::AcceptRole or QDialogButtonBox::YesRole is considered as "accepted".

Warning: This function does not reimplement but shadows QMessageBox::exec().

See also QWidget::windowTitle, QMessageBox::text, and QMessageBox::informativeText.

QString QxtConfirmationMessage::overrideSettingsApplication () const

See also setOverrideSettingsApplication().

QString QxtConfirmationMessage::overrideSettingsKey () const

See also setOverrideSettingsKey().

QString QxtConfirmationMessage::overrideSettingsOrganization () const

See also setOverrideSettingsOrganization().

bool QxtConfirmationMessage::rememberOnReject () const

See also setRememberOnReject().

void QxtConfirmationMessage::reset ()   [slot]

Resets this instance of QxtConfirmationMessage. A reseted confirmation message is shown again until user checks "Do not show again." and accepts the confirmation message.

void QxtConfirmationMessage::setConfirmationText ( const QString & confirmation )

See also confirmationText().

void QxtConfirmationMessage::setOverrideSettingsApplication ( const QString & application )

See also overrideSettingsApplication().

void QxtConfirmationMessage::setOverrideSettingsKey ( const QString & key )

See also overrideSettingsKey().

void QxtConfirmationMessage::setOverrideSettingsOrganization ( const QString & organization )

See also overrideSettingsOrganization().

void QxtConfirmationMessage::setRememberOnReject ( bool remember )

See also rememberOnReject().

void QxtConfirmationMessage::setSettingsFormat ( QSettings::Format format )   [static]

Sets the format used for storing settings.

See also settingsFormat().

void QxtConfirmationMessage::setSettingsPath ( const QString & path )   [static]

Sets the path used for storing settings.

See also settingsPath().

void QxtConfirmationMessage::setSettingsScope ( QSettings::Scope scope )   [static]

Sets the scope used for storing settings.

See also settingsScope().

QSettings::Format QxtConfirmationMessage::settingsFormat ()   [static]

Returns The format used for storing settings.

The default value is QSettings::NativeFormat.

QString QxtConfirmationMessage::settingsPath ()   [static]

Returns the path used for storing settings.

The default value is an empty string.

QSettings::Scope QxtConfirmationMessage::settingsScope ()   [static]

Returns The scope used for storing settings.

The default value is QSettings::UserScope.


Copyright © 2007-2011 Qxt Foundation
Qxt 0.6.2