Results 1 to 3 of 3

Thread: connect

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default connect

    Hi, I'd like to know if there's a way to do this below with ONE connect :
    Qt Code:
    1. connect(buttonGroupLL, SIGNAL(clicked(int)), tabWidget3, SLOT(EnableTab(int)); //??enableTab?
    2. connect(buttonGroupLL, SIGNAL(toggled(bool)), tabWidget3, SLOT(setEnabled(bool));
    To copy to clipboard, switch view to plain text mode 
    In other word: I've 3 checkBox that when they're clicked, they have to enable tab1,tab2,tab3 (tabs of tabWidget3).
    Wich is the best way to do this? Thanks
    Regards

  2. #2
    Join Date
    Apr 2006
    Location
    Denmark / Norway
    Posts
    67
    Thanks
    3
    Thanked 12 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: connect

    Several ways to achieve this
    A) built on the code you wrote... to get one connect at last end...

    1- create a custom signal from the groupbox that transmits an int
    2- create a slot for each of the checkboxes in the groupbox that accepts a bool and emits the signal created above with correct int for the tabpage
    3- create a custom slot on the tabwidget that enables/disables the page that the recieving int is.

    this would make the checkboxes connected to the groupbox, the groupbox connected to the tabwidget and the tabpages get a signal from the tabwidget.

    line drawing
    Qt Code:
    1. Checkbox(bool) ----| |--- Tabpage(bool)
    2. Checkbox(bool) ----|--- Groupbox(int) -- Tabwidget(int) ---|--- Tabpage(bool)
    3. Checkbox(bool) ----| |--- Tabpage(bool)
    To copy to clipboard, switch view to plain text mode 

    B) easier. several connects

    connect each checkbox to each tabpage directly
    Qt Code:
    1. connect(checkbox1, SIGNAL(clicked(bool)), tabpage1, SLOT(setEnabled(bool)));
    2. connect(checkbox2, SIGNAL(clicked(bool)), tabpage2, SLOT(setEnabled(bool)));
    3. connect(checkbox3, SIGNAL(clicked(bool)), tabpage3, SLOT(setEnabled(bool)));
    To copy to clipboard, switch view to plain text mode 

    cheers,
    leif
    Last edited by luf; 27th May 2006 at 03:46.

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: connect

    I don't understand first solution.This below is ok.
    But I need also know wnen checkbox is toggled or not (to enable/disable tab widget)
    This below send right number of tab to be enabled/disabled. But EnableTab don't know if must enble or disable....
    Qt Code:
    1. connect(buttonGroupLL, SIGNAL(clicked(int)), tabWidget3, SLOT(EnableTab(int));
    To copy to clipboard, switch view to plain text mode 
    Regards

Similar Threads

  1. connect on a popup
    By mickey in forum Qt Programming
    Replies: 2
    Last Post: 12th April 2006, 16:37
  2. [QT4 & XP] connect on QtreeView
    By incapacitant in forum Newbie
    Replies: 1
    Last Post: 2nd March 2006, 11:08
  3. connect to sql server
    By raphaelf in forum Qt Programming
    Replies: 15
    Last Post: 27th February 2006, 18:06
  4. connect
    By mickey in forum Newbie
    Replies: 1
    Last Post: 25th February 2006, 18:31

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.