How to put a picture in QTabWidget, so that it occupies the entire tab?

  • What is the minus for? What are we closing for? You can see the gradient fields on the sides and the bottom of white - the question is how to make them out and the picture takes up all the space. - Qwertiy
  • Explain in more detail exactly how the picture should be placed? The tab should be the size of a picture or vice versa a picture the size of a tab? - Cerbo
  • the picture should be the size of a tab and the picture should occupy the whole tab - Taras

2 answers 2

Use void QTabWidget::setTabIcon(int index, const QIcon& icon) to set a picture on your tab. The size can be set as follows: void QTabWidget::setIconSize(const QSize& size) .

  • gray fields are still visible - Taras
  • Then inherit your class from QTabWidget and override the void paintEvent(QPaintEvent* ev) function void paintEvent(QPaintEvent* ev) - aleks.andr

Try in stylesheet

 QTabBar::tab {padding: 0px 0px 0px 0px;}