Recent

Author Topic: Where are the images of MenuItem?  (Read 9371 times)

Yakumo500

  • New Member
  • *
  • Posts: 30
Where are the images of MenuItem?
« on: November 06, 2011, 04:51:24 pm »
Hi,
I'm using QT under Linux because it draws faster text than GTK2. However now I want to use a mainmenu and i recognize that the QT mainmenu doesn't support images.

Is there a way to show images in menuitems?

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Where are the images of MenuItem?
« Reply #1 on: November 06, 2011, 07:06:47 pm »
I guess icons are shown if item is disabled (-> Thread: Icons and QT).
Lazarus 1.7 (SVN) FPC 3.0.0

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Where are the images of MenuItem?
« Reply #2 on: November 07, 2011, 01:25:29 am »
Quote
Is there a way to show images in menuitems?
Probably no. You can use TToolBar instead of TMainMenu and assign some images from your TImageList to TToolButtons and show their captions. You can create TPopupMenus and assign them to TToolButtons (as their DropDownMenu property).
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Where are the images of MenuItem?
« Reply #3 on: November 07, 2011, 09:08:33 pm »
If you are willing to put in the effort, you can construct your own with a combination of TPanels, TImages, TLabels and TPopupMenus.  But it sounds like a lot of work just to get some Icons.
Lazarus Trunk / fpc 2.6.2 / Win32

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: Where are the images of MenuItem?
« Reply #4 on: November 07, 2011, 11:02:19 pm »
Hi,
I'm using QT under Linux because it draws faster text than GTK2. However now I want to use a mainmenu and i recognize that the QT mainmenu doesn't support images.

Is there a way to show images in menuitems?

All sub-menuitems in MainMenu do supports images. Set Images property in MainMenu and ImageIndex property in MenuItems.
Top-level menuitems do not support images in a portable way but GTK2 and Windows seem to draw them. LCL MainMenu for Windows  is actually a custom-drawn control because some Windows versions don't support images in menus at all.

QT bindings seem to have a bug. If you set ImageIndex for a top-level menuitem then no images are shown even in sub-menus.
You could make a bug report of this.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Where are the images of MenuItem?
« Reply #5 on: November 08, 2011, 11:26:19 am »
If you are willing to put in the effort, you can construct your own with a combination of TPanels, TImages, TLabels and TPopupMenus.  But it sounds like a lot of work just to get some Icons.

No, that would not be an appropriate way to do it, but instead one should add a mainmenu component to the custom drawn controls package: http://wiki.lazarus.freepascal.org/Lazarus_Custom_Drawn_Controls

But such a custom drawn menu would bring other problems, for example it won't integrate in Mac OS X. So one has to measure the benefits and disadvantages.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: Where are the images of MenuItem?
« Reply #6 on: November 09, 2011, 01:27:46 pm »
I started to look at the QT bindings code and tried to solve the problem but I couldn't.
Now there is a bug-report. See:
 http://bugs.freepascal.org/view.php?id=20658

Yakumo500, didn't you see any icons in the menu? Or, did you see only icon but no text in top-level items?
It is strange that I saw a problem that all icons disappeared when top-level item's ImageIndex was defined, but now I can't reproduce it.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Where are the images of MenuItem?
« Reply #7 on: December 10, 2011, 10:48:48 am »
It cannot be solved, that's by design of qt.

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: Where are the images of MenuItem?
« Reply #8 on: December 12, 2011, 02:39:15 pm »
When i'v tried Qt for Mac i'v get a bunch of visual problems... and also icons problem in VST, see attached images:
http://www.lazarus.freepascal.org/index.php/topic,13307.msg77119.html#msg77119

 

TinyPortal © 2005-2018