开发者

how to use QtSingleApplication bt the so file?

I need to use QtSingleApplication in my Qt application. I didn't understand from the开发者_如何学JAVA documentation how to use the add on by the so file. can you please help me? (step by step)

thanks!


It is pretty straightforward, put the following in main.cpp:

#include <QtSingleApplication>
#include <QWidget>


int main(int argc, char **argv)
{
  QtSingleApplication app(argc, argv);

  // if application is running, we terminate it
  if (app.isRunning())
    return 0;

  // application wasn't running, so we go on with our lives
  QWidget w;
  app.setActivationWindow(&w);
  w.show();

  return app.exec();
}

and in project's .pro file:

INCLUDE += -I/usr/local/include
LIBS += -L/usr/local/lib -lQtSingleApplication

and then perform the usual drill:

qmake
make
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜