54 #include "private/qdialog_p.h" 55 #ifndef QT_NO_ACCESSIBILITY 58 #if defined(Q_WS_WINCE) 65 #elif defined(Q_WS_X11) 66 # include "../kernel/qt_x11_p.h" 67 #elif defined(Q_OS_SYMBIAN) 71 # include "private/qt_s60_p.h" 72 #elif defined(Q_OS_BLACKBERRY) 80 #ifndef SPI_GETSNAPTODEFBUTTON 81 # define SPI_GETSNAPTODEFBUTTON 95 278 if (S60->avkonComponentsSupportTransparency) {
315 if (S60->avkonComponentsSupportTransparency) {
351 bool hasMain =
false;
353 for (
int i=0; i<list.
size(); ++i) {
358 if (pb != pushButton)
362 if (!pushButton && hasMain)
363 mainDef->setDefault(
true);
365 mainDef = pushButton;
379 setDefault(pushButton);
394 for (
int i=0; i<list.
size(); ++i) {
411 resetModalityTo = -1;
414 #if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) 416 void QDialogPrivate::_q_doneAction()
434 #elif defined(Q_WS_S60) 498 d->resetModalityTo = modality;
529 qWarning(
"QDialog::exec: Recursive call detected");
536 d->resetModalitySetByOpen();
544 #ifndef QT_NO_MENUBAR 546 if (!findChild<QMenuBar *>())
553 #endif //QT_NO_MENUBAR 554 #endif //Q_WS_WINCE_WM 556 bool showSystemDialogFullScreen =
false;
559 if (qobject_cast<QFileDialog *>(
this) || qobject_cast<QFontDialog *>(
this) ||
560 qobject_cast<QWizard *>(
this)) {
561 showSystemDialogFullScreen =
true;
563 #endif // Q_OS_SYMBIAN 565 #ifdef Q_OS_BLACKBERRY 566 if (!qobject_cast<QMessageBox *>(
this))
567 showSystemDialogFullScreen =
true;
568 #endif // Q_OS_BLACKBERRY 570 if (showSystemDialogFullScreen) {
577 d->mac_nativeDialogModalHelp();
581 d->eventLoop = &eventLoop;
594 #ifndef QT_NO_MENUBAR 597 #endif //QT_NO_MENUBAR 598 #endif //Q_WS_WINCE_WM 624 d->resetModalitySetByOpen();
665 #ifndef QT_NO_CONTEXTMENU 669 #if defined(QT_NO_WHATSTHIS) || defined(QT_NO_MENU) 692 #endif // QT_NO_CONTEXTMENU 710 for (
int i=0; i<list.
size(); ++i) {
735 #ifndef QT_NO_WHATSTHIS 790 if (first !=
d->mainDef && qobject_cast<QPushButton*>(first))
791 d->mainDef->setFocus();
808 #ifndef QT_NO_ACCESSIBILITY 816 #ifndef QT_NO_ACCESSIBILITY 824 d->eventLoop->exit();
828 BOOL snapToDefault =
false;
859 if (symbianAdjustedPosition())
865 int extraw = 0, extrah = 0, scrn = 0;
879 for (
int i = 0; (extraw == 0 || extrah == 0) && i < list.
size(); ++i) {
882 int framew = current->
geometry().
x() - current->
x();
883 int frameh = current->
geometry().
y() - current->
y();
885 extraw =
qMax(extraw, framew);
886 extrah =
qMax(extrah, frameh);
892 if (extraw == 0 || extrah == 0 || extraw >= 10 || extrah >= 40) {
916 if (p.
x() < desk.
x())
921 if (p.
y() < desk.
y())
927 #if defined(Q_OS_SYMBIAN) 929 bool QDialog::symbianAdjustedPosition()
931 #if defined(Q_WS_S60) 938 TRect statusPaneRect = TRect();
939 if (S60->screenHeightInPixels > S60->screenWidthInPixels) {
940 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect);
942 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, statusPaneRect);
945 if (statusPaneRect.IsEmpty())
946 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect);
950 p.
setY(statusPaneRect.Height());
953 if (S60->screenHeightInPixels > S60->screenWidthInPixels) {
956 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, rect);
957 cbaHeight = rect.Height();
958 p.
setY(S60->screenHeightInPixels -
height() - cbaHeight);
962 TRect staConTopRect = TRect();
963 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect);
964 if (staConTopRect.IsEmpty()) {
965 TRect cbaRect = TRect();
966 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect);
967 AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation();
968 switch (cbaLocation) {
969 case AknLayoutUtils::EAknCbaLocationBottom:
970 p.
setY(S60->screenHeightInPixels -
height() - cbaRect.Height());
971 p.
setX((S60->screenWidthInPixels -
width()) >> 1);
973 case AknLayoutUtils::EAknCbaLocationRight:
974 p.
setY((S60->screenHeightInPixels -
height()) >> 1);
975 p.
setX(
qMax(0,S60->screenWidthInPixels -
width() - scrollbarWidth - cbaRect.Width()));
977 case AknLayoutUtils::EAknCbaLocationLeft:
978 p.
setY((S60->screenHeightInPixels -
height()) >> 1);
979 p.
setX(
qMax(0,scrollbarWidth + cbaRect.Width()));
983 p.
setY((S60->screenHeightInPixels -
height()) >> 1);
988 if (oldPos != p || p.
y() < 0)
1038 return d->orientation;
1061 delete d->extension;
1090 return d->extension;
1112 d->doShowExtension = showIt;
1117 if (
d->extension->isVisible() == showIt)
1126 QSize s(
d->extension->sizeHint()
1127 .expandedTo(
d->extension->minimumSize())
1128 .boundedTo(
d->extension->maximumSize()));
1131 d->extension->setGeometry(
width(), 0, s.
width(), h);
1138 d->extension->show();
1139 #ifndef QT_NO_SIZEGRIP 1145 d->extension->hide();
1152 #ifndef QT_NO_SIZEGRIP 1171 #if defined(Q_WS_S60) 1226 #ifndef QT_NO_SIZEGRIP 1228 return !!
d->resizer;
1237 #ifdef QT_NO_SIZEGRIP 1241 #ifndef QT_NO_SIZEGRIP 1243 if (enabled &&
d->doShowExtension)
1246 if (!enabled != !
d->resizer) {
1250 d->resizer->resize(
d->resizer->sizeHint());
1252 d->resizer->move(
rect().bottomLeft() -
d->resizer->rect().bottomLeft());
1254 d->resizer->move(
rect().bottomRight() -
d->resizer->rect().bottomRight());
1255 d->resizer->raise();
1262 #endif //QT_NO_SIZEGRIP 1270 #ifndef QT_NO_SIZEGRIP 1274 d->resizer->move(
rect().bottomLeft() -
d->resizer->rect().bottomLeft());
1276 d->resizer->move(
rect().bottomRight() -
d->resizer->rect().bottomRight());
1277 d->resizer->raise();
1334 #include "moc_qdialog.cpp"
bool sizeGripEnabled
whether the size grip is enabled
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object's accessibility information.
void setEnabled(bool)
Enables this layout if enable is true, otherwise disables it.
The QKeyEvent class describes a key event.
void keyPressEvent(QKeyEvent *)
Reimplemented Function
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
The QSizeGrip class provides a resize handle for resizing top-level windows.
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
The QFlag class is a helper data type for QFlags.
The QDialog class is the base class of dialog windows.
bool isNull() const
Returns true if the referenced object has been destroyed or if there is no referenced object; otherwi...
QSize minimumSizeHint() const
Reimplemented Function
int exec()
Shows the dialog as a modal dialog, blocking until the user closes it.
static void postEvent(QObject *receiver, QEvent *event)
Adds the event event, with the object receiver as the receiver of the event, to an event queue and re...
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
virtual void accept()
Hides the modal dialog and sets the result code to Accepted.
virtual void reject()
Hides the modal dialog and sets the result code to Rejected.
QWidget * extension() const
Returns the dialog's extension or 0 if no extension has been defined.
int width() const
Returns the width of the rectangle.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
~QDialog()
Destroys the QDialog, deleting all its children.
void showEvent(QShowEvent *)
This event handler can be reimplemented in a subclass to receive widget show events which are passed ...
int height() const
Returns the height of the rectangle.
T * qobject_cast(QObject *object)
bool modal
whether show() should pop up the dialog as modal or modeless
static void setPos(int x, int y)
Moves the cursor (hot spot) to the global screen position (x, y).
The QObject class is the base class of all Qt objects.
void setExtension(QWidget *extension)
Sets the widget, extension, to be the dialog's extension, deleting any previous extension.
The QPointer class is a template class that provides guarded pointers to QObject. ...
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setObjectName(const QString &name)
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
int width() const
Returns the width.
void resizeEvent(QResizeEvent *)
Reimplemented Function
#define QT_BEGIN_NAMESPACE
This macro expands to.
void adjustPosition(QWidget *)
The QEventLoop class provides a means of entering and leaving an event loop.
void setMainDefault(QPushButton *)
This function sets the default default push button to pushButton.
int size() const
Returns the number of characters in this string.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool qt_wince_is_smartphone()
void closeEvent(QCloseEvent *)
Reimplemented Function
const T & at(int i) const
Returns the item at index position i in the list.
bool spontaneous() const
Returns true if the event originated outside the application (a system event); otherwise returns fals...
QSize sizeHint() const
Reimplemented Function
The QResizeEvent class contains event parameters for resize events.
Q_CORE_EXPORT void qWarning(const char *,...)
void rejected()
This signal is emitted when the dialog has been rejected either by the user or by calling reject() or...
static bool inWhatsThisMode()
Returns true if the user interface is in "What's This?" mode; otherwise returns false.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
void setDefault(QPushButton *)
This function is called by the push button pushButton when it becomes the default button...
The QShowEvent class provides an event that is sent when a widget is shown.
static QWidgetList topLevelWidgets()
Returns a list of the top-level widgets (windows) in the application.
#define SPI_GETSNAPTODEFBUTTON
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
bool isSizeGripEnabled() const
QDialog(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a dialog with parent parent.
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
virtual void done(int)
Closes the dialog and sets its result code to r.
void setResult(int r)
Sets the modal dialog's result code to i.
bool qt_wince_is_mobile()
QPoint center() const
Returns the center point of the rectangle.
void setY(int y)
Sets the y coordinate of this point to the given y coordinate.
void hideDefault()
Hides the default button indicator.
int y() const
Returns the y-coordinate of the rectangle's top edge.
bool eventFilter(QObject *, QEvent *)
Reimplemented Function
int x() const
Returns the x-coordinate of the rectangle's left edge.
QObject * parent() const
Returns a pointer to the parent object.
void showExtension(bool)
If showIt is true, the dialog's extension is shown; otherwise the extension is hidden.
The QPoint class defines a point in the plane using integer precision.
int result() const
In general returns the modal dialog's result code, Accepted or Rejected.
int size() const
Returns the number of items in the list.
bool event(QEvent *e)
Reimplemented Function
void resetModalitySetByOpen()
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
void setSizeGripEnabled(bool)
int y() const
Returns the y coordinate of this point.
void accepted()
This signal is emitted when the dialog has been accepted either by the user or by calling accept() or...
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
void open()
Shows the dialog as a window modal dialog, returning immediately.
The QSize class defines the size of a two-dimensional object using integer point precision.
Qt::Orientation orientation() const
Returns the dialog's extension orientation.
int x() const
Returns the x coordinate of this point.
void setModal(bool modal)
void contextMenuEvent(QContextMenuEvent *)
Reimplemented Function
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
void finished(int result)
This signal is emitted when the dialog's result code has been set, either by the user or by calling d...
void setX(int x)
Sets the x coordinate of this point to the given x coordinate.
void setVisible(bool visible)
Reimplemented Function
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
The QCloseEvent class contains parameters that describe a close event.
int exec(ProcessEventsFlags flags=AllEvents)
Enters the main event loop and waits until exit() is called.
The QFocusEvent class contains event parameters for widget focus events.
The QAction class provides an abstract user interface action that can be inserted into widgets...
static void leaveWhatsThisMode()
If the user interface is in "What's This?" mode, this function switches back to normal mode; otherwis...
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
The QWeakPointer class holds a weak reference to a shared pointer.
The QList class is a template class that provides lists.
void setOrientation(Qt::Orientation orientation)
If orientation is Qt::Horizontal, the extension will be displayed to the right of the dialog's main a...
The QHelpEvent class provides an event that is used to request helpful information about a particular...