0
我剛開始爲KDE編程,我面臨的問題是,我不知道究竟應該是一個KDE項目的親文件,我有一個想法的cmake雖然的Hello World的KDE在Qtcreator
我也試過在親文件:
LIBS + = -lkdeui
我仍然得到問題KApplication沒有發現
代碼main.cpp中:
#include <cstdlib>
#include <KApplication>
#include <KAboutData>
#include <KCmdLineArgs>
#include <KMessageBox>
#include <KLocale>
int main (int argc, char *argv[])
{
KAboutData aboutData("tutorial1",0,ki18n("Tutorial 1"),"1.0",ki18n("Displays a KMessageBox popup"),KAboutData::License_GPL,ki18n("(c) 2007"),ki18n("Some text..."),"http://example.com/","[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KApplication app;
KGuiItem yesButton(i18n("Hello"), QString(),
i18n("This is a tooltip"),
i18n("This is a WhatsThis help text."));
return
KMessageBox ::questionYesNo
(0, i18n("Hello World"), i18n("Hello"), yesButton)
== KMessageBox ::Yes? EXIT_SUCCESS: EXIT_FAILURE;
}
和tutorial.pro文件是:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
LIBS += -lkdeui
PLZ給我完成Pro文件內容 – shivshnkr 2013-03-19 13:30:14
試試下面的項目文件,它應該工作: '模板=應用 CONFIG + = QT LIBS + = -lkdecore -lkdeui INCLUDEPATH + =/usr/include目錄/ KDE SOURCES + = main.cpp' – Dmitry 2013-03-19 19:05:24
運行代碼,它會編譯並執行,但不會顯示GUI,除了空的konsole屏幕.... – shivshnkr 2013-03-25 10:06:36