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:
parent
446b382c74
commit
b52c99755d
@ -53,10 +53,13 @@ void Windows7ThumbBar::SetActions(const QList<QAction*>& actions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
|
|
||||||
|
extern HICON qt_pixmapToWinHICON(const QPixmap &p);
|
||||||
|
|
||||||
static void SetupButton(const QAction* action, THUMBBUTTON* button) {
|
static void SetupButton(const QAction* action, THUMBBUTTON* button) {
|
||||||
if (action) {
|
if (action) {
|
||||||
button->hIcon =
|
button->hIcon =
|
||||||
action->icon().pixmap(Windows7ThumbBar::kIconSize).toWinHICON();
|
qt_pixmapToWinHICON(action->icon().pixmap(Windows7ThumbBar::kIconSize));
|
||||||
button->dwFlags = action->isEnabled() ? THBF_ENABLED : THBF_DISABLED;
|
button->dwFlags = action->isEnabled() ? THBF_ENABLED : THBF_DISABLED;
|
||||||
// This is unsafe - doesn't obey 260-char restriction
|
// This is unsafe - doesn't obey 260-char restriction
|
||||||
action->text().toWCharArray(button->szTip);
|
action->text().toWCharArray(button->szTip);
|
||||||
@ -130,7 +133,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG* msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
qLog(Debug) << "Adding buttons";
|
qLog(Debug) << "Adding buttons";
|
||||||
hr = taskbar_list->ThumbBarAddButtons(widget_->winId(), actions_.count(),
|
hr = taskbar_list->ThumbBarAddButtons((HWND)widget_->winId(), actions_.count(),
|
||||||
buttons);
|
buttons);
|
||||||
if (hr != S_OK) qLog(Debug) << "Failed to add buttons" << hex << DWORD(hr);
|
if (hr != S_OK) qLog(Debug) << "Failed to add buttons" << hex << DWORD(hr);
|
||||||
for (int i = 0; i < actions_.count(); i++) {
|
for (int i = 0; i < actions_.count(); i++) {
|
||||||
@ -164,7 +167,7 @@ void Windows7ThumbBar::ActionChanged() {
|
|||||||
if (buttons->hIcon > 0) DestroyIcon(buttons->hIcon);
|
if (buttons->hIcon > 0) DestroyIcon(buttons->hIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
taskbar_list->ThumbBarUpdateButtons(widget_->winId(), actions_.count(),
|
taskbar_list->ThumbBarUpdateButtons((HWND)widget_->winId(), actions_.count(),
|
||||||
buttons);
|
buttons);
|
||||||
#endif // Q_OS_WIN32
|
#endif // Q_OS_WIN32
|
||||||
}
|
}
|
||||||
|
@ -76,9 +76,9 @@ OSDPretty::OSDPretty(Mode mode, QWidget* parent)
|
|||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
// Don't show the window in the taskbar. Qt::ToolTip does this too, but it
|
// Don't show the window in the taskbar. Qt::ToolTip does this too, but it
|
||||||
// adds an extra ugly shadow.
|
// 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;
|
ex_style |= WS_EX_NOACTIVATE;
|
||||||
SetWindowLong(winId(), GWL_EXSTYLE, ex_style);
|
SetWindowLong((HWND)winId(), GWL_EXSTYLE, ex_style);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Mode settings
|
// Mode settings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user