WinRT: Fix Widget builds
Tweak pri files and preprocessor usage to support widgets under WinRT. Change-Id: I6dc7d160078c0da343d6d39d2a0d52112c6f9f59 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
parent
e37001aad7
commit
bd78389fc4
@ -1644,7 +1644,7 @@ int QFileDialogPrivate::maxNameLength(const QString &path)
|
||||
{
|
||||
#if defined(Q_OS_UNIX)
|
||||
return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX);
|
||||
#elif defined(Q_OS_WINCE)
|
||||
#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
Q_UNUSED(path);
|
||||
return MAX_PATH;
|
||||
#elif defined(Q_OS_WIN)
|
||||
|
@ -1713,7 +1713,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
node->populate(info);
|
||||
#endif
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
//The parentNode is "" so we are listing the drives
|
||||
if (parentNode->fileName.isEmpty()) {
|
||||
wchar_t name[MAX_PATH + 1];
|
||||
|
@ -73,7 +73,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
HMENU qt_getWindowsSystemMenu(const QWidget *w)
|
||||
{
|
||||
if (QWindow *window = QApplicationPrivate::windowForWidget(w))
|
||||
@ -1608,7 +1608,7 @@ void QMessageBox::showEvent(QShowEvent *e)
|
||||
QAccessibleEvent event(this, QAccessible::Alert);
|
||||
QAccessible::updateAccessibility(&event);
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
if (const HMENU systemMenu = qt_getWindowsSystemMenu(this)) {
|
||||
EnableMenuItem(systemMenu, SC_CLOSE, d->detectedEscapeButton ?
|
||||
MF_BYCOMMAND|MF_ENABLED : MF_BYCOMMAND|MF_GRAYED);
|
||||
|
@ -53,8 +53,10 @@
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
# include <qt_windows.h>
|
||||
# include <commctrl.h>
|
||||
# include <objbase.h>
|
||||
# ifndef Q_OS_WINRT
|
||||
# include <commctrl.h>
|
||||
# include <objbase.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(QT_NO_STYLE_GTK)
|
||||
@ -313,7 +315,7 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const
|
||||
return retIcon;
|
||||
|
||||
if (info.isRoot())
|
||||
#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
{
|
||||
UINT type = GetDriveType((wchar_t *)info.absoluteFilePath().utf16());
|
||||
|
||||
|
@ -451,7 +451,7 @@ void qt_init(QApplicationPrivate *priv, int type)
|
||||
QApplicationPrivate::initializeWidgetFontHash();
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
// #fixme: Remove.
|
||||
static HDC displayDC = 0; // display device context
|
||||
|
||||
@ -470,7 +470,7 @@ void qt_cleanup()
|
||||
QColormap::cleanup();
|
||||
|
||||
QApplicationPrivate::active_window = 0; //### this should not be necessary
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
if (displayDC) {
|
||||
ReleaseDC(0, displayDC);
|
||||
displayDC = 0;
|
||||
|
@ -4174,7 +4174,7 @@ const QPalette &QWidget::palette() const
|
||||
if (!isEnabled()) {
|
||||
data->pal.setCurrentColorGroup(QPalette::Disabled);
|
||||
} else if ((!isVisible() || isActiveWindow())
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
&& !QApplicationPrivate::isBlockedByModal(const_cast<QWidget *>(this))
|
||||
#endif
|
||||
) {
|
||||
|
@ -120,7 +120,7 @@ static inline void qt_flush(QWidget *widget, const QRegion ®ion, QBackingStor
|
||||
}
|
||||
|
||||
#ifndef QT_NO_PAINT_DEBUG
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
|
||||
static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec)
|
||||
{
|
||||
@ -160,7 +160,7 @@ static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec
|
||||
QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("releaseDC"), nativeWindow);
|
||||
::Sleep(msec);
|
||||
}
|
||||
#endif // Q_OS_WIN
|
||||
#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
|
||||
void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped)
|
||||
{
|
||||
@ -175,7 +175,7 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa
|
||||
widget = nativeParent;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
Q_UNUSED(unclipped);
|
||||
showYellowThing_win(widget, paintRegion, msec);
|
||||
#else
|
||||
|
@ -2,6 +2,6 @@
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
INCLUDEPATH += ../3rdparty/wintab
|
||||
!wince* {
|
||||
!wince*:!winrt {
|
||||
LIBS *= -lshell32
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ void QWindowsStyle::polish(QApplication *app)
|
||||
d->inactiveGradientCaptionColor = app->palette().dark().color();
|
||||
d->inactiveCaptionText = app->palette().background().color();
|
||||
|
||||
#if defined(Q_OS_WIN) //fetch native title bar colors
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //fetch native title bar colors
|
||||
if(app->desktopSettingsAware()){
|
||||
DWORD activeCaption = GetSysColor(COLOR_ACTIVECAPTION);
|
||||
DWORD gradientActiveCaption = GetSysColor(COLOR_GRADIENTACTIVECAPTION);
|
||||
@ -413,6 +413,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
|
||||
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#ifndef Q_OS_WINRT // There is no title bar in Windows Runtime applications
|
||||
case PM_TitleBarHeight:
|
||||
if (widget && (widget->windowType() == Qt::Tool)) {
|
||||
// MS always use one less than they say
|
||||
@ -426,16 +427,17 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
|
||||
}
|
||||
|
||||
break;
|
||||
#endif // !Q_OS_WINRT
|
||||
|
||||
case PM_ScrollBarExtent:
|
||||
{
|
||||
#ifndef Q_OS_WINCE
|
||||
#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
NONCLIENTMETRICS ncm;
|
||||
ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT);
|
||||
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0))
|
||||
ret = qMax(ncm.iScrollHeight, ncm.iScrollWidth);
|
||||
else
|
||||
#endif
|
||||
#endif // !Q_OS_WINCE && !Q_OS_WINRT
|
||||
ret = QCommonStyle::pixelMetric(pm, opt, widget);
|
||||
}
|
||||
break;
|
||||
@ -446,6 +448,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
|
||||
break;
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#ifndef Q_OS_WINRT // Mdi concept not available for WinRT applications
|
||||
case PM_MdiSubWindowFrameWidth:
|
||||
#if defined(Q_OS_WINCE)
|
||||
ret = GetSystemMetrics(SM_CYDLGFRAME);
|
||||
@ -453,7 +456,8 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
|
||||
ret = GetSystemMetrics(SM_CYFRAME);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#endif // !Q_OS_WINRT
|
||||
#endif // Q_OS_WIN
|
||||
case PM_ToolBarItemMargin:
|
||||
ret = 1;
|
||||
break;
|
||||
@ -477,7 +481,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
|
||||
QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
|
||||
const QWidget *widget) const
|
||||
{
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
QPixmap desktopIcon;
|
||||
switch(standardPixmap) {
|
||||
case SP_DriveCDIcon:
|
||||
@ -516,7 +520,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl
|
||||
if (!desktopIcon.isNull()) {
|
||||
return desktopIcon;
|
||||
}
|
||||
#endif
|
||||
#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
|
||||
return QCommonStyle::standardPixmap(standardPixmap, opt, widget);
|
||||
}
|
||||
|
||||
@ -554,7 +558,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Option not used on WinRT -> common style
|
||||
case SH_UnderlineShortcut:
|
||||
{
|
||||
ret = 1;
|
||||
@ -590,7 +594,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
|
||||
#endif // QT_NO_ACCESSIBILITY
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif // Q_OS_WIN && !Q_OS_WINRT
|
||||
#ifndef QT_NO_RUBBERBAND
|
||||
case SH_RubberBand_Mask:
|
||||
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
|
||||
|
@ -27,7 +27,7 @@ SOURCES += \
|
||||
util/qundostack.cpp \
|
||||
util/qundoview.cpp
|
||||
|
||||
win32:!wince* {
|
||||
win32:!wince*:!winrt {
|
||||
SOURCES += util/qsystemtrayicon_win.cpp
|
||||
} else:contains(QT_CONFIG, xcb) {
|
||||
SOURCES += util/qsystemtrayicon_x11.cpp
|
||||
|
@ -251,7 +251,9 @@ inline static bool waitForWindowExposed(QWindow *window, int timeout = 1000)
|
||||
break;
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, remaining);
|
||||
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WINRT)
|
||||
WaitForSingleObjectEx(GetCurrentThread(), TimeOutMs, false);
|
||||
#elif defined(Q_OS_WIN)
|
||||
Sleep(uint(TimeOutMs));
|
||||
#else
|
||||
struct timespec ts = { TimeOutMs / 1000, (TimeOutMs % 1000) * 1000 * 1000 };
|
||||
|
Loading…
Reference in New Issue
Block a user