Results 1 to 4 of 4

Thread: How remove margins

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2016
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default How remove margins

    How can i remove margins between QTabWidgets? Example - red oval on the right side.

    Use the next code:

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent)
    2. : QMainWindow(parent)
    3. {
    4. QTabWidget *tabWidget = new QTabWidget(this);
    5. tabWidget->setContentsMargins(0,0,0,0);
    6. tabWidget->addTab(new QWidget(), "test1");
    7. tabWidget->addTab(new QWidget(), "test2");
    8. tabWidget->widget(0)->setContentsMargins(0,0,0,0);
    9. tabWidget->widget(1)->setContentsMargins(0,0,0,0);
    10.  
    11. setCentralWidget(tabWidget);
    12.  
    13. QTabWidget *tabWidget2 = new QTabWidget(this);
    14. tabWidget2->setContentsMargins(0,0,0,0);
    15. tabWidget2->addTab(new QWidget(), "test1");
    16. tabWidget2->addTab(new QWidget(), "test2");
    17. tabWidget2->widget(0)->setContentsMargins(0,0,0,0);
    18. tabWidget2->widget(1)->setContentsMargins(0,0,0,0);
    19.  
    20. QVBoxLayout *layout = new QVBoxLayout;
    21. layout->setContentsMargins(0,0,0,0);
    22. layout->addWidget(tabWidget2);
    23.  
    24. tabWidget->widget(0)->setLayout(layout);
    25. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images
    Last edited by wysota; 19th April 2017 at 11:38. Reason: missing [code] tags

Similar Threads

  1. How to remove margins from plot?
    By P@u1 in forum Qwt
    Replies: 2
    Last Post: 27th July 2011, 14:10
  2. Axis margins
    By jcox23 in forum Qwt
    Replies: 1
    Last Post: 10th December 2010, 09:55
  3. Remove the Margins
    By Serenity in forum Qt Programming
    Replies: 1
    Last Post: 12th August 2010, 10:33
  4. QScrollArea margins
    By munna in forum Qt Programming
    Replies: 12
    Last Post: 18th September 2006, 18:56
  5. QComboBox Margins
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 19th August 2006, 11: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.