Recent

Author Topic: [fixed] Icons and QT  (Read 10198 times)

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
[fixed] Icons and QT
« on: October 30, 2011, 02:59:48 pm »
I run into some trouble with QT on Darwin. Any icon that is enabled will not be shown, disabled icons are okay. That's true for Lazarus itself as well as my application. At least my program stores icons in a TImageList and operates them by a TActionList. Furthermore, it paints some icons in a TListView at OnAdvancedCustomDrawIcon. A basic icon from an imagelist is overlaid there by some other graphic stuff (country flag) that is stored in a resource. The resource based part is painted nicely but not the basic icon from the imagelist.

What can I do?

Qt4Pas.framework/Versions/5/Qt4Pas (compatibility version 5.2.0, current version 5.2.4)
Lazarus and Fpc from svn (doesn't matter if Lazarus is compiled with 2.4.4 or 2.7.1)
« Last Edit: May 13, 2012, 04:22:03 pm by Ocye »
Lazarus 1.7 (SVN) FPC 3.0.0

Shebuka

  • Sr. Member
  • ****
  • Posts: 422
Re: Icons and QT
« Reply #1 on: November 02, 2011, 10:45:02 am »
There are more problems with QT on Mac, look at my post here (comparison images):

http://www.lazarus.freepascal.org/index.php/topic,13307.msg77119.html#msg77119

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Icons and QT
« Reply #2 on: December 11, 2011, 04:07:50 pm »
indeed, today installed qt-4.6.3 and there's no icons ... afair it was ok before (qt-4.5.XX)
What qt version you have ?

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Icons and QT
« Reply #3 on: December 11, 2011, 04:32:43 pm »
Running QT 4.7.4. on Linux all looks fine (Lazarus 0.9.31 r33990M FPC 2.7.1 x86_64-linux-qt). I'm not sure how to access QT version on MacOS. "qmake -v" says "Using Qt version 4.7.4 in /Library/Frameworks..." (Lazarus 0.9.31 r33172M, FPC 2.4.4 i386-darwin-qt).
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Icons and QT
« Reply #4 on: December 11, 2011, 08:04:21 pm »
Fixed: 1.Empty images , 2.Black mask of application icons.
Seem that both problems are qt bugs related to QPixmap on mac.
In first case I've just converted QPixmap to QImage and then QPainter_drawImage() (was QPainter_drawPixmap()), in second case I've stopped adding mask into ARGB32 image
while creating QIcon.
See svn r34114

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Icons and QT
« Reply #5 on: December 11, 2011, 09:41:31 pm »
Lazarus is okay now but my own application has still blank areas for enabled toolbuttons. Icons for disabled toolbuttons are shown well. Strangely, within the designer all icons are okay.
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Icons and QT
« Reply #6 on: December 12, 2011, 07:48:47 am »
What mac version do you have ? It's ok on Mac 10.4.11 , also I'm using qt 4.6.3 since I had problems with linker with qt-4.7.XX

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Icons and QT
« Reply #7 on: December 12, 2011, 11:40:07 am »
It's MacOS 10.6 within a VirtualBox. ld complains a lot of stub errors but the application works without failure. I guess there are some special tricks or settings since Lazarus is okay. I compiled as
Code: [Select]
make clean all LCL_PLATFORM=qt FPC=/usr/local/lib/fpc/2.4.4./ppc386
My Lazarus settings are
Code: [Select]
-MObjFPC -Scghi -CX -Cirot -O2 -g -gl -Xs -XX -vewnhib -l -FuSynapse -Fu/usr/local/src/Lazarus/lcl/units/i386-darwin/qt -Fu/usr/local/src/Lazarus/lcl/units/i386-darwin -Fu/usr/local/src/Lazarus/packager/units/i386-darwin -Fu. -vm4048,4049,5024,5057 -dLCL -dLCLqtThe toolbar is linked with a TActionList which uses a TImageList to access icons. Icon size is 22x22 (could this be relevant?)
I attached two screenshots, one from the designer and the other of running application. The first two icons are enabled with complete functionalty.
« Last Edit: December 12, 2011, 11:44:02 am by Ocye »
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Icons and QT
« Reply #8 on: December 12, 2011, 03:57:08 pm »
1. Are you sure that it builds ? There's no linker options. How it links libQt4Pas then ??
My command line under mac is :
make bigide LCL_PLATFORM=qt OPT="-k'-framework' -k'libQt4Pas' -k'-framework' -k'-QtGui'  ...more frameworks of qt...etc.

2. Please open an issue about problem and attach example application - that's best way to get it fixed, also would be nice if you can provide icons separately.

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Icons and QT
« Reply #9 on: December 12, 2011, 05:39:20 pm »
I created a new application that shows the problem. Perhaps, it's a question of the Toolbar which doesn't get the image information from the actionlist. Should I file a new bug report on mantis?

My compiler options are "-MObjFPC -Scghi -O1 -g -gl -vewnhi -l -Filib/i386-darwin -Fu/usr/local/src/Lazarus/lcl/units/i386-darwin/qt -Fu/usr/local/src/Lazarus/lcl/units/i386-darwin -Fu/usr/local/src/Lazarus/packager/units/i386-darwin -Fu. -FUlib/i386-darwin/ -dLCL -dLCLqt". I have no idea where additional linker options except settings within Lazarus are specified. As far as I understand -XX and -Wg e.g. are submitted if set. I tested with and without debugger enabled, with and without win32 and smart option. No effect.
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Icons and QT
« Reply #10 on: December 12, 2011, 06:02:58 pm »
@Ocye, please open issue and attach example there so I can look into and also, it will be documented in that case.

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Icons and QT
« Reply #11 on: December 12, 2011, 07:09:30 pm »
Oups, I forgot the attachment. Bugreport has been created (http://bugs.freepascal.org/view.php?id=20891).
It's always a good idea to write down the stuff. It has remind me that I'm using 2.7.1 for my project (in contrast to 2.4.4 for Lazarus). But the problem exists as well with the latest update from svn. Perhaps that helps identifying the reason.
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Icons and QT
« Reply #12 on: December 14, 2011, 12:05:14 pm »
@Ocye, I cannot reproduce your problem (MacOSX 10.4.11, Qt-4.6.3 (cocoa 32bit version), fpc-2.4.5,trunk lazarus) - with your attached example. Probably you need to add more icons, and would be nice if you zip those problematic icons  and attach them too.

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Icons and QT
« Reply #13 on: December 15, 2011, 01:23:17 pm »
Strange. Can I locate the problem by debugging? Where should I look for inconsistencies?
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Icons and QT
« Reply #14 on: December 17, 2011, 09:00:03 pm »
I don't know, I've installed Snow Leopard in the meantime, so tomorrow I'll try with qt-cocoa 64bit.