Results 1 to 4 of 4

Thread: Add tab (QtabWidget defined in UI file)

  1. #1
    Join Date
    Apr 2010
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Add tab (QtabWidget defined in UI file)

    Hei,
    I have a problem, designing my GUI in QtDesigner and adding QTabWidget, because it add tab's in there (UI file no tab's).

    Code:

    Qt Code:
    1. connect( pushButton, SIGNAL(clicked()), this, SLOT(addChatTab("Name")) );
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void MyClass::addChatTab( QString name )
    2. {
    3. QWidget *newTab = new QWidget( tabWidget );
    4. tabWidget->addTab( newTab, ( name ) );
    5. }
    To copy to clipboard, switch view to plain text mode 

    And if I clicked this button no tab's appering.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Add tab (QtabWidget defined in UI file)

    The following is not possible:
    Qt Code:
    1. connect( pushButton, SIGNAL(clicked()), this, SLOT(addChatTab("Name")) );
    To copy to clipboard, switch view to plain text mode 
    A slot can have maximum the same amount of parameters as the signal.

  3. #3
    Join Date
    Apr 2010
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Add tab (QtabWidget defined in UI file)

    Ok now works! If i remove QString param!

    I can't either one param in slot?

  4. #4
    Join Date
    Apr 2010
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Add tab (QtabWidget defined in UI file)

    Qt Code:
    1. void MyClass::addChatTab()
    2. {
    3. QWidget *newTab = new QWidget( tabWidget );
    4. QLabel *fileNameLabel = new QLabel(tr("File Name:"));
    5. QVBoxLayout *mainLayout = new QVBoxLayout;
    6. mainLayout->addWidget(fileNameLabel);
    7. setLayout(mainLayout);
    8. tabWidget->addTab( newTab, ( "New tab" ) );
    9. }
    To copy to clipboard, switch view to plain text mode 

    How to add buttons/layout or something tabWidget, now it not works!

Similar Threads

  1. Using User Defined Libraries
    By csvivek in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2008, 20:47
  2. Replies: 8
    Last Post: 17th March 2008, 15:04
  3. Own defined Dockareas
    By jobrandt in forum Qt Programming
    Replies: 7
    Last Post: 18th July 2007, 11:48
  4. MSG not defined (winEvent)
    By December in forum Qt Programming
    Replies: 6
    Last Post: 19th February 2007, 17:24
  5. Replies: 25
    Last Post: 15th January 2006, 01:53

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.