You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, December 18th 2015, 9:46am

ColorWheel Widget in QMenu of trayicon

Hi Guys,

since days I am trying to add a colorwheel to my menu of the trayicon. I know that it works with the qwidgetaction. The menu shows the slot for the widgetaction, but doesn't show the widget. It is an empty slot.

Who can help me out?
My Code:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
	trayicon = new QSystemTrayIcon(window);
	QSize *size = new QSize();
	size->setHeight(50);
	size->setWidth(50);
	QIcon icon;
	icon.addFile("/path/to/file.ico", *size);
	trayicon->setIcon(icon);

	traymenu = new QMenu(window);
	trayActionColor = new QWidgetAction(traymenu);
	trayColorWheel = new ColorWheel(traymenu);

	QLayout *layouts = new QHBoxLayout();
	QWidget *widget = new QWidget();
	layouts->addWidget(trayColorWheel);
	widget->setLayout(layouts);

	trayActionColor->setDefaultWidget(widget);
	traymenu->addAction(trayActionColor);

	trayicon->setContextMenu(traymenu);
	trayicon->show();




Thanks and greetings,
Fabian

Similar threads

Used tags

cpp, menu, tray, widget