Results 1 to 20 of 31

Thread: the simplest custom slot

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2007
    Posts
    103
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    71
    Thanked 2 Times in 2 Posts

    Default hi jacek

    hi Jacek

    Thanks for confirming my code. No, I do not use qmake. I'm going to need
    another piece of help here if you don't mind because I do not know how to use qmake.
    My compiler is Dev-C++ (mingw). I guess I have to put "qmake" somewhere in the
    project options sections? Or is qmake a standalone program you run before or when you compile? (instead of your compiler?).
    Thanks to you and the other helpful people my problem is now narrowed down to
    compiler/linker problem and most likely qmake.

    Tommy

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

    Default Re: hi jacek

    Quote Originally Posted by tommy View Post
    My compiler is Dev-C++ (mingw). I guess I have to put "qmake" somewhere in the
    project options sections? Or is qmake a standalone program you run before or when you compile? (instead of your compiler?).
    qmake is a tool that generates makefiles from .pro files, which are much simplier. To generate an initial .pro file you have to run "qmake -project" in the directory where your project is. Then you run "qmake" or "qmake filename.pro" to generate makefile. I don't use Dev-C++, but AFAIR you can make it use a custom makefile, so you just have to point it to the makefile generated by qmake.

  3. The following user says thank you to jacek for this useful post:

    tommy (9th November 2007)

  4. #3
    Join Date
    Nov 2007
    Posts
    103
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    71
    Thanked 2 Times in 2 Posts

    Default hi jacek

    Thanks Jacek,

    You made a lot of things much more clear for me, I'm beginning to understand the basics now.
    I was able to use qmake just as you suggested but did not get it to work with Dev-C++. I'm thinking of abandoning Dev-C++ and trying command line (just get plain mingw). How do you include the makefile when you compile from command line? What's the syntax?

    Thankfully,
    Tommy

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

    Default Re: hi jacek

    Quote Originally Posted by tommy View Post
    I'm thinking of abandoning Dev-C++ and trying command line (just get plain mingw).
    I'm sure you can find some tutorials about using Dev-C++ for Qt applications on google.

  6. #5
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    7
    Thanked 11 Times in 8 Posts

    Default Re: the simplest custom slot

    Hi,
    I'm using qt on dev-cpp, so i had similar problem
    I'm not using qmake(it says it can't find FORCE target), but i didn't searched the reason of this error, because i'm using multiple makefiles to have effect of several projects in one solution (dev-cpp works on projects only).
    You need to set use custom makefile in projects options, add a tatget *.moc, with 2 commands:
    1 moc your *.h to *.moc(or moc_*.cpp)
    2 compile generated file

    or the simpler way makefile that calls only qmake & make on file generated by, unfortunately i can't test this because of mentioned qmake error.

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

    Default Re: the simplest custom slot

    Quote Originally Posted by mchara View Post
    I'm not using qmake(it says it can't find FORCE target), but i didn't searched the reason of this error
    What is the value of the TARGET variable in your .pro file? If it isn't set, what is the name of the .pro file?

    Quote Originally Posted by mchara View Post
    You need to set use custom makefile in projects options, add a tatget *.moc, with 2 commands:
    1 moc your *.h to *.moc(or moc_*.cpp)
    2 compile generated file
    What about all of those magic macros Qt needs?

  8. #7
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    7
    Thanked 11 Times in 8 Posts

    Default Re: the simplest custom slot

    Quote Originally Posted by jacek View Post
    What is the value of the TARGET variable in your .pro file? If it isn't set, what is the name of the .pro file?
    Doesn't matter, i have the same error for every makefile generated by qmake, i found that
    FORCE: is an empty target used to force something to be build even if there's no dependencies so it shall be empty definition.
    It is in deed in generated makefiles' but i suppose that problem might be in missing tab & newline after FORCE: - some make's are sensitive for tabs instead of spaces etc., i think make is one of them.
    What about all of those magic macros Qt needs?
    What macros?
    DO you mean those defines at the beginning
    Qt Code:
    1. -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
    To copy to clipboard, switch view to plain text mode 
    , i've copied them from first makefile found in qt's exapmles & worked fine.

    Those are always the same view defines(& view more depending on used modules -DQT_*_LIB) so it's not much work.

    I thought that maybe custom makefie that would have defined only qmake -project; qmake &make on newly generated makefile would solve the problem if we would find what's wrong with FORCE error... can anyone check is this common problem on mingw or just mine?

    Oh, one more thing : make sure to not use --short-double or --expensive-optimizations because using one of them causes QPainter::drawPixmap()/drawImage() stops working... it's really strange but i've checked it several times & it really happens.

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: the simplest custom slot

    Quote Originally Posted by mchara View Post
    What macros?
    DO you mean those defines at the beginning
    Qt Code:
    1. -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
    To copy to clipboard, switch view to plain text mode 
    , i've copied them from first makefile found in qt's exapmles & worked fine.
    This is not a good thing to do. The macros change depending on how you configure your project - in this situation you only enable core and gui libraries. What if you want to use other Qt modules like network, xml or any of the others? Your static compilation rule will fail. If you install newer Qt release that has more switches, your compilation will fail. If you want to switch between debug and release, it won't be possible, etc.

  10. #9
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    7
    Thanked 11 Times in 8 Posts

    Default Re: the simplest custom slot

    I know it's not good solution, but the only one working i have for now...
    I promise to let you know, when i'll find what's wrong with that "FORCE" qmake's error & figure out how to use dev-cpp's makefile to generate & build second one from qmake.
    P.S.
    If i'm adding some module i have to add include, lib & define by hand, i have to add each file i'm adding to project to makefile also, so it's lots of unnecessary work...
    Only positive side of this solution is the fact that application compiles itself from dev-cpp environtment.

  11. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: the simplest custom slot

    Isn't it possible to do the compilation just by making qmake && make your build sequence in the IDE?

  12. #11
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    7
    Thanked 11 Times in 8 Posts

    Default Re: the simplest custom slot

    It should be possible, i've used only use custom makefile option. As i said i got an error on makefiles generated by qmake & i don't know the reason jet so i was using own makefiles.
    it would be nice to have qmake & make integrated with IDE but first qmake must work. When i'll force qmake to work properly, i'll start searching how to integrate it with dev-cpp in best way.

  13. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: the simplest custom slot

    What kind of make do you have? What does make -v return?

Similar Threads

  1. How to create Custom Slot upon widgets
    By ashukla in forum Qt Programming
    Replies: 6
    Last Post: 8th September 2007, 15:07
  2. Connect Button to a custom slot
    By Majestade in forum Qt Programming
    Replies: 2
    Last Post: 28th March 2007, 18:17
  3. Replies: 1
    Last Post: 26th January 2007, 08:10
  4. custom slot + Designer
    By bashamehboob in forum Qt Tools
    Replies: 1
    Last Post: 28th April 2006, 16:17
  5. How to create custom slot in Qt Designer 4.1?
    By jamadagni in forum Qt Tools
    Replies: 31
    Last Post: 18th January 2006, 21:46

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
  •  
Qt is a trademark of The Qt Company.