Getting Qt Creator setup properly



  • I just installed Qt Creator and I'm trying to compile one of the examples to get familiar with it. I'm getting an error that says " 'Quit' is not a member of 'QKeySequence' ". This makes me think that I don't have Qt Creator and the Qt library setup properly. I'm running this on a Fedora 11 32-bit PC.

    I tried to find some documentation on how to do this, but I couldn't really find anything that detailed how to download both the Qt Creator and the Qt library and get them to interact properly. Does anything like this exist? Or does anyone have any pointers on how I can get started with this?

    Thanks,
    Harry



  • Could you show us your code and paste the error text? This sounds like compilation error.



  • Here is the code (I created a GUI app using the wizard and that's the error I get when I try to compile it):

    @@
    void MainWindow::createActions()
    //! [17] //! [18]
    {
    newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
    newAct->setShortcuts(QKeySequence::New);
    newAct->setStatusTip(tr("Create a new file"));
    connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));

    //! [19]
    openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
    openAct->setShortcuts(QKeySequence::Open);
    openAct->setStatusTip(tr("Open an existing file"));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
    //! [18] //! [19]

    saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);
    saveAct->setShortcuts(QKeySequence::Save);
    saveAct->setStatusTip(tr("Save the document to disk"));
    connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
    
    saveAsAct = new QAction(tr("Save &As..."), this);
    saveAsAct->setShortcuts(QKeySequence::SaveAs);
    saveAsAct->setStatusTip(tr("Save the document under a new name"));
    connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));
    

    //! [20]
    exitAct = new QAction(tr("E&xit"), this);
    exitAct->setShortcuts(QKeySequence::Quit);
    //! [20]
    exitAct->setStatusTip(tr("Exit the application"));
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

    //! [21]
    cutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this);
    //! [21]
    cutAct->setShortcuts(QKeySequence::Cut);
    cutAct->setStatusTip(tr("Cut the current selection's contents to the "
    "clipboard"));
    connect(cutAct, SIGNAL(triggered()), textEdit, SLOT(cut()));

    copyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this);
    copyAct->setShortcuts(QKeySequence::Copy);
    copyAct->setStatusTip(tr("Copy the current selection's contents to the "
                             "clipboard"));
    connect(copyAct, SIGNAL(triggered()), textEdit, SLOT(copy()));
    
    pasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this);
    pasteAct->setShortcuts(QKeySequence::Paste);
    pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current "
                              "selection"));
    connect(pasteAct, SIGNAL(triggered()), textEdit, SLOT(paste()));
    
    aboutAct = new QAction(tr("&About"), this);
    aboutAct->setStatusTip(tr("Show the application's About box"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
    

    //! [22]
    aboutQtAct = new QAction(tr("About &Qt"), this);
    aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
    connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    //! [22]

    //! [23]
    cutAct->setEnabled(false);
    //! [23] //! [24]
    copyAct->setEnabled(false);
    connect(textEdit, SIGNAL(copyAvailable(bool)),
    cutAct, SLOT(setEnabled(bool)));
    connect(textEdit, SIGNAL(copyAvailable(bool)),
    copyAct, SLOT(setEnabled(bool)));
    }
    @@

    Thanks
    Harry



  • hdevine, it very hard to read your code, wrap it with code tags, please.

    UPD: Some code parts are missing.



  • I just edited the code above. I hope it comes out more readable.

    Harry



  • Hm, that strange. Looks like it doesn't like setShortcuts() function call for exitAct (according to what you say). I wrote some code with it, and it compiled successfully. Could you paste the error that the compiler gives you?



  • /home/hdevine/application-build-desktop/../application/mainwindow.cpp:: In member function ‘void MainWindow::createActions()’:

    /home/hdevine/application-build-desktop/../application/mainwindow.cpp:177: error: ‘Quit’ is not a member of ‘QKeySequence’

    Like I said earlier: I downloaded the latest Qt library and compiled it, and I downloaded and installed the Qt Creator IDE. That error is given in the Qt Creator IDE, so I suspect that I don't have it configured to look at the proper Qt libarary. But I can't find any docs on how to do that.

    Thanks!
    Harry


  • Moderators

    Does a unmodified project set up by creator build and run fine?

    If it does then you probably have set up Qt and creator properly. Check your code then. If not, check the Qt and creator setup.



  • No, because I setup this project using the Creator and get that error. I didn't modify any code whatsoever. The Creator generated all of it using its wizard.

    Harry


  • Moderators

    Creator's wizard does setup a project with an empty MainWindow. No Actions or other fancy stuff there!

    It might be an example or demo that you loaded, but that is something completely different!



  • Oh, to tell the truth I thought that the code has been modified.

    hdevine,

    1. open you project in Qt Creator, then got to Projects->Build settings, find there which Qt version is used for building this project.

    2. Did you add you recently built Qt via Tools -> Options -> Qt4 ?



  • The QT version says "Qt in PATH". When I check Tools->Options->Qt4, I get the following:

    Auto-detected
    Qt in Path /usr/bin/qmake-qt4
    Manual
    Qt 4.6.3 OpenSource /opt/qtsdk-2010.04/qt/bin/qmake

    Sorry if these seem like dumb questions. I'm feeling my away around Qt after being a Windows/MFC/Developer Studio programmer for over 10 years.

    Harry



  • I bet your Qt in Path has version < 4.6. The item QKeySequence::Quit appeared in QKeySequence::StandardKey enum only in Qt 4.6 (according to documentation). Modify the build settings for your project in Qt Creator and explicitly tell it to use Qt 4.6.3.



  • When I do that, it says "This Qt version is invalid" next to the Qt version drop down box (which says Qt 4.6.3 OpenSource at the moment). So, how do I get the Creator to see a valid Qt version?

    Harry



  • This is means that Qt 4.6.3 has not been registered correctly.
    Please show the output of the following cmd

    $ ls -l/opt/qtsdk-2010.04/qt/bin



  • Here it is:

    total 107232
    -rwxrwxr-x 1 root root 954622 2010-07-08 12:40 assistant
    -rwxrwxr-x 1 root root 556588 2010-07-08 12:41 assistant_adp
    -rw-r--r-- 1 root root 3466954 2010-07-08 12:41 assistant_adp.debug
    -rw-r--r-- 1 root root 4327151 2010-07-08 12:40 assistant.debug
    -rwxr-xr-x 1 root root 2009 2010-06-01 22:03 createpackage.bat
    -rwxr-xr-x 1 root root 11341 2010-06-01 22:03 createpackage.pl
    -rwxrwxr-x 1 root root 544330 2010-07-08 12:49 designer
    -rw-r--r-- 1 root root 5324944 2010-07-08 12:49 designer.debug
    -rwxr-xr-x 1 root root 4160 2010-06-01 22:03 findtr
    -rwxrwxr-x 1 root root 274758 2010-07-08 12:51 lconvert
    -rw-r--r-- 1 root root 1728638 2010-07-08 12:51 lconvert.debug
    -rwxrwxr-x 1 root root 1698636 2010-07-08 12:50 linguist
    -rw-r--r-- 1 root root 11738182 2010-07-08 12:50 linguist.debug
    -rwxrwxr-x 1 root root 1896048 2010-07-08 12:51 lrelease
    -rw-r--r-- 1 root root 6334083 2010-07-08 12:51 lrelease.debug
    -rwxrwxr-x 1 root root 656709 2010-07-08 12:51 lupdate
    -rw-r--r-- 1 root root 3576714 2010-07-08 12:51 lupdate.debug
    -rwxrwxr-x 1 root root 1150347 2010-07-08 11:38 moc
    -rw-r--r-- 1 root root 3760193 2010-07-08 11:38 moc.debug
    -rw-r--r-- 1 root root 43 2010-06-01 22:03 patch_capabilities.bat
    -rwxr-xr-x 1 root root 7974 2010-06-01 22:03 patch_capabilities.pl
    -rwxrwxr-x 1 root root 53704 2010-07-08 12:41 pixeltool
    -rw-r--r-- 1 root root 493114 2010-07-08 12:41 pixeltool.debug
    -rwxrwxr-x 1 root root 55832 2010-07-08 12:40 qcollectiongenerator
    -rw-r--r-- 1 root root 383716 2010-07-08 12:40 qcollectiongenerator.debug
    -rwxr-xr-x 1 root root 441481 2010-06-02 08:17 qdbus
    -rwxr-xr-x 1 root root 225878 2010-06-02 08:17 qdbuscpp2xml
    -rwxr-xr-x 1 root root 1317969 2010-06-02 08:17 qdbusviewer
    -rwxr-xr-x 1 root root 592544 2010-06-02 08:17 qdbusxml2cpp
    -rwxr-xr-x 1 root root 11855776 2010-06-02 08:17 qdoc3
    -rwxrwxr-x 1 root root 182351 2010-07-08 12:41 qhelpconverter
    -rw-r--r-- 1 root root 2734951 2010-07-08 12:41 qhelpconverter.debug
    -rwxrwxr-x 1 root root 20825 2010-07-08 12:40 qhelpgenerator
    -rw-r--r-- 1 root root 249557 2010-07-08 12:40 qhelpgenerator.debug
    -rwxrwxr-x 1 root root 3488831 2010-07-08 11:34 qmake
    -rwxrwxr-x 1 root root 1040684 2010-07-08 12:42 qt3to4
    -rw-r--r-- 1 root root 5548861 2010-07-08 12:42 qt3to4.debug
    -rwxr-xr-x 1 root root 3015021 2010-06-02 08:17 qtconfig
    -rwxr-xr-x 1 root root 5034401 2010-06-02 08:17 qtdemo
    -rwxrwxr-x 1 root root 32030 2010-07-08 12:42 qttracereplay
    -rw-r--r-- 1 root root 419806 2010-07-08 12:42 qttracereplay.debug
    -rwxrwxr-x 1 root root 1307043 2010-07-08 11:38 rcc
    -rw-r--r-- 1 root root 3882638 2010-07-08 11:38 rcc.debug
    -rwxr-xr-x 1 root root 8464 2010-06-01 22:03 setcepaths.bat
    -rwxr-xr-x 1 root root 39021 2010-06-01 22:03 syncqt
    -rwxr-xr-x 1 root root 2021 2010-06-01 22:03 syncqt.bat
    -rwxrwxr-x 1 root root 1827685 2010-07-08 11:38 uic
    -rwxrwxr-x 1 root root 1199238 2010-07-08 11:53 uic3
    -rw-r--r-- 1 root root 7898122 2010-07-08 11:53 uic3.debug
    -rw-r--r-- 1 root root 7561206 2010-07-08 11:38 uic.debug
    -rwxr-xr-x 1 root root 610105 2010-06-02 08:17 xmlpatterns
    -rwxr-xr-x 1 root root 157151 2010-06-02 08:17 xmlpatternsvalidator

    Thanks,
    Harry



  • I started looking back at this again today, and I see that the Qt4 section in Qt Creator says "Qt version is not properly installed, please run make install". So, when I do that in the area where I have the 4.6.3 source, I get the following compile error:

    make[2]: Entering directory /opt/qtsdk-2010.04/qt/tools/qtconfig' g++ -c -pipe -g -O2 -I/usr/include/freetype2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_SHARED -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include/QtGui -I../../include/Qt3Support -I../../include -I. -I/usr/X11R6/include -I.moc/release-shared -I.uic/release-shared -o .obj/release-shared/mainwindow.o mainwindow.cpp mainwindow.cpp:70:21: error: gst/gst.h: No such file or directory mainwindow.cpp: In constructor ‘MainWindow::MainWindow()’: mainwindow.cpp:392: error: ‘gst_init_check’ was not declared in this scope mainwindow.cpp:393: error: ‘gchar’ was not declared in this scope mainwindow.cpp:393: error: ‘versionString’ was not declared in this scope mainwindow.cpp:393: error: ‘gst_version_string’ was not declared in this scope mainwindow.cpp:395: error: ‘g_free’ was not declared in this scope mainwindow.cpp:396: error: ‘GList’ was not declared in this scope mainwindow.cpp:396: error: ‘factoryList’ was not declared in this scope mainwindow.cpp:396: error: ‘gst_registry_get_default’ was not declared in this scope mainwindow.cpp:396: error: ‘GST_TYPE_ELEMENT_FACTORY’ was not declared in this scope mainwindow.cpp:396: error: ‘gst_registry_get_feature_list’ was not declared in this scope mainwindow.cpp:398: error: ‘iter’ was not declared in this scope mainwindow.cpp:398: error: ‘g_list_first’ was not declared in this scope mainwindow.cpp:398: error: ‘g_list_next’ was not declared in this scope mainwindow.cpp:399: error: ‘GstPluginFeature’ was not declared in this scope mainwindow.cpp:399: error: ‘feature’ was not declared in this scope mainwindow.cpp:399: error: ‘GST_PLUGIN_FEATURE’ was not declared in this scope mainwindow.cpp:400: error: ‘GST_ELEMENT_FACTORY’ was not declared in this scope mainwindow.cpp:400: error: ‘gst_element_factory_get_klass’ was not declared in this scope mainwindow.cpp:402: error: ‘GST_PLUGIN_FEATURE_NAME’ was not declared in this scope mainwindow.cpp:407: error: ‘GstElement’ was not declared in this scope mainwindow.cpp:407: error: ‘sink’ was not declared in this scope mainwindow.cpp:407: error: ‘gst_element_factory_make’ was not declared in this scope mainwindow.cpp:409: error: ‘gst_element_factory_get_description’ was not declared in this scope mainwindow.cpp:412: error: ‘gst_object_unref’ was not declared in this scope mainwindow.cpp:416: error: ‘g_list_free’ was not declared in this scope make[2]: *** [.obj/release-shared/mainwindow.o] Error 1 make[2]: Leaving directory/opt/qtsdk-2010.04/qt/tools/qtconfig'
    make[1]: *** [sub-qtconfig-install_subtargets-ordered] Error 2
    make[1]: Leaving directory `/opt/qtsdk-2010.04/qt/tools'
    make: *** [sub-tools-install_subtargets-ordered] Error 2

    I did some Googling and saw a suggestion to make sure that the gstreamer headers are installed. I'm running 32 bit Fedora 11 and I have the gstreamer stuff installed already from what I can tell. Any ideas?

    Harry



  • The directory with gstreamer headers should be passed via -I flag during compilation. Something like

    -I/usr/include/gstreamer-0.10

    This can be done in .pro file by adding this path to INCLUDEPATH.



  • It appears like I don't have the gstreamer headers. I don't see anything like that under /usr/include on my system. I also tried to look for gst.h (which was mentioned in the output above) and I don't have that either. Do you know what package I need to install to get those headers?

    Thanks,
    Harry



  • The name can vary a little bit depending on your distro. But i think it should be easy for you to figure out the correct name since the package name should have a suffix 'dev' or 'devel'. For openSUSE it is gstreamer-0_10-devel.



  • OK, I got it working finally. I installed the gstreamer-devel package for Fedora 11, redownloaded the SDK, and rebuilt the source. Then I told QT Creator to use the newly build source and the demos build. Now its time to start learning Qt!

    Thanks,
    Harry



  • Great, have fun!



  • hello
    i had same problem but now i think i can fix it


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.