* Jim Bublitz [Fri, 03 Aug 2007 23:23:37 -0700]:

> It could be a bug in the C++ KDE code, although I'd be surprised (a C++ test 
> case would be helpful).

Please find attached my attempt at traducing the Python example to C++.
Compiles (*) and runs fine, I hope it can be of any help.

  (*) moc gaccel.cc >gaccel_moc.cc && g++ -o gaccel -I/usr/include/kde 
-I/usr/include/qt3 gaccel.cc -lqt-mt -lkdecore -lkdeui && ./gaccel

> It could also be some misunderstanding of how to use 
> KGlobalAccel, but that seems unlikely too. It's probably a PyKDE problem, but 
> it's one I'd find very difficult to track down and what time I have to spend 
> on PyKDE is going to the upcoming KDE4 version. With that only a few months 
> away, I'm reluctant to spend a lot of time on PyKDE3, and this looks like it 
> would take a lot of time - I've spent a few hours on and off on it today

> If I get some free time, I'll try to get back to it, but that's not likely at 
> the moment - sorry. Anyone else is welcome to look into it.

Okay, I understand you want to focus in KDE4. It's only the application
I was writing really needs global shortcuts. Thanks for your efforts so
far, though.

Cheers,

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
Testing can show the presence of bugs, but not their absence.
                -- Dijkstra
#include <iostream>

#include <kapplication.h>
#include <kcmdlineargs.h>
#include <kmainwindow.h>
#include <kglobalaccel.h>
#include <kshortcut.h>

class MainWindow : public KMainWindow
{
    Q_OBJECT;

    public:
      MainWindow();
      ~MainWindow();

    private:
    	KGlobalAccel *gaccel;

    public slots:
    	void slot_action();
};

MainWindow::MainWindow() : KMainWindow()
{
      gaccel = new KGlobalAccel(this);
      gaccel->insert("action", "Action", "", KShortcut("Ctrl+Alt+u"), 0, this, SLOT(slot_action()));
      gaccel->updateConnections();
}

MainWindow::~MainWindow()
{
    delete gaccel;
}

void
MainWindow::slot_action()
{
      std::cout << "Inside slot_action()" << std::endl;
}

int
main (int argc, char **argv)
{
    KCmdLineArgs::init(argc, argv, "test", "test", "test", "1.0");
    KApplication app;
    MainWindow *window = new MainWindow;

    app.setTopWidget(window);
    window->show();
    return app.exec();
}

#include "gaccel_moc.cc"
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to