Results 1 to 4 of 4

Thread: QTabWidget SIGNAL currentChanged()

  1. #1
    Join Date
    Feb 2006
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QTabWidget SIGNAL currentChanged()

    Hi to all
    I'm using a QTabWidget and I want to disable some QAction from MainWindow in the toolbar using the SIGNAL currentChanged()
    I'm using this piece of code

    Qt Code:
    1. MainWindow::MainWindow()
    2. {
    3. int index[3];
    4.  
    5. myTabWidget = new QTabWidget(this);
    6.  
    7. myTable1 = new MyTable(1,6,myTabWidget);
    8. myTable1->setFocusPolicy(Qt::StrongFocus);
    9. myTable2 = new MyTablesim(1,9,myTabWidget);
    10. myTable2->setFocusPolicy(Qt::StrongFocus);
    11.  
    12. setCentralWidget(myTabWidget);
    13.  
    14. index[0] = myTabWidget->insertTab(0,myTable1,"HSUPA User Param");
    15. index[1] = myTabWidget->insertTab(1,myTable2,"HSUPA Simulation Param");
    16.  
    17. setWindowTitle("HSUPA GEN");
    18. createActions();
    19. createMenus();
    20. createToolBars();
    21. createStatusBar();
    22. int indice=myTabWidget->currentIndex();
    23. connect(test_button,SIGNAL(clicked()),this,SLOT(grey_buttons()));
    24. QObject::connect(myTabWidget,SIGNAL(currentChanged(1)),this,SLOT(grey_buttons()));
    25.  
    26. }
    27. void MainWindow::grey_buttons(){
    28. addUserAct->setEnabled(false)
    29. }
    To copy to clipboard, switch view to plain text mode 


    but I cannot see the icon disabled

    What's wrong

    Thanks
    Manuel

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QTabWidget SIGNAL currentChanged()

    Slot must have the same arguments as signal
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTabWidget SIGNAL currentChanged()

    Quote Originally Posted by campana
    Qt Code:
    1. QObject::connect(myTabWidget,SIGNAL(currentChanged(1)),this,SLOT(grey_buttons()));
    To copy to clipboard, switch view to plain text mode 
    Parameter values or names are not allowed in SIGNAL and SLOT macros.
    So try this instead:
    Qt Code:
    1. connect(myTabWidget,SIGNAL(currentChanged(int)),this,SLOT(grey_buttons()))
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Feb 2006
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTabWidget SIGNAL currentChanged()

    Thanks a lot JPN

Similar Threads

  1. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 07:16
  2. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 07:04
  3. Replies: 1
    Last Post: 29th April 2008, 12:12
  4. Replies: 2
    Last Post: 17th May 2006, 21:01

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.