Results 1 to 3 of 3

Thread: Jambi - Eclipse - Designer - Slots

  1. #1
    Join Date
    Jan 2009
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Jambi - Eclipse - Designer - Slots

    Hi folks,

    I recently started (again) playing around with Qt (last time was 3.3 I guess). And I have come across an issue I would like to confirm with you.
    This is what I did initially:

    • Create a Qt Jambi Project in Eclipse (3.4)
    • Create a Qt Jambi Design Form (MainWindow)
    • Created a simple UI (with Eclipse Designer Interface)


    Now I understand that I need to connect the button (pushButton_add) to a slot. This is where I am facing the issue. I do not seem to be able to do so.

    After a bit of googling I tried to hard code the connection in the TestMain.java file that has been generated buy the designer (TestJava.jui). The problem is now, when I change my UI, the Designer generates a new TestMain.java, overwriting my edits (inconvenient to say the least!). I am now required to rely on TestMainImpl.java for slot definition?

    Qt Code:
    1. public class TestMainImpl extends QMainWindow {
    2. TestMain ui = new TestMain();
    3.  
    4. public static void main (String[] args) {
    5. ...initialize();
    6. ...
    7. ...exec();
    8. }
    9.  
    10. public TestMain() {
    11. ui.setupUi(this);
    12. //is this the right place for that?!?!?!?!
    13. ui.pushbutton_add.clicked.connect(this, "pushButton_add_clicked()");
    14. }
    To copy to clipboard, switch view to plain text mode 

    That is sad but ok, if it has to be like this, I can deal with it. What is the Signal/Slot editor for then anyways? Am I doing something wrong; did I misunderstand a concept? Please help me out here, your help is greatly appreciated.

    Good day

    Ronny

  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: Jambi - Eclipse - Designer - Slots

    You have to derive a class from TestMain and add all the code you need there. The other way is to use aggregation instead of inheritance.

    See: http://doc.trolltech.com/4.4/designe...component.html

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

    ronnyf (2nd February 2009)

  4. #3
    Join Date
    Jan 2009
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Jambi - Eclipse - Designer - Slots

    Yes, you are absolutely right. More intensive reading would have solved my issue by itself.
    Thanks for your help.

Similar Threads

  1. Qt Designer 4.4.1 Signals and Slots
    By M4d_Us3r in forum Qt Tools
    Replies: 1
    Last Post: 13th October 2008, 21:03
  2. Replies: 12
    Last Post: 23rd June 2008, 08:05
  3. Replies: 2
    Last Post: 12th July 2007, 09:55
  4. Howto use Eclipse with QT4 in 10 steps
    By the_bis in forum Newbie
    Replies: 3
    Last Post: 28th January 2007, 20:21
  5. Adding slots in Designer
    By jamos in forum Qt Tools
    Replies: 5
    Last Post: 18th May 2006, 23:28

Tags for this Thread

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.