KSensors from qt/kde 3 to qt/kde 4 -> Right-click menus on ksensors or the traybar do not work
-

The port is starting to work, but still has big problems.
- Right-click menus on ksensors or the traybar do not work and sometimes close the application.
- Does not display the sensor in the traybar
- Graphic indicators do not update.
- Configuration and saving of sensors not tested.
Whats wrong with new menu code?
void LMSensorsDock::createMenu()
{
menu= new KMenu;
menu->addTitle(KIcon( "ksensors" ), "KSensors");
menu->contextMenu()->addAction(KIcon( "configure" ),i18n("&Configure"), this, SLOT(createConfigWidget() ));
menu->contextMenu()->addSeparator();
menu->contextMenu()->addAction(KIcon( "ksensors" ),i18n("&About KSensors"), this, SLOT(showAbout() ));
menu->contextMenu()->addSeparator();
if(!noDock) menu->contextMenu()->addAction(sensorsWidget ? i18n("&Minimize"):i18n("&Restore"), this, SLOT(minimizeRestoreWidget() ));
menu->contextMenu()->addAction(SmallIcon("exit"),i18n("&Exit"), this, SLOT(close() ));
}Original menu code
void LMSensorsDock::createMenu()
{
menu= new KPopupMenu;
menu->insertTitle(kapp->miniIcon(),"KSensors");
menu->insertItem(SmallIcon("configure"),i18n("&Configure"), this, SLOT(createConfigWidget() ) ,0,101 );
menu->insertSeparator();
menu->insertItem(kapp->miniIcon() ,i18n("&About KSensors"), this, SLOT(showAbout() ) ,0,103 );
menu->insertSeparator();
if(!noDock) menu->insertItem(sensorsWidget ? i18n("&Minimize"):i18n("&Restore"), this, SLOT(minimizeRestoreWidget() ) ,0,100 );
menu->insertItem(SmallIcon("exit"),i18n("&Exit"), this, SLOT(close()),0,102);
} -

The port is starting to work, but still has big problems.
- Right-click menus on ksensors or the traybar do not work and sometimes close the application.
- Does not display the sensor in the traybar
- Graphic indicators do not update.
- Configuration and saving of sensors not tested.
Whats wrong with new menu code?
void LMSensorsDock::createMenu()
{
menu= new KMenu;
menu->addTitle(KIcon( "ksensors" ), "KSensors");
menu->contextMenu()->addAction(KIcon( "configure" ),i18n("&Configure"), this, SLOT(createConfigWidget() ));
menu->contextMenu()->addSeparator();
menu->contextMenu()->addAction(KIcon( "ksensors" ),i18n("&About KSensors"), this, SLOT(showAbout() ));
menu->contextMenu()->addSeparator();
if(!noDock) menu->contextMenu()->addAction(sensorsWidget ? i18n("&Minimize"):i18n("&Restore"), this, SLOT(minimizeRestoreWidget() ));
menu->contextMenu()->addAction(SmallIcon("exit"),i18n("&Exit"), this, SLOT(close() ));
}Original menu code
void LMSensorsDock::createMenu()
{
menu= new KPopupMenu;
menu->insertTitle(kapp->miniIcon(),"KSensors");
menu->insertItem(SmallIcon("configure"),i18n("&Configure"), this, SLOT(createConfigWidget() ) ,0,101 );
menu->insertSeparator();
menu->insertItem(kapp->miniIcon() ,i18n("&About KSensors"), this, SLOT(showAbout() ) ,0,103 );
menu->insertSeparator();
if(!noDock) menu->insertItem(sensorsWidget ? i18n("&Minimize"):i18n("&Restore"), this, SLOT(minimizeRestoreWidget() ) ,0,100 );
menu->insertItem(SmallIcon("exit"),i18n("&Exit"), this, SLOT(close()),0,102);
}Hi,
You might want to contact the KDE folks since you are using mainly their APIs.
That said, current KDE is on KF5 with a steady work going on to KF6 and Qt 6 so you might want to consider targeting these versions.
-
Hi,
You might want to contact the KDE folks since you are using mainly their APIs.
That said, current KDE is on KF5 with a steady work going on to KF6 and Qt 6 so you might want to consider targeting these versions.
@SGaist Hi.
Okay.
The reasons are/were
-
Below kmenu is qmenu, kmenu does rather little.
-
Porting from qt/kde 3 to qt/kde 4 (at least for me) is already very difficult and bordering on impossible, double or triple jumping I think would kill me.
-
90% of problems are due to disappearance of objects, methods, events, and behavior changes in new qt versions.
(connects, events, layout management, it's a hell of a battle).
-
-
@SGaist Hi.
Okay.
The reasons are/were
-
Below kmenu is qmenu, kmenu does rather little.
-
Porting from qt/kde 3 to qt/kde 4 (at least for me) is already very difficult and bordering on impossible, double or triple jumping I think would kill me.
-
90% of problems are due to disappearance of objects, methods, events, and behavior changes in new qt versions.
(connects, events, layout management, it's a hell of a battle).
The issue here is that you want to port to a version of Qt that has reached end of life quite a long time ago and for a version of KDE that is also deprecated.
You might want to consider using ksensors as a base and rewrite the thing from scratch.
Depending on what you want to do, did you check whether KSysGuard does what you want ?
-
-
The issue here is that you want to port to a version of Qt that has reached end of life quite a long time ago and for a version of KDE that is also deprecated.
You might want to consider using ksensors as a base and rewrite the thing from scratch.
Depending on what you want to do, did you check whether KSysGuard does what you want ?
@SGaist I fixed it, found some forum posts reporting problems with qsystemtryicon, and explaining how to fix it with activated events and such.
Luckily kmenu and ksystemtrayicon are little more than a hat over qt.P.S. I made my assessments, and also seeing that I have to do the job myself, I decided to port to step 3 -> 4 -> 5 -> 6.
-
G giusdbg has marked this topic as solved on
-
@SGaist I fixed it, found some forum posts reporting problems with qsystemtryicon, and explaining how to fix it with activated events and such.
Luckily kmenu and ksystemtrayicon are little more than a hat over qt.P.S. I made my assessments, and also seeing that I have to do the job myself, I decided to port to step 3 -> 4 -> 5 -> 6.
-
The issue here is that you want to port to a version of Qt that has reached end of life quite a long time ago and for a version of KDE that is also deprecated.
You might want to consider using ksensors as a base and rewrite the thing from scratch.
Depending on what you want to do, did you check whether KSysGuard does what you want ?
@SGaist Just for information and if you are interested.
After weeks of daily use of ksensors qt/kde 4, I started porting it to qt/kde 5.
This time there are a ton of changes in the cmake configuration, in the kde api (several things have been eliminated, you have to use qt directly or rebuild from scratch) and some in qt (a few things even if delicate).
It's much more difficult and heavier than I had hoped, on the other hand the progress is much faster, in leaps.
After this port I would say that ksensors has definitely entered on modern/recent projects, at least more than many others.
