Results 1 to 4 of 4

Thread: Button on QTabWidget

  1. #1
    Join Date
    Oct 2008
    Posts
    29
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Button on QTabWidget

    Hi, I'd like to add a "New Tab" button to a QTabWidget. The button should be beside the tab titles. Could someone point me to a tutorial? Or a piece of code?

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Button on QTabWidget

    this button will be available only in 4.5 in QTabWidget according to this post Some QTabBar & QTabWidget love. so, there are too opportunities, the first one: download 4.5 technology preview or add this button by inheriting of QTabWidget.

  3. #3
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Button on QTabWidget

    sorry, I thought that you meen that buttons should be located on each tab, but you mean that this button should be located like "Add page' button in assistant, right?

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Button on QTabWidget

    there is snippet of code how trolls do this in Assistant
    Qt Code:
    1. ...
    2. QToolButton *newTabButton = new QToolButton(this);
    3. ui.tab->setCornerWidget(newTabButton, Qt::TopLeftCorner);
    4. newTabButton->setCursor(Qt::ArrowCursor);
    5. newTabButton->setAutoRaise(true);
    6. newTabButton->setIcon(QIcon(ImageLocation + QLatin1String("addtab.png")));
    7. QObject::connect(newTabButton, SIGNAL(clicked()), this, SLOT(newTab()));
    8. newTabButton->setToolTip(tr("Add page"));
    9. ...
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. How do I add new tab to QTabWidget
    By pcmantinker in forum Qt Programming
    Replies: 2
    Last Post: 6th June 2008, 04:24
  2. button with backgr and icon using stylesheets
    By s_p_t10 in forum Qt Programming
    Replies: 0
    Last Post: 7th May 2008, 20:19
  3. problem about mouse button events
    By vql in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2008, 10:14
  4. question about button
    By narumi in forum Newbie
    Replies: 2
    Last Post: 21st January 2008, 05:44
  5. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 16:40

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.