1

システム トレイに現在の時刻を表示するデジタル時計を作成したいだけです。

QPainter を使用してアイコンを描画し、それを QSystemTrayIcon オブジェクトに設定できますが、アイコンのサイズは常に 22x22 ピクセルです。

これを達成するにはどうすればよいですか。PyGTK は単にトレイ アイコン オブジェクトにラベルを追加できることを知っています。

4

1 に答える 1

1

"Icon was resized to 22x22 pixels", I will assume that you are running your application on X11-based system (Ubuntu or other linux distribution.)

In QSystemTrayIcon doc, it says that your icon will be resized according to OS you use:

On Windows, the system tray icon size is 16x16; on X11, the preferred size is 22x22. The icon will be scaled to the appropriate size as necessary

You can still workaround this by:

  1. Create two 22x22 system tray icons with QPainter: one for hours, and another for minutes
  2. Show two system tray icons (Hours on the left, minute on the right)

This workaround is prone to error, because icons may be shown in the wrong order. If X11 is your only target platform, I would strongly recommend you to use pygtk.

于 2012-10-20T10:17:51.363 に答える