Results 1 to 15 of 15

Thread: Creating slots with Q_OBJECT

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Creating slots with Q_OBJECT

    Well thx, but it failed.
    It kept trying to find mingw-make and stuff, so I put those in system32 (they were in dev-cpp's bin), and then this time after i fixed up the qmake file, and then used mingw32-make, it tried to build it, but it gave hundreds of linker errors "no matching function called operator new(Qstring &......." and things like that. Well i'll keep trying things.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating slots with Q_OBJECT

    Quote Originally Posted by VireX View Post
    Well thx, but it failed.
    It kept trying to find mingw-make and stuff, so I put those in system32 (they were in dev-cpp's bin), and then this time after i fixed up the qmake file, and then used mingw32-make, it tried to build it, but it gave hundreds of linker errors "no matching function called operator new(Qstring &......." and things like that.
    It looks like your compiler isn't installed correctly or at least some environment variables aren't set.

    How did you install Qt? Did you use the installer? Did it ask for MinGW location? Also try compiling your application from "Qt 4.2.x Command Prompt".

  3. #3
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating slots with Q_OBJECT

    If you installed Qt and the MinGW compiler correctly, then you should have a PATH variable that points to their respective /bin/ folders. You can check your path by right clicking on My Computer-->properties-->advanced-->environment variables.

    The top part of the window that pops up (user variables), should contain a variable called Path. (You may create it if it doesn't already exist). If you double click on it and copy the contents to a text editor so you can get a better overview. If you look at it, you can see if Qt and MinGW's /bin/-paths are included. If not, add them.

    My Path-variable looks like this: P:\Qt\MinGW-gcc-3.4.2\bin;P:\Qt\MinGW-gcc-3.4.2\insight\bin;P:\Qt\qt-win-4.1.4-mingw\bin

    Once that's done you can call the qmake and make programs from anywhere. I, like Jacek compile like so:

    qmake -project (when i'm starting a new project. qmake autogenerates the .pro file.)
    qmake (creates the Makefiles from the .pro file.)
    make ((or in my case, mingw32-make) compiles the application based on the generated Makefiles.)

    When i add new files to my project i add them to the .pro file instead of the Makefile since i run qmake to regenerate the Makefile. Runnin gqmake is not something i need to do every time i compile.

    I hope this helps and that you don't write Qt off because of a few stumbles in the beginning. I'm pretty sure the problems you've been experiencing stem from the template file you're using and not Qt itself.

  4. #4
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Creating slots with Q_OBJECT

    Using Qt with QTmake is difficult. I used the template file to make it as simple as possible, but that has the setback of the mos handling... so I still havent' found a solution.

    But a lot of things turn me off... like just trying to figure out how shortcuts work. Like there is no button->keypressed(QT::ENTER);, which would be the assumed OOP idea... I still haven't figured out how to get those kinds of events... i'll keep searching tho...
    EDIT: hah thats hilarious, i just found button->setAccel, didnt see it before. scratch that! But I still dont know how to set a shortcut just by pressing the KEY, like how F1 will bring help in most programs.

    THe fact alone that I haven't found a single major tutorial site with lots of Qt tutorials. The only resources is, Qt's own docs and this forum... I haven't found any site, that walks thru programming something as simple as an instant messenger, or a notepad with a lot of functions. I know there is like a syntax highlighter example somewhere around here, but i mean i haven't seen others elsewhere.
    Last edited by VireX; 31st January 2007 at 04:47.

  5. #5
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating slots with Q_OBJECT

    Well, i'm sorry you find working with qmake difficult. Since it's only a few steps to use it the first time, most of us don't need a template file since using one would in all likelihood add more steps than it removed. I had hoped that my last post would clear things up for you a little but i guess it didn't I'll have to work on explaining things more clearly in the future.

    The specific problem you mention can be solved with a look at some of the Qt examples included in your installation or a search through the forums. I don't have the answer for you on hand but i recall seeing some example of how to do it. If i'm not mistaken you will need to register to receive keyPressed events from your main widget and then implement a protected method for it. In that method you can filter for the desired key(s). I did something like that in an application that was to have a unique responce to the enter key. I'm sorry i can't give you more elaborate help than that right now but i don't have access to my Qt stuff at the moment.

    When i work with Qt and try to do something new, i often turn to these forums and the Qt Assistant (that is to say, the Qt api and documentation). 99% of the time i can find an example or a thorough explanation of the steps involved in using some feature or performing a task. Sure, it's a little work, but i personally find the detective work involved in figuring out how to do something to be part of the thrill. Makes seeing it work that much more enjoyable. At the same time i can understand your frustration. Perhaps there should be some site dedicated to open-source Qt projects where more elaborate examples could be made available.

    best of luck.
    -TR

Similar Threads

  1. Signals and Slots question
    By Thoosle in forum Qt Programming
    Replies: 5
    Last Post: 5th December 2006, 00:24
  2. Adding slots in Designer
    By jamos in forum Qt Tools
    Replies: 5
    Last Post: 18th May 2006, 23:28
  3. Problem in creating thread in GUI application
    By jyoti kumar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:05
  4. Problem with Signal and Slots
    By Kapil in forum Installation and Deployment
    Replies: 2
    Last Post: 10th February 2006, 08:51
  5. Missing slots
    By Mariane in forum Newbie
    Replies: 1
    Last Post: 5th February 2006, 01:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.