diff options
23 files changed, 130 insertions, 125 deletions
diff --git a/.qmake.conf b/.qmake.conf index 76c202a..097d8b9 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,3 +1,3 @@ load(qt_build_config) -MODULE_VERSION = 5.11.2 +MODULE_VERSION = 5.12.0 diff --git a/LGPL_EXCEPTION.txt b/LGPL_EXCEPTION.txt deleted file mode 100644 index 5cdacb9..0000000 --- a/LGPL_EXCEPTION.txt +++ /dev/null @@ -1,22 +0,0 @@ -The Qt Company Qt LGPL Exception version 1.1 - -As an additional permission to the GNU Lesser General Public License version -2.1, the object code form of a "work that uses the Library" may incorporate -material from a header file that is part of the Library. You may distribute -such object code under terms of your choice, provided that: - (i) the header files of the Library have not been modified; and - (ii) the incorporated material is limited to numerical parameters, data - structure layouts, accessors, macros, inline functions and - templates; and - (iii) you comply with the terms of Section 6 of the GNU Lesser General - Public License version 2.1. - -Moreover, you may apply this exception to a modified version of the Library, -provided that such modification does not involve copying material from the -Library into the modified Library's header files unless such material is -limited to (i) numerical parameters; (ii) data structure layouts; -(iii) accessors; and (iv) small macros, templates and inline functions of -five lines or less in length. - -Furthermore, you are not required to apply this additional permission to a -modified version of the Library. diff --git a/examples/winextras/iconextractor/main.cpp b/examples/winextras/iconextractor/main.cpp index d630f9b..0d7ebbd 100644 --- a/examples/winextras/iconextractor/main.cpp +++ b/examples/winextras/iconextractor/main.cpp @@ -189,17 +189,15 @@ static PixmapEntryList extractShellIcons(const QString &sourceFile, bool addOver if (!QFileInfo(sourceFile).isDir()) baseFlags |= SHGFI_USEFILEATTRIBUTES; - const size_t modeEntryCount = sizeof(modeEntries) / sizeof(modeEntries[0]); - const size_t standardSizeEntryCount = sizeof(standardSizeEntries) / sizeof(standardSizeEntries[0]); PixmapEntryList result; - for (size_t m = 0; m < modeEntryCount; ++m) { - const unsigned modeFlags = baseFlags | modeEntries[m].flags; + for (auto modeEntry : modeEntries) { + const unsigned modeFlags = baseFlags | modeEntry.flags; QString modePrefix = QLatin1String("_shell_"); - if (modeEntries[m].name[0]) - modePrefix += QLatin1String(modeEntries[m].name) + QLatin1Char('_'); - for (size_t s = 0; s < standardSizeEntryCount; ++s) { - const unsigned flags = modeFlags | standardSizeEntries[s].flags; - const QString prefix = modePrefix + QLatin1String(standardSizeEntries[s].name) + if (modeEntry.name[0]) + modePrefix += QLatin1String(modeEntry.name) + QLatin1Char('_'); + for (auto standardSizeEntry : standardSizeEntries) { + const unsigned flags = modeFlags | standardSizeEntry.flags; + const QString prefix = modePrefix + QLatin1String(standardSizeEntry.name) + QLatin1Char('_'); ZeroMemory(&info, sizeof(SHFILEINFO)); const HRESULT hr = SHGetFileInfo(sourceFileC, 0, &info, sizeof(SHFILEINFO), flags); @@ -280,7 +278,7 @@ int main(int argc, char *argv[]) const QCommandLineOption shellOverlayOption(QStringLiteral("overlay"), QStringLiteral("Extract shell overlay icons")); parser.addOption(shellOverlayOption); parser.addPositionalArgument(QStringLiteral("file"), QStringLiteral("The file to open.")); - parser.addPositionalArgument(QStringLiteral("image file folder"), QStringLiteral("The folder to store the images.")); + parser.addPositionalArgument(QStringLiteral("image_file_folder"), QStringLiteral("The folder to store the images.")); parser.process(app); const QStringList &positionalArguments = parser.positionalArguments(); if (positionalArguments.isEmpty()) @@ -299,9 +297,9 @@ int main(int argc, char *argv[]) ? extractShellIcons(sourceFile, parser.isSet(shellOverlayOption)) : extractIcons(sourceFile, parser.isSet(largeIconOption)); - for (int i = 0, count = pixmaps.size(); i < count; ++i) { - const QString fileName = imageFileRoot + pixmaps.at(i).name + QLatin1String(".png"); - if (!pixmaps.at(i).pixmap.save(fileName)) { + for (const auto &entry : pixmaps) { + const QString fileName = imageFileRoot + entry.name + QLatin1String(".png"); + if (!entry.pixmap.save(fileName)) { std::wcerr << "Error writing image file " << fileName << ".\n"; return 1; } diff --git a/src/imports/winextras/plugin.cpp b/src/imports/winextras/plugin.cpp index 55be331..a2009b0 100644 --- a/src/imports/winextras/plugin.cpp +++ b/src/imports/winextras/plugin.cpp @@ -47,14 +47,7 @@ #include "qquickthumbnailtoolbutton_p.h" #include "qquickwin_p.h" -#include <QtQml/QtQml> - -static void initResources() -{ -#ifdef QT_STATIC - Q_INIT_RESOURCE(qmake_QtWinExtras); -#endif -} +#include <QtQml/qqmlextensionplugin.h> QT_BEGIN_NAMESPACE @@ -64,7 +57,7 @@ class QWinExtrasQmlPlugin : public QQmlExtensionPlugin Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QWinExtrasQmlPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QWinExtrasQmlPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { } void registerTypes(const char *uri) Q_DECL_OVERRIDE { Q_ASSERT(uri == QLatin1String("QtWinExtras")); diff --git a/src/winextras/qwinevent.cpp b/src/winextras/qwinevent.cpp index 13642f4..a1e77b4 100644 --- a/src/winextras/qwinevent.cpp +++ b/src/winextras/qwinevent.cpp @@ -49,24 +49,18 @@ QWinEvent::QWinEvent(int type) : QEvent(static_cast<QEvent::Type>(type)) { } -QWinEvent::~QWinEvent() -{ -} +QWinEvent::~QWinEvent() = default; QWinColorizationChangeEvent::QWinColorizationChangeEvent(QRgb color, bool opaque) : QWinEvent(ColorizationChange), rgb(color), opaque(opaque) { } -QWinColorizationChangeEvent::~QWinColorizationChangeEvent() -{ -} +QWinColorizationChangeEvent::~QWinColorizationChangeEvent() = default; QWinCompositionChangeEvent::QWinCompositionChangeEvent(bool enabled) : QWinEvent(CompositionChange), enabled(enabled) { } -QWinCompositionChangeEvent::~QWinCompositionChangeEvent() -{ -} +QWinCompositionChangeEvent::~QWinCompositionChangeEvent() = default; diff --git a/src/winextras/qwineventfilter.cpp b/src/winextras/qwineventfilter.cpp index 4ec3bdc..be9add4 100644 --- a/src/winextras/qwineventfilter.cpp +++ b/src/winextras/qwineventfilter.cpp @@ -40,8 +40,8 @@ #include "qwineventfilter_p.h" #include "qwinfunctions.h" #include "qwinevent.h" -#include <QGuiApplication> -#include <QWindow> +#include <QtGui/qguiapplication.h> +#include <QtGui/qwindow.h> #ifndef WM_DWMCOLORIZATIONCOLORCHANGED # define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320 diff --git a/src/winextras/qwineventfilter_p.h b/src/winextras/qwineventfilter_p.h index 21bb5c5..12b9d58 100644 --- a/src/winextras/qwineventfilter_p.h +++ b/src/winextras/qwineventfilter_p.h @@ -52,8 +52,8 @@ // #include <QtWinExtras/qwinextrasglobal.h> -#include <QAbstractNativeEventFilter> -#include <qt_windows.h> +#include <QtCore/qabstractnativeeventfilter.h> +#include <QtCore/qt_windows.h> QT_BEGIN_NAMESPACE diff --git a/src/winextras/qwinfunctions.cpp b/src/winextras/qwinfunctions.cpp index 7b102a8..82fd25b 100644 --- a/src/winextras/qwinfunctions.cpp +++ b/src/winextras/qwinfunctions.cpp @@ -50,15 +50,15 @@ #include "qwineventfilter_p.h" #include "windowsguidsdefs_p.h" -#include <QGuiApplication> -#include <QWindow> -#include <QSettings> -#include <QPixmap> -#include <QBitmap> -#include <QImage> -#include <QColor> -#include <QRegion> -#include <QMargins> +#include <QtGui/qguiapplication.h> +#include <QtGui/qwindow.h> +#include <QtGui/qpixmap.h> +#include <QtGui/qbitmap.h> +#include <QtGui/qimage.h> +#include <QtGui/qcolor.h> +#include <QtGui/qregion.h> +#include <QtCore/qmargins.h> +#include <QtCore/qsettings.h> #include <comdef.h> #include "winshobjidl_p.h" @@ -69,6 +69,8 @@ Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap); Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0); Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0); Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p); +Q_GUI_EXPORT HBITMAP qt_imageToWinHBITMAP(const QImage &imageIn, int hbitmapFormat = 0); +Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0); Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h); Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon); @@ -139,6 +141,22 @@ HICON QtWin::toHICON(const QPixmap &p) } /*! + \since 5.12 + + Creates a \c HBITMAP equivalent of the QImage \a image, + based on the given \a format. Returns the \c HBITMAP handle. + + It is the caller's responsibility to free the \c HBITMAP data + after use. + + \sa imageFromHBITMAP() +*/ +HBITMAP QtWin::imageToHBITMAP(const QImage &image, QtWin::HBitmapFormat format) +{ + return qt_imageToWinHBITMAP(image, format); +} + +/*! \since 5.2 Returns a QImage that is equivalent to the @@ -153,6 +171,19 @@ QImage QtWin::imageFromHBITMAP(HDC hdc, HBITMAP bitmap, int width, int height) } /*! + \since 5.12 + + Returns a QImage that is equivalent to the + given \a bitmap. The conversion is based on the specified \a format. + + \sa imageToHBITMAP() +*/ +QImage QtWin::imageFromHBITMAP(HBITMAP bitmap, QtWin::HBitmapFormat format) +{ + return qt_imageFromWinHBITMAP(bitmap, format); +} + +/*! \since 5.2 Returns a QPixmap that is equivalent to the given \a icon. diff --git a/src/winextras/qwinfunctions.h b/src/winextras/qwinfunctions.h index bc07401..fe461d1 100644 --- a/src/winextras/qwinfunctions.h +++ b/src/winextras/qwinfunctions.h @@ -81,7 +81,9 @@ namespace QtWin Q_WINEXTRAS_EXPORT HBITMAP toHBITMAP(const QPixmap &p, HBitmapFormat format = HBitmapNoAlpha); Q_WINEXTRAS_EXPORT QPixmap fromHBITMAP(HBITMAP bitmap, HBitmapFormat format = HBitmapNoAlpha); Q_WINEXTRAS_EXPORT HICON toHICON(const QPixmap &p); + Q_WINEXTRAS_EXPORT HBITMAP imageToHBITMAP(const QImage &image, QtWin::HBitmapFormat format = HBitmapNoAlpha); Q_WINEXTRAS_EXPORT QImage imageFromHBITMAP(HDC hdc, HBITMAP bitmap, int width, int height); + Q_WINEXTRAS_EXPORT QImage imageFromHBITMAP(HBITMAP bitmap, QtWin::HBitmapFormat format = HBitmapNoAlpha); Q_WINEXTRAS_EXPORT QPixmap fromHICON(HICON icon); Q_WINEXTRAS_EXPORT HRGN toHRGN(const QRegion ®ion); Q_WINEXTRAS_EXPORT QRegion fromHRGN(HRGN hrgn); diff --git a/src/winextras/qwinfunctions_p.h b/src/winextras/qwinfunctions_p.h index a69e52c..3aad7bc 100644 --- a/src/winextras/qwinfunctions_p.h +++ b/src/winextras/qwinfunctions_p.h @@ -51,8 +51,8 @@ // We mean it. // -#include <QString> -#include <qt_windows.h> +#include <QtCore/qstring.h> +#include <QtCore/qt_windows.h> #include <uxtheme.h> #include <dwmapi.h> diff --git a/src/winextras/qwinjumplist.cpp b/src/winextras/qwinjumplist.cpp index 94b8e81..ca1b20a 100644 --- a/src/winextras/qwinjumplist.cpp +++ b/src/winextras/qwinjumplist.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include <QtCore/QtGlobal> +#include <QtCore/qglobal.h> #ifdef Q_CC_MINGW // MinGW: Enable SHCreateItemFromParsingName() # if defined(_WIN32_IE) && _WIN32_IE < 0x0700 // _WIN32_IE_IE70 @@ -57,11 +57,11 @@ #include "windowsguidsdefs_p.h" #include "winpropkey_p.h" -#include <QDir> -#include <QtCore/QDebug> -#include <QCoreApplication> -#include <QRegularExpression> -#include <qt_windows.h> +#include <QtCore/qdir.h> +#include <QtCore/qdebug.h> +#include <QtCore/qcoreapplication.h> +#include <QtCore/qregularexpression.h> +#include <QtCore/qt_windows.h> #include <propvarutil.h> #include "qwinfunctions.h" @@ -120,7 +120,8 @@ void QWinJumpListPrivate::warning(const char *function, HRESULT hresult) QString QWinJumpListPrivate::iconsDirPath() { - QString iconDirPath = QDir::tempPath() + QLatin1Char('/') + QCoreApplication::instance()->applicationName() + QLatin1String("/qt-jl-icons/"); + QString iconDirPath = QDir::tempPath() + QLatin1Char('/') + + QCoreApplication::applicationName() + QLatin1String("/qt-jl-icons/"); QDir().mkpath(iconDirPath); return iconDirPath; } diff --git a/src/winextras/qwinjumplistcategory.cpp b/src/winextras/qwinjumplistcategory.cpp index 4410c9c..721a78c 100644 --- a/src/winextras/qwinjumplistcategory.cpp +++ b/src/winextras/qwinjumplistcategory.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include <QtCore/QtGlobal> +#include <QtCore/qglobal.h> #ifdef Q_CC_MINGW // MinGW: Include the correct definition of SHARDAPPIDINFOLINK # if defined(NTDDI_VERSION) && NTDDI_VERSION < 0x06010000 @@ -57,7 +57,7 @@ #include "winshobjidl_p.h" #include "windowsguidsdefs_p.h" -#include <QtCore/QDebug> +#include <QtCore/qdebug.h> #include <shlobj.h> diff --git a/src/winextras/qwinjumplistitem.cpp b/src/winextras/qwinjumplistitem.cpp index e20366b..6c183ec 100644 --- a/src/winextras/qwinjumplistitem.cpp +++ b/src/winextras/qwinjumplistitem.cpp @@ -42,8 +42,8 @@ #include "qwinjumplistitem_p.h" #include "qwinjumplistcategory_p.h" -#include <QtCore/QDebug> -#include <QtCore/QDir> +#include <QtCore/qdebug.h> +#include <QtCore/qdir.h> QT_BEGIN_NAMESPACE @@ -86,9 +86,7 @@ QWinJumpListItem::QWinJumpListItem(QWinJumpListItem::Type type) : /*! Destroys the QWinJumpListItem. */ -QWinJumpListItem::~QWinJumpListItem() -{ -} +QWinJumpListItem::~QWinJumpListItem() = default; /*! Sets the item \a type. diff --git a/src/winextras/qwinmime.cpp b/src/winextras/qwinmime.cpp index 0239dca..f0f5232 100644 --- a/src/winextras/qwinmime.cpp +++ b/src/winextras/qwinmime.cpp @@ -39,11 +39,11 @@ #include "qwinmime.h" -#include <QtGui/QGuiApplication> -#include <QtCore/QMetaObject> -#include <QtCore/QDebug> +#include <QtGui/qguiapplication.h> +#include <QtCore/qmetaobject.h> +#include <QtCore/qdebug.h> -#include <qpa/qplatformnativeinterface.h> +#include <QtGui/qpa/qplatformnativeinterface.h> QT_BEGIN_NAMESPACE diff --git a/src/winextras/qwinmime.h b/src/winextras/qwinmime.h index 44d7c07..f9c450f 100644 --- a/src/winextras/qwinmime.h +++ b/src/winextras/qwinmime.h @@ -43,9 +43,9 @@ #include <QtWinExtras/qwinextrasglobal.h> #include <QtCore/qt_windows.h> -#include <QtCore/QVector> -#include <QtCore/QList> -#include <QtCore/QVariant> +#include <QtCore/qvector.h> +#include <QtCore/qlist.h> +#include <QtCore/qvariant.h> QT_BEGIN_NAMESPACE diff --git a/src/winextras/qwintaskbarbutton.cpp b/src/winextras/qwintaskbarbutton.cpp index cedca35..a1475d3 100644 --- a/src/winextras/qwintaskbarbutton.cpp +++ b/src/winextras/qwintaskbarbutton.cpp @@ -48,9 +48,9 @@ #include "winshobjidl_p.h" #include "windowsguidsdefs_p.h" -#include <QWindow> -#include <QIcon> -#include <QPair> +#include <QtGui/qwindow.h> +#include <QtGui/qicon.h> +#include <QtCore/qpair.h> #include <dwmapi.h> #include <shobjidl.h> @@ -152,8 +152,7 @@ void QWinTaskbarButtonPrivate::updateOverlayIcon() if (hicon) DestroyIcon(hicon); - if (descrPtr) - delete[] descrPtr; + delete[] descrPtr; } void QWinTaskbarButtonPrivate::_q_updateProgress() @@ -189,9 +188,7 @@ QWinTaskbarButton::QWinTaskbarButton(QObject *parent) : /*! Destroys the QWinTaskbarButton. */ -QWinTaskbarButton::~QWinTaskbarButton() -{ -} +QWinTaskbarButton::~QWinTaskbarButton() = default; /*! \property QWinTaskbarButton::window diff --git a/src/winextras/qwintaskbarbutton_p.h b/src/winextras/qwintaskbarbutton_p.h index a64f3ac..ceafe47 100644 --- a/src/winextras/qwintaskbarbutton_p.h +++ b/src/winextras/qwintaskbarbutton_p.h @@ -53,9 +53,9 @@ #include "qwintaskbarbutton.h" -#include <QWindow> -#include <QPointer> -#include <qt_windows.h> +#include <QtGui/qwindow.h> +#include <QtCore/qpointer.h> +#include <QtCore/qt_windows.h> struct ITaskbarList4; diff --git a/src/winextras/qwinthumbnailtoolbar.cpp b/src/winextras/qwinthumbnailtoolbar.cpp index 39622d1..3aa39b6 100644 --- a/src/winextras/qwinthumbnailtoolbar.cpp +++ b/src/winextras/qwinthumbnailtoolbar.cpp @@ -52,13 +52,12 @@ #include "windowsguidsdefs_p.h" #include "qwinfunctions.h" -#include <QWindow> -#include <QCoreApplication> -#include <QTimer> -#include <QDebug> +#include <QtGui/qwindow.h> +#include <QtCore/qcoreapplication.h> +#include <QtCore/qtimer.h> +#include <QtCore/qdebug.h> #include "qwinevent.h" -#include "qwinfunctions.h" #include "qwinfunctions_p.h" #include "qwineventfilter_p.h" @@ -120,9 +119,7 @@ QWinThumbnailToolBar::QWinThumbnailToolBar(QObject *parent) : /*! Destroys and clears the QWinThumbnailToolBar. */ -QWinThumbnailToolBar::~QWinThumbnailToolBar() -{ -} +QWinThumbnailToolBar::~QWinThumbnailToolBar() = default; /*! \property QWinThumbnailToolBar::window @@ -519,12 +516,12 @@ void QWinThumbnailToolBarPrivate::_q_updateToolbar() if (FAILED(hresult)) qWarning() << msgComFailed("ThumbBarUpdateButtons", hresult); updateIconicPixmapsEnabled(false); - for (int i = 0; i < windowsLimitedThumbbarSize; i++) { - if (buttons[i].hIcon) { - if (createdIcons.contains(buttons[i].hIcon)) - DestroyIcon(buttons[i].hIcon); + for (auto & button : buttons) { + if (button.hIcon) { + if (createdIcons.contains(button.hIcon)) + DestroyIcon(button.hIcon); else - DeleteObject(buttons[i].hIcon); + DeleteObject(button.hIcon); } } } diff --git a/src/winextras/qwinthumbnailtoolbar_p.h b/src/winextras/qwinthumbnailtoolbar_p.h index dc9fe5b..38d210b 100644 --- a/src/winextras/qwinthumbnailtoolbar_p.h +++ b/src/winextras/qwinthumbnailtoolbar_p.h @@ -53,11 +53,11 @@ #include "qwinthumbnailtoolbar.h" -#include <QtCore/QHash> -#include <QtCore/QList> -#include <QtGui/QIcon> -#include <QtGui/QPixmap> -#include <QtCore/QAbstractNativeEventFilter> +#include <QtCore/qhash.h> +#include <QtCore/qlist.h> +#include <QtGui/qicon.h> +#include <QtGui/qpixmap.h> +#include <QtCore/qabstractnativeeventfilter.h> #include "winshobjidl_p.h" diff --git a/src/winextras/qwinthumbnailtoolbutton.cpp b/src/winextras/qwinthumbnailtoolbutton.cpp index e89815c..9d04324 100644 --- a/src/winextras/qwinthumbnailtoolbutton.cpp +++ b/src/winextras/qwinthumbnailtoolbutton.cpp @@ -80,9 +80,7 @@ QWinThumbnailToolButton::QWinThumbnailToolButton(QObject *parent) : /*! Destroys the QWinThumbnailToolButton. */ -QWinThumbnailToolButton::~QWinThumbnailToolButton() -{ -} +QWinThumbnailToolButton::~QWinThumbnailToolButton() = default; /*! \property QWinThumbnailToolButton::toolTip diff --git a/src/winextras/windowsguidsdefs_p.h b/src/winextras/windowsguidsdefs_p.h index d0e0788..73dc0e7 100644 --- a/src/winextras/windowsguidsdefs_p.h +++ b/src/winextras/windowsguidsdefs_p.h @@ -51,8 +51,8 @@ // We mean it. // -#include <QtGlobal> -#include <qt_windows.h> +#include <QtCore/qglobal.h> +#include <QtCore/qt_windows.h> QT_BEGIN_NAMESPACE diff --git a/src/winextras/winpropkey_p.h b/src/winextras/winpropkey_p.h index 7e89970..53646fc 100644 --- a/src/winextras/winpropkey_p.h +++ b/src/winextras/winpropkey_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtGlobal> +#include <QtCore/qglobal.h> #include <propkey.h> QT_BEGIN_NAMESPACE diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 8a63e25..8383194 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -29,6 +29,7 @@ #include <QtTest/QtTest> #include <QtCore/qt_windows.h> #include <QtCore/QFileInfo> +#include <QtGui/QPainter> #include <QtGui/QPixmap> #include <QtGui/QImage> #include <QtWinExtras/QtWin> @@ -53,6 +54,8 @@ private slots: void fromHICON_data(); void fromHICON(); + void imageConversion(); + private: const QString m_dataDirectory; }; @@ -279,6 +282,21 @@ void tst_QPixmap::fromHICON() QVERIFY2(compareImages(imageFromHICON, imageFromFile, &errorMessage), errorMessage.constData()); } +void tst_QPixmap::imageConversion() +{ + // Extensive testing of all formats is done in QtGui; this merely tests + // the exports/linkage. + QImage image(73, 57, QImage::Format_ARGB32_Premultiplied); + image.fill(Qt::red); + QPainter painter(&image); + painter.drawLine(0, 0, image.width(), image.height()); + const HBITMAP hBitMap = QtWin::imageToHBITMAP(image); + QVERIFY(hBitMap); + const QImage fromHBitMap = QtWin::imageFromHBITMAP(hBitMap, QtWin::HBitmapPremultipliedAlpha); + QCOMPARE(fromHBitMap, image); + DeleteObject(hBitMap); +} + QTEST_MAIN(tst_QPixmap) #include "tst_qpixmap.moc" |