Results 1 to 4 of 4

Thread: How remove margins

  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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How remove margins

    I think the "margin" is simply part of the frame and can't be removed this way.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2016
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How remove margins

    Thank you for answer! I decided the problem with removing QTabWidget->QTabBar

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How remove margins

    Good idea.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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.