mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Windows: Fix a regression in calibre 6 causing Open With to not extract icons from EXE files. Fixes #1998165 [Enhancement Request: Changing icon of Open With application: Icons from executable](https://bugs.launchpad.net/calibre/+bug/1998165)
More pyqt6 goodness. QImage::fromHICON is not wrapped in PyQt6, so we wrap it ourselves rather than waiting for PyQt6 to be fixed.
This commit is contained in:
parent
1f7af6dd02
commit
7e7b8e75e6
@ -133,3 +133,13 @@ int
|
||||
get_image_allocation_limit() {
|
||||
return QImageReader::allocationLimit();
|
||||
}
|
||||
|
||||
QImage
|
||||
image_from_hicon(void* hicon) {
|
||||
#ifdef Q_OS_WIN
|
||||
return QImage::fromHICON((HICON)hicon);
|
||||
#else
|
||||
(void)hicon;
|
||||
return QImage();
|
||||
#endif
|
||||
}
|
||||
|
@ -162,3 +162,4 @@ void set_menu_on_action(QAction* ac, QMenu* menu);
|
||||
QMenu* menu_for_action(const QAction *ac);
|
||||
void set_image_allocation_limit(int megabytes);
|
||||
int get_image_allocation_limit();
|
||||
QImage image_from_hicon(void* hicon);
|
||||
|
@ -89,3 +89,4 @@ void set_menu_on_action(QAction* ac, QMenu* menu);
|
||||
QMenu* menu_for_action(const QAction *ac);
|
||||
void set_image_allocation_limit(int megabytes);
|
||||
int get_image_allocation_limit();
|
||||
QImage image_from_hicon(void*);
|
||||
|
@ -6,17 +6,17 @@ __copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import re
|
||||
import sys
|
||||
from qt.core import QBuffer, QByteArray, QImage, QIODevice, QPixmap, Qt
|
||||
from qt.core import QBuffer, QByteArray, QIODevice, QPixmap, Qt
|
||||
|
||||
from calibre.gui2 import must_use_qt
|
||||
from calibre.utils.winreg.default_programs import split_commandline
|
||||
from calibre_extensions import winutil
|
||||
from calibre_extensions import winutil, progress_indicator
|
||||
|
||||
ICON_SIZE = 256
|
||||
|
||||
|
||||
def hicon_to_pixmap(hicon):
|
||||
QPixmap.fromImage(QImage.fromHICON(int(hicon)))
|
||||
return progress_indicator.image_from_hicon(int(hicon))
|
||||
|
||||
|
||||
def pixmap_to_data(pixmap):
|
||||
|
Loading…
x
Reference in New Issue
Block a user