PDA

View Full Version : QApplication: GUIServer and GUIClient.



zuck
20th March 2009, 00:46
Hi.

In a previous (http://www.qtcentre.org/forum/f-qt-programming-2/t-problem-with-qt-plugin-system-19606.html) thread I've asked for some doubts about the Qt plugin system. My needs are to realize a Qtopia/QtExtended-style embedded system.

I have a server application (derived from QApplication with GuiServer flag), with its main entry-point function.

Now I'm trying to understand how can I run third-party applications from my server. Is the plugin system the best solution or should I use QApplication instances with GuiClient flag?

In the second case, is this base layout correct?



class pkServer : public QApplication
{
// It inherits from QApplication with GuiServer flag.
}

class pkApplication : public QApplication
{
// It inherits from QApplication with GuiClient flag.
}

int main(int argc, char **argv)
{
pkServer srv(argc, argv);

if (srv.startUp()) {

pkApplication client(argc, argv);
client.startUp() // The client app shows its widgets here.

// ...other clients here...

return pkServer::exec();
}

return pkServer::StartupFailure;
}


Thanks for your answers! :)

wysota
20th March 2009, 01:34
You can't have more than one QApplication instance in your application. You can either treat "client apps" as separate processes and start them with QProcess or load them as plugins and execute a defined method from their interface. They will use your application object as theirs and build upon it. It gives more control but less stability than separate processes.