summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp5
-rw-r--r--src/widgets/dialogs/qcolordialog.h4
-rw-r--r--src/widgets/dialogs/qdialog.h4
-rw-r--r--src/widgets/dialogs/qerrormessage.h4
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp4
-rw-r--r--src/widgets/dialogs/qfiledialog.h4
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.h4
-rw-r--r--src/widgets/dialogs/qfontdialog.h4
-rw-r--r--src/widgets/dialogs/qinputdialog.h4
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp24
-rw-r--r--src/widgets/dialogs/qmessagebox.h8
-rw-r--r--src/widgets/dialogs/qprogressdialog.h4
-rw-r--r--src/widgets/dialogs/qwizard.cpp6
-rw-r--r--src/widgets/dialogs/qwizard.h4
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp88
-rw-r--r--src/widgets/dialogs/qwizard_win_p.h10
17 files changed, 87 insertions, 96 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index af43ecc8df..c22258b3d2 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -1857,15 +1857,12 @@ void QColorDialog::setVisible(bool visible)
}
#else
- if (!(options() & DontUseNativeDialog))
+ if (!(options() & DontUseNativeDialog) && d->nativeDialogInUse) {
d->setNativeDialogVisible(visible);
-
- if (d->nativeDialogInUse) {
// Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
// updates the state correctly, but skips showing the non-native version:
setAttribute(Qt::WA_DontShowOnScreen);
} else {
- d->nativeDialogInUse = false;
setAttribute(Qt::WA_DontShowOnScreen, false);
}
#endif
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index 2149c9c6d2..5db42629d8 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -133,6 +131,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOLORDIALOG_H
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index eeb0ac56b5..a083a9f640 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -125,6 +123,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDIALOG_H
diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h
index 4bba3131c9..b66cbca9e0 100644
--- a/src/widgets/dialogs/qerrormessage.h
+++ b/src/widgets/dialogs/qerrormessage.h
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -79,6 +77,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QERRORMESSAGE_H
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index c60f2476c3..f4aa91974b 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -941,7 +941,9 @@ Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded
} else {
QString userName = tokens.first();
userName.remove(0, 1);
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
+#if defined(Q_OS_VXWORKS)
+ const QString homePath = QDir::homePath();
+#elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
passwd pw;
passwd *tmpPw;
char buf[200];
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index 18aaa781fd..973bccf940 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -46,8 +46,6 @@
#include <QtCore/qstring.h>
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -265,6 +263,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDialog::Options)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFILEDIALOG_H
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 4d3c7a24ec..251af273b9 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -964,6 +964,8 @@ Qt::ItemFlags QFileSystemModel::flags(const QModelIndex &index) const
flags |= Qt::ItemIsEditable;
if (indexNode->isDir())
flags |= Qt::ItemIsDropEnabled;
+ else
+ flags |= Qt::ItemNeverHasChildren;
}
return flags;
}
diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h
index 18df89d736..cf26a4545d 100644
--- a/src/widgets/dialogs/qfilesystemmodel.h
+++ b/src/widgets/dialogs/qfilesystemmodel.h
@@ -48,8 +48,6 @@
#include <QtGui/qicon.h>
#include <QtCore/qdiriterator.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -173,7 +171,5 @@ inline QFileInfo QFileSystemModel::fileInfo(const QModelIndex &aindex) const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFILESYSTEMMODEL_H
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index 51d68d1b88..ceec0b71fc 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -46,8 +46,6 @@
#include <QtWidgets/qdialog.h>
#include <QtGui/qfont.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -126,6 +124,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFONTDIALOG_H
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index 096a81d4bc..e55c2da1ff 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -46,8 +46,6 @@
#include <QtCore/qstring.h>
#include <QtWidgets/qlineedit.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -215,6 +213,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QINPUTDIALOG_H
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 57ed4da8a6..c644314ccd 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1225,6 +1225,30 @@ void QMessageBox::setTextFormat(Qt::TextFormat format)
}
/*!
+ \property QMessageBox::textInteractionFlags
+ \since 5.1
+
+ Specifies how the label of the message box should interact with user
+ input.
+
+ The default value depends on the style.
+
+ \sa QStyle::SH_MessageBox_TextInteractionFlags
+*/
+
+Qt::TextInteractionFlags QMessageBox::textInteractionFlags() const
+{
+ Q_D(const QMessageBox);
+ return d->label->textInteractionFlags();
+}
+
+void QMessageBox::setTextInteractionFlags(Qt::TextInteractionFlags flags)
+{
+ Q_D(QMessageBox);
+ d->label->setTextInteractionFlags(flags);
+}
+
+/*!
\reimp
*/
bool QMessageBox::event(QEvent *e)
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index e0eb47ea2a..a170360fd5 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -69,6 +67,7 @@ class Q_WIDGETS_EXPORT QMessageBox : public QDialog
Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText)
#endif
Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText)
+ Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags)
public:
enum Icon {
@@ -186,6 +185,9 @@ public:
Qt::TextFormat textFormat() const;
void setTextFormat(Qt::TextFormat format);
+ void setTextInteractionFlags(Qt::TextInteractionFlags flags);
+ Qt::TextInteractionFlags textInteractionFlags() const;
+
static StandardButton information(QWidget *parent, const QString &title,
const QString &text, StandardButtons buttons = Ok,
StandardButton defaultButton = NoButton);
@@ -329,6 +331,4 @@ str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplicatio
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMESSAGEBOX_H
diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h
index 1f17727900..4eb9feeb7d 100644
--- a/src/widgets/dialogs/qprogressdialog.h
+++ b/src/widgets/dialogs/qprogressdialog.h
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -139,6 +137,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPROGRESSDIALOG_H
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 8bc2eb92c1..aab6494d98 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -1557,7 +1557,7 @@ void QWizardPrivate::handleAeroStyleChange()
_q_updateButtonStates();
if (q->isVisible())
- vistaHelper->setWindowPosHack();
+ vistaHelper->updateCustomMargins();
inHandleAeroStyleChange = false;
}
@@ -2922,6 +2922,10 @@ QWidget *QWizard::sideWidget() const
void QWizard::setVisible(bool visible)
{
Q_D(QWizard);
+#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+ if (visible)
+ d->vistaHelper->updateCustomMargins();
+#endif
if (visible) {
if (d->current == -1)
restart();
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index 7a95492f94..fe2e5f2d13 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -261,8 +259,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_WIZARD
#endif // QWIZARD_H
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 2bcb7a2167..ec04fed702 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -49,7 +49,9 @@
#include "qwizard.h"
#include "qpaintengine.h"
#include "qapplication.h"
+#include <QtCore/QVariant>
#include <QtGui/QMouseEvent>
+#include <QtGui/QWindow>
#include <QtWidgets/QDesktopWidget>
// Note, these tests are duplicates in qwindowsxpstyle_p.h.
@@ -66,6 +68,8 @@
#include <uxtheme.h>
+Q_DECLARE_METATYPE(QMargins)
+
QT_BEGIN_NAMESPACE
//DWM related
@@ -265,6 +269,26 @@ QVistaHelper::~QVistaHelper()
--instanceCount;
}
+void QVistaHelper::updateCustomMargins()
+{
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8)
+ return; // Negative margins are not supported on Windows 8.
+ if (QWindow *window = wizard->windowHandle()) {
+ // Reduce top frame to zero since we paint it ourselves.
+ const QMargins customMargins = vistaState() == VistaAero ?
+ QMargins(0, -titleBarSize(), 0, 0) : QMargins();
+ const QVariant customMarginsV = qVariantFromValue(customMargins);
+ // The dynamic property takes effect when creating the platform window.
+ window->setProperty("_q_windowsCustomMargins", customMarginsV);
+ // If a platform window exists, change via native interface.
+ if (QPlatformWindow *platformWindow = window->handle()) {
+ QGuiApplication::platformNativeInterface()->
+ setWindowProperty(platformWindow, QStringLiteral("WindowsCustomMargins"),
+ customMarginsV);
+ }
+ }
+}
+
bool QVistaHelper::isCompositionEnabled()
{
bool value = is_vista;
@@ -291,6 +315,12 @@ QVistaHelper::VistaState QVistaHelper::vistaState()
return cachedVistaState;
}
+void QVistaHelper::disconnectBackButton()
+{
+ if (backButton_) // Leave QStyleSheetStyle's connections on destroyed() intact.
+ backButton_->disconnect(SIGNAL(clicked()));
+}
+
QColor QVistaHelper::basicWindowFrameColor()
{
DWORD rgb;
@@ -402,13 +432,6 @@ bool QVistaHelper::winEvent(MSG* msg, long* result)
}
break;
}
-// case WM_NCCALCSIZE: { #fixme: If the frame size is changed, it needs to be communicated to the QWindow.
-// NCCALCSIZE_PARAMS* lpncsp = (NCCALCSIZE_PARAMS*)msg->lParam;
-// *result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
-// lpncsp->rgrc[0].top -= (vistaState() == VistaAero ? titleBarSize() : 0);
-//
-// break;
-// }
default:
LRESULT lResult;
// Pass to DWM to handle
@@ -449,38 +472,6 @@ void QVistaHelper::mouseEvent(QEvent *event)
}
}
-// The following hack ensures that the titlebar is updated correctly
-// when the wizard style changes to and from AeroStyle. Specifically,
-// this function causes a Windows message of type WM_NCCALCSIZE to
-// be triggered.
-void QVistaHelper::setWindowPosHack()
-{
- const int x = wizard->geometry().x(); // ignored by SWP_NOMOVE
- const int y = wizard->geometry().y(); // ignored by SWP_NOMOVE
- const int w = wizard->width();
- const int h = wizard->height();
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- SetWindowPos(handle, 0, x, y, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
-}
-
-// The following hack allows any QWidget subclass to access
-// QWidgetPrivate::topData() without being declared as a
-// friend by QWidget.
-class QHackWidget : public QWidget
-{
-public:
- Q_DECLARE_PRIVATE(QWidget)
- QTLWExtra* topData() { return d_func()->topData(); }
-};
-
-void QVistaHelper::collapseTopFrameStrut()
-{
- QTLWExtra *top = ((QHackWidget *)wizard)->d_func()->topData();
- int x1, y1, x2, y2;
- top->frameStrut.getCoords(&x1, &y1, &x2, &y2);
- top->frameStrut.setCoords(x1, 0, x2, y2);
-}
-
bool QVistaHelper::handleWinEvent(MSG *message, long *result)
{
if (message->message == WIZ_WM_THEMECHANGED || message->message == WIZ_WM_DWMCOMPOSITIONCHANGED)
@@ -489,12 +480,8 @@ bool QVistaHelper::handleWinEvent(MSG *message, long *result)
bool status = false;
if (wizard->wizardStyle() == QWizard::AeroStyle && vistaState() == VistaAero) {
status = winEvent(message, result);
- if (message->message == WM_NCCALCSIZE) {
-// if (status) #fixme
-// collapseTopFrameStrut();
- } else if (message->message == WM_NCPAINT) {
+ if (message->message == WM_NCPAINT)
wizard->update();
- }
}
return status;
}
@@ -789,6 +776,19 @@ int QVistaHelper::titleOffset()
return leftMargin() + iconOffset;
}
+int QVistaHelper::topOffset()
+{
+ if (vistaState() != VistaAero)
+ return titleBarSize() + 3;
+ static const int aeroOffset =
+ QSysInfo::WindowsVersion == QSysInfo::WV_WINDOWS7 ?
+ QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
+ int result = aeroOffset;
+ if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8)
+ result += titleBarSize();
+ return result;
+}
+
QT_END_NAMESPACE
#endif // QT_NO_STYLE_WINDOWSVISTA
diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h
index cd0b2da38e..8b370d4e74 100644
--- a/src/widgets/dialogs/qwizard_win_p.h
+++ b/src/widgets/dialogs/qwizard_win_p.h
@@ -87,6 +87,7 @@ public:
QVistaHelper(QWizard *wizard);
~QVistaHelper();
enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
+ void updateCustomMargins();
bool setDWMTitleBar(TitleBarChangeType type);
void setTitleBarIconAndCaptionVisible(bool visible);
void mouseEvent(QEvent *event);
@@ -94,9 +95,8 @@ public:
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
QVistaBackButton *backButton() const { return backButton_; }
- void disconnectBackButton() { if (backButton_) backButton_->disconnect(); }
+ void disconnectBackButton();
void hideBackButton() { if (backButton_) backButton_->hide(); }
- void setWindowPosHack();
QColor basicWindowFrameColor();
enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
static VistaState vistaState();
@@ -105,10 +105,8 @@ public:
return int(QStyleHelper::dpiScaled(
QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6));
}
- static int topOffset() {
- static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
- QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
- return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); }
+ static int topOffset();
+
private:
static HFONT getCaptionFont(HANDLE hTheme);
bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);