Results 1 to 1 of 1

Thread: Unable to add QToolButton to QToolbar on QWidget

  1. #1
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    248
    Thanks
    91
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Unable to add QToolButton to QToolbar on QWidget

    I've added a QToolBar to QWidget and added a QToolButton to the QToolBar, but the image isn't showing up. If I use QPushButton, it's showing up any reason?
    Qt Code:
    1. Widget::Widget(QWidget *parent)
    2. : QWidget(parent)
    3. {
    4. oMainLayout = new QVBoxLayout();
    5. oMainLayout->setMargin(0);
    6. oToolbar = new QToolBar();
    7. oMainLayout->addWidget(oToolbar, 0, Qt::AlignTop);
    8.  
    9. oClose = new QPushButton();
    10. oToolbar->addWidget(oClose);
    11. connect(oClose, SIGNAL(clicked()), this, SLOT(onCloseBtnClick()));
    12. oClose->show();
    13. this->setLayout(oMainLayout);
    14. }
    To copy to clipboard, switch view to plain text mode 

    [Closed:] ToolButton is added but doesn't have any border, so it was difficult to recognize. Sorry for the oversight.
    Last edited by rawfool; 17th August 2012 at 11:59.

Similar Threads

  1. QToolbar inside QWidget
    By theprobe in forum Qt Programming
    Replies: 1
    Last Post: 14th February 2011, 17:53
  2. Hiding a QToolButton in a QToolBar
    By elcuco in forum Qt Programming
    Replies: 3
    Last Post: 24th November 2009, 21:35
  3. Adding a QWidget to QToolbar
    By qtUser500 in forum Qt Tools
    Replies: 6
    Last Post: 16th October 2009, 19:16
  4. drag and drop QToolButton in QToolBar
    By NBilal in forum Qt Programming
    Replies: 1
    Last Post: 28th December 2008, 21:11
  5. how to add QWidget to QToolBar
    By babu198649 in forum Qt Tools
    Replies: 2
    Last Post: 22nd September 2008, 07:58

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.