Qt 4.8
Classes | Enumerations | Functions
qmessagebox.cpp File Reference
#include <QtGui/qmessagebox.h>
#include <QtGui/qdialogbuttonbox.h>
#include "private/qlabel_p.h"
#include "private/qapplication_p.h"
#include <QtCore/qlist.h>
#include <QtCore/qdebug.h>
#include <QtGui/qstyle.h>
#include <QtGui/qstyleoption.h>
#include <QtGui/qgridlayout.h>
#include <QtGui/qdesktopwidget.h>
#include <QtGui/qpushbutton.h>
#include <QtGui/qaccessible.h>
#include <QtGui/qicon.h>
#include <QtGui/qtextdocument.h>
#include <QtGui/qapplication.h>
#include <QtGui/qtextedit.h>
#include <QtGui/qtextbrowser.h>
#include <QtGui/qmenu.h>
#include "qdialog_p.h"
#include <QtGui/qfont.h>
#include <QtGui/qfontmetrics.h>
#include <QtGui/qclipboard.h>
#include <qs60style.h>
#include "qguifunctions_wince.h"
#include "moc_qmessagebox.cpp"

Go to the source code of this file.

Classes

class  DetailButton
 
class  QMessageBoxDetailsText
 
class  QMessageBoxDetailsText::TextEdit
 
class  QMessageBoxPrivate
 

Enumerations

enum  Button {
  Old_Ok = 1, Old_Cancel = 2, Old_Yes = 3, Old_No = 4,
  Old_Abort = 5, Old_Retry = 6, Old_Ignore = 7, Old_YesAll = 8,
  Old_NoAll = 9, Old_ButtonMask = 0xFF, NewButtonMask = 0xFFFFFC00, None = 0x000,
  Keyboard = 0x001, Mouse = 0x002, Wheel = 0x004, ButtonMask = 0x008,
  Up = 0x010, Down = 0x020, DirectionMask = 0x040
}
 
enum  DetailButtonLabel { ShowLabel = 0, HideLabel = 1 }
 

Functions

static bool detectedCompat (int button0, int button1, int button2)
 
static QMessageBox::StandardButton newButton (int button)
 
static int oldButton (int button)
 
bool qt_wince_is_mobile ()
 
bool qt_wince_is_pocket_pc ()
 
bool qt_wince_is_smartphone ()
 
static QMessageBox::StandardButton showNewMessageBox (QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
 

Enumeration Type Documentation

◆ Button

enum Button
Enumerator
Old_Ok 
Old_Cancel 
Old_Yes 
Old_No 
Old_Abort 
Old_Retry 
Old_Ignore 
Old_YesAll 
Old_NoAll 
Old_ButtonMask 
NewButtonMask 
None 
Keyboard 
Mouse 
Wheel 
ButtonMask 
Up 
Down 
DirectionMask 

Definition at line 82 of file qmessagebox.cpp.

◆ DetailButtonLabel

Enumerator
ShowLabel 
HideLabel 

Definition at line 86 of file qmessagebox.cpp.

Function Documentation

◆ detectedCompat()

static bool detectedCompat ( int  button0,
int  button1,
int  button2 
)
static

Definition at line 1947 of file qmessagebox.cpp.

Referenced by QMessageBoxPrivate::addOldButtons().

1948 {
1949  if (button0 != 0 && !(button0 & NewButtonMask))
1950  return true;
1951  if (button1 != 0 && !(button1 & NewButtonMask))
1952  return true;
1953  if (button2 != 0 && !(button2 & NewButtonMask))
1954  return true;
1955  return false;
1956 }

◆ newButton()

static QMessageBox::StandardButton newButton ( int  button)
static

Definition at line 1914 of file qmessagebox.cpp.

Referenced by QMessageBoxPrivate::abstractButtonForId(), QMessageBoxPrivate::addOldButtons(), QWindowsMobileStyle::drawControl(), and QMessageBoxPrivate::findButton().

1915 {
1916  // this is needed for source compatibility with Qt 4.0 and 4.1
1917  if (button == QMessageBox::NoButton || (button & NewButtonMask))
1919 
1920 #if QT_VERSION < 0x050000
1921  // this is needed for binary compatibility with Qt 4.0 and 4.1
1922  switch (button & Old_ButtonMask) {
1923  case Old_Ok:
1924  return QMessageBox::Ok;
1925  case Old_Cancel:
1926  return QMessageBox::Cancel;
1927  case Old_Yes:
1928  return QMessageBox::Yes;
1929  case Old_No:
1930  return QMessageBox::No;
1931  case Old_Abort:
1932  return QMessageBox::Abort;
1933  case Old_Retry:
1934  return QMessageBox::Retry;
1935  case Old_Ignore:
1936  return QMessageBox::Ignore;
1937  case Old_YesAll:
1938  return QMessageBox::YesToAll;
1939  case Old_NoAll:
1940  return QMessageBox::NoToAll;
1941  default:
1942  return QMessageBox::NoButton;
1943  }
1944 #endif
1945 }
StandardButton
These enums describe flags for standard buttons.
Definition: qmessagebox.h:100

◆ oldButton()

static int oldButton ( int  button)
static

Definition at line 436 of file qmessagebox.cpp.

Referenced by QMessageBoxPrivate::execReturnCode(), and QWizard::setButton().

437 {
438  switch (button & QMessageBox::ButtonMask) {
439  case QMessageBox::Ok:
440  return Old_Ok;
441  case QMessageBox::Cancel:
442  return Old_Cancel;
443  case QMessageBox::Yes:
444  return Old_Yes;
445  case QMessageBox::No:
446  return Old_No;
447  case QMessageBox::Abort:
448  return Old_Abort;
449  case QMessageBox::Retry:
450  return Old_Retry;
451  case QMessageBox::Ignore:
452  return Old_Ignore;
454  return Old_YesAll;
456  return Old_NoAll;
457  default:
458  return 0;
459  }
460 }

◆ qt_wince_is_mobile()

bool qt_wince_is_mobile ( )

Definition at line 296 of file qguifunctions_wince.cpp.

296  {
298 }
bool qt_wince_is_pocket_pc()
bool qt_wince_is_smartphone()

◆ qt_wince_is_pocket_pc()

bool qt_wince_is_pocket_pc ( )

Definition at line 289 of file qguifunctions_wince.cpp.

289  {
290  return qt_wince_is_platform(QString::fromLatin1("PocketPC"));
291 }
bool qt_wince_is_platform(const QString &platformString)
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188

◆ qt_wince_is_smartphone()

bool qt_wince_is_smartphone ( )

Definition at line 293 of file qguifunctions_wince.cpp.

293  {
294  return qt_wince_is_platform(QString::fromLatin1("Smartphone"));
295 }
bool qt_wince_is_platform(const QString &platformString)
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188

◆ showNewMessageBox()

static QMessageBox::StandardButton showNewMessageBox ( QWidget parent,
QMessageBox::Icon  icon,
const QString title,
const QString text,
QMessageBox::StandardButtons  buttons,
QMessageBox::StandardButton  defaultButton 
)
static

Definition at line 1573 of file qmessagebox.cpp.

Referenced by QMessageBox::critical(), QMessageBox::information(), QMessageBoxPrivate::QMessageBoxPrivate(), QMessageBox::question(), and QMessageBox::warning().

1578 {
1579  // necessary for source compatibility with Qt 4.0 and 4.1
1580  // handles (Yes, No) and (Yes|Default, No)
1581  if (defaultButton && !(buttons & defaultButton))
1583  QMessageBoxPrivate::showOldMessageBox(parent, icon, title,
1584  text, int(buttons),
1585  int(defaultButton), 0);
1586 
1587  QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent);
1588  QDialogButtonBox *buttonBox = msgBox.findChild<QDialogButtonBox*>();
1589  Q_ASSERT(buttonBox != 0);
1590 
1592  while (mask <= QMessageBox::LastButton) {
1593  uint sb = buttons & mask;
1594  mask <<= 1;
1595  if (!sb)
1596  continue;
1597  QPushButton *button = msgBox.addButton((QMessageBox::StandardButton)sb);
1598  // Choose the first accept role as the default
1599  if (msgBox.defaultButton())
1600  continue;
1601  if ((defaultButton == QMessageBox::NoButton && buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
1602  || (defaultButton != QMessageBox::NoButton && sb == uint(defaultButton)))
1603  msgBox.setDefaultButton(button);
1604  }
1605  if (msgBox.exec() == -1)
1606  return QMessageBox::Cancel;
1607  return msgBox.standardButton(msgBox.clickedButton());
1608 }
static Qt::MouseButtons buttons
The QMessageBox class provides a modal dialog for informing the user or for asking the user a questio...
Definition: qmessagebox.h:59
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
unsigned int uint
Definition: qglobal.h:996
T findChild(const QString &aName=QString()) const
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object.
Definition: qobject.h:158
ButtonRole buttonRole(QAbstractButton *button) const
Returns the button role for the specified button.
The QDialogButtonBox class is a widget that presents buttons in a layout that is appropriate to the c...
StandardButton
These enums describe flags for standard buttons.
Definition: qmessagebox.h:100