Results 1 to 3 of 3

Thread: How to adjust the size of widgets added to a QToolBar?

  1. #1
    Join Date
    Mar 2011
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default How to adjust the size of widgets added to a QToolBar?

    I have added a slider inside a QToolBar using AddWidget() directly as follows:

    Qt Code:
    1. m_PreviewFrameSlider = new QSlider();
    2. m_PreviewFrameSlider->setRange(0, 1000);
    3. m_PreviewFrameSlider->setOrientation(Qt::Horizontal);
    4.  
    5. ui->PreviewToolBar->addWidget(m_PreviewFrameSlider);
    To copy to clipboard, switch view to plain text mode 

    The slider appears as expected but is a little too narrow (about 100 pix. I want to adjust the width of the slider to at least 300 pix. I could not find any methods that can do so. Can someone give me some tips on how to do so?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: How to adjust the size of widgets added to a QToolBar?

    QWidget::setMinimumWidth() looks promising.

  3. #3
    Join Date
    Mar 2011
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to adjust the size of widgets added to a QToolBar?

    Thanks alot! It worked perfectly.

Similar Threads

  1. adjust the size of the columns in a QTableWidget
    By franco.amato in forum Qt Programming
    Replies: 1
    Last Post: 2nd February 2011, 23:34
  2. Replies: 1
    Last Post: 2nd April 2010, 01:45
  3. trying to adjust size of image in a qlabel
    By mmm286 in forum Newbie
    Replies: 1
    Last Post: 5th November 2009, 06:43
  4. How to adjust QWebView size within a form?
    By richardander in forum Qt Programming
    Replies: 2
    Last Post: 10th June 2009, 09:45
  5. adjust font size to QLabel-size
    By hunsrus in forum Qt Programming
    Replies: 0
    Last Post: 9th July 2008, 14:33

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
  •  
Qt is a trademark of The Qt Company.