View Issue Details

IDProjectCategoryView StatusLast Update
0026587LazarusWidgetsetpublic2014-09-10 13:22
ReporterGabor Boros Assigned ToZeljan Rikalo  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinux x86_64OSUbuntu 
Product Version1.3 (SVN) 
Target Version1.2.6 
Summary0026587: GetDialogIcon return icons from resource instead from KDE
DescriptionIn example GetDialogIcon(idDialogInfo) return a light bulb instead a white "i" with blue background. With Win32(Qt and native) works properly.
Steps To ReproduceImage1.Picture.Bitmap.Assign(GetDialogIcon(idDialogInfo))
TagsNo tags attached.
Fixed in Revision46167
LazTarget1.2.6
WidgetsetQT
Attached Files

Activities

Zeljan Rikalo

2014-08-27 13:47

developer   ~0076742

Where is example ? Please attach complete example project.

Zeljan Rikalo

2014-08-29 20:41

developer   ~0076785

On 32bit Fedora 14 (Qt-4.7.4) this works fine. Please attach example project.

Gabor Boros

2014-08-31 12:35

reporter  

example.tar.gz (127,515 bytes)

Gabor Boros

2014-08-31 12:35

reporter  

example_results.zip (54,386 bytes)

Gabor Boros

2014-08-31 12:36

reporter   ~0076801

Example project and results uploaded.

Gabor Boros

2014-09-06 09:36

reporter   ~0076921

Last edited: 2014-09-06 09:37

View 2 revisions

Tried with Kubuntu 14.04.1 i386 and got same result.

Zeljan Rikalo

2014-09-06 12:19

developer  

qtthemes_stock_icons.diff (1,743 bytes)   
Index: lcl/interfaces/qt/qtthemes.pas
===================================================================
--- lcl/interfaces/qt/qtthemes.pas	(revision 46140)
+++ lcl/interfaces/qt/qtthemes.pas	(working copy)
@@ -792,6 +792,9 @@
   AStdPixmap: QStyleStandardPixmap;
   opt: QStyleOptionH;
   IconSize: Integer;
+  AIcon: QIconH;
+  ASize: TSize;
+  ADialog: QMessageBoxH;
 begin
   case StockID of
     idButtonOk: AStdPixmap := QStyleSP_DialogOkButton;
@@ -822,22 +825,34 @@
   end;
 
   opt := QStyleOption_create(QStyleOptionVersion, QStyleOptionSO_Default);
-  APixmap := QPixmap_create();
+  AIcon := QIcon_create();
   if StockID in [idButtonOk..idButtonShield] then
     IconSize := GetPixelMetric(QStylePM_ButtonIconSize, opt, nil)
   else
+  if (StockID >= idDialogWarning) and (StockID <= idDialogShield) then
+    IconSize := GetPixelMetric(QStylePM_MessageBoxIconSize, opt, nil)
+  else
     IconSize := 0;
-  QStyle_standardPixmap(QApplication_style(), APixmap, AStdPixmap, opt);
+  QStyle_standardIcon(QApplication_style(), AIcon, AStdPixmap, opt);
   QStyleOption_Destroy(opt);
 
-  if QPixmap_isNull(APixmap) then
+  if QIcon_isNull(AIcon) then
   begin
-    QPixmap_destroy(APixmap);
+    QIcon_destroy(AIcon);
     Result := inherited GetStockImage(StockID, Image, Mask);
     Exit;
   end;
 
   // convert from what we have to QImageH
+  APixmap := QPixmap_create();
+  if IconSize > 0 then
+  begin
+    ASize.cx := IconSize;
+    ASize.cy := IconSize;
+  end else
+    QIcon_actualSize(AIcon, @ASize, @ASize, QIconNormal, QIconOn);
+  QIcon_pixmap(AIcon, APixmap, PSize(@ASize), QIconNormal, QIconOn);
+  QIcon_destroy(AIcon);
   AImage := QImage_create();
   QPixmap_toImage(APixmap, AImage);
   QPixmap_destroy(APixmap);
qtthemes_stock_icons.diff (1,743 bytes)   

Zeljan Rikalo

2014-09-06 12:20

developer   ~0076926

Please test with attached patch. Note that we do not use QStyle_standardPixmap() , but QStyle_standardIcon() which seem to return correct results for dialog icons.
Button icons should be tested because of possible regression in this case.

Zeljan Rikalo

2014-09-06 13:45

developer   ~0076931

Seem that qt is really buggy with such icons. While this patch is much better than current implementation eg. extracting idDialogConfirm shows info icon with oxygen theme , but correct one with others. Pretty strange. Buttons look ok.

Zeljan Rikalo

2014-09-06 14:17

developer   ~0076934

Mac and Win32 should be checked too against this patch.

Gabor Boros

2014-09-06 19:42

reporter   ~0076941

Patch working with Kubuntu 14.04.1 32bit and 64bit, Windows XP,7,8.1 32bit

I think oxygen not contains question icon:
http://websvn.kde.org/trunk/kdesupport/oxygen-icons/scalable/status/

Zeljan Rikalo

2014-09-09 19:33

developer   ~0077010

Please test and close if ok.

Gabor Boros

2014-09-10 13:22

reporter   ~0077039

Tested with trunk 46168.

Issue History

Date Modified Username Field Change
2014-08-13 20:23 Gabor Boros New Issue
2014-08-17 18:38 Zeljan Rikalo Assigned To => Zeljan Rikalo
2014-08-17 18:38 Zeljan Rikalo Status new => assigned
2014-08-27 13:47 Zeljan Rikalo LazTarget => -
2014-08-27 13:47 Zeljan Rikalo Note Added: 0076742
2014-08-27 13:47 Zeljan Rikalo Status assigned => feedback
2014-08-29 20:41 Zeljan Rikalo Status feedback => assigned
2014-08-29 20:41 Zeljan Rikalo Note Added: 0076785
2014-08-29 20:41 Zeljan Rikalo Status assigned => feedback
2014-08-31 12:35 Gabor Boros File Added: example.tar.gz
2014-08-31 12:35 Gabor Boros File Added: example_results.zip
2014-08-31 12:36 Gabor Boros Note Added: 0076801
2014-08-31 12:36 Gabor Boros Status feedback => assigned
2014-09-06 09:36 Gabor Boros Note Added: 0076921
2014-09-06 09:37 Gabor Boros Note Edited: 0076921 View Revisions
2014-09-06 12:19 Zeljan Rikalo File Added: qtthemes_stock_icons.diff
2014-09-06 12:20 Zeljan Rikalo Note Added: 0076926
2014-09-06 12:20 Zeljan Rikalo Status assigned => feedback
2014-09-06 13:45 Zeljan Rikalo Note Added: 0076931
2014-09-06 14:17 Zeljan Rikalo Note Added: 0076934
2014-09-06 19:42 Gabor Boros Note Added: 0076941
2014-09-06 19:42 Gabor Boros Status feedback => assigned
2014-09-09 19:33 Zeljan Rikalo Fixed in Revision => 46167
2014-09-09 19:33 Zeljan Rikalo LazTarget - => 1.2.6
2014-09-09 19:33 Zeljan Rikalo Note Added: 0077010
2014-09-09 19:33 Zeljan Rikalo Status assigned => resolved
2014-09-09 19:33 Zeljan Rikalo Resolution open => fixed
2014-09-09 19:33 Zeljan Rikalo Target Version => 1.2.6
2014-09-10 13:22 Gabor Boros Note Added: 0077039
2014-09-10 13:22 Gabor Boros Status resolved => closed