Fix windows7thumbbar.cpp and osdpretty.cpp (#5588)

* fix problem with toWinHICON() in Qt5

* fix Windows (Qt5) build (conversion to HWND)
This commit is contained in:
Pavel Vatagin 2017-01-10 00:11:27 +04:00 committed by John Maguire
parent 446b382c74
commit b52c99755d
2 changed files with 8 additions and 5 deletions

View File

@ -53,10 +53,13 @@ void Windows7ThumbBar::SetActions(const QList<QAction*>& actions) {
}
#ifdef Q_OS_WIN32
extern HICON qt_pixmapToWinHICON(const QPixmap &p);
static void SetupButton(const QAction* action, THUMBBUTTON* button) {
if (action) {
button->hIcon =
action->icon().pixmap(Windows7ThumbBar::kIconSize).toWinHICON();
qt_pixmapToWinHICON(action->icon().pixmap(Windows7ThumbBar::kIconSize));
button->dwFlags = action->isEnabled() ? THBF_ENABLED : THBF_DISABLED;
// This is unsafe - doesn't obey 260-char restriction
action->text().toWCharArray(button->szTip);
@ -130,7 +133,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG* msg) {
}
qLog(Debug) << "Adding buttons";
hr = taskbar_list->ThumbBarAddButtons(widget_->winId(), actions_.count(),
hr = taskbar_list->ThumbBarAddButtons((HWND)widget_->winId(), actions_.count(),
buttons);
if (hr != S_OK) qLog(Debug) << "Failed to add buttons" << hex << DWORD(hr);
for (int i = 0; i < actions_.count(); i++) {
@ -164,7 +167,7 @@ void Windows7ThumbBar::ActionChanged() {
if (buttons->hIcon > 0) DestroyIcon(buttons->hIcon);
}
taskbar_list->ThumbBarUpdateButtons(widget_->winId(), actions_.count(),
taskbar_list->ThumbBarUpdateButtons((HWND)widget_->winId(), actions_.count(),
buttons);
#endif // Q_OS_WIN32
}

View File

@ -76,9 +76,9 @@ OSDPretty::OSDPretty(Mode mode, QWidget* parent)
#ifdef Q_OS_WIN32
// Don't show the window in the taskbar. Qt::ToolTip does this too, but it
// adds an extra ugly shadow.
int ex_style = GetWindowLong(winId(), GWL_EXSTYLE);
int ex_style = GetWindowLong((HWND)winId(), GWL_EXSTYLE);
ex_style |= WS_EX_NOACTIVATE;
SetWindowLong(winId(), GWL_EXSTYLE, ex_style);
SetWindowLong((HWND)winId(), GWL_EXSTYLE, ex_style);
#endif
// Mode settings