Results 1 to 3 of 3

Thread: QWidget containing two QToolButtons

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default QWidget containing two QToolButtons

    Hi! I want to set a QWidget that is composed of two QToolButtons as the cornerWidget of a QTabWidget, but it doesnt work. The buttons are being squeezed and aren't usable any more. Outside of the QTabWidget the widget looks ok.

    Any Ideas?
    Thanx

    Qt Code:
    1. #include <QApplication>
    2. #include <QtGui>
    3.  
    4. // #include "main.moc"
    5. int main(int argc, char **argv)
    6. {
    7. QApplication app(argc, argv);
    8.  
    9. QWidget *w = new QWidget;
    10. QToolButton * butA = new QToolButton;
    11. QToolButton * butB = new QToolButton;
    12. // layout
    13. QHBoxLayout * lo = new QHBoxLayout(w);
    14. lo->addWidget(butA);
    15. lo->addWidget(butB);
    16.  
    17. QTabWidget * tabWidget = new QTabWidget;
    18. tabWidget->addTab(new QWidget(), "test tab");
    19. tabWidget->setCornerWidget(w, Qt::TopRightCorner);
    20. tabWidget->show();
    21. return app.exec();
    22. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by momesana; 1st October 2007 at 22:35. Reason: reformatted to look better

Similar Threads

  1. Reuse a Qwidget with a QStackWidget
    By ucomesdag in forum Qt Programming
    Replies: 4
    Last Post: 25th April 2007, 02:47
  2. Replies: 4
    Last Post: 24th April 2007, 13:18
  3. Replies: 3
    Last Post: 8th March 2007, 14:54
  4. QTextEdit, sizeHint, QWidget
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 3rd February 2007, 08:25
  5. Replies: 1
    Last Post: 2nd May 2006, 21:11

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.