Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.7.1, 5.8.0
-
None
-
macOS Sierra 10.12.2
Description
Hello! For some reason QTabWidget on macOS looks non-native when the document mode is active. The first image shows QTabWidget with ugly tabs, while the second - the standard Terminal app that has standard tabs.
The problem is that setDocumentMode(true) call makes the QTabWidget to enable the so-called document mode, when each tab contains an independent document. For some reason, Qt does not use the standard style for it.
Here is a code sample that reproduces the issue:
File MainWindow.h:
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QTabWidget> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; QTabWidget *tabs; }; #endif // MAINWINDOW_H
File MainWindow.cpp:
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QPlainTextEdit> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); tabs = new QTabWidget(this); setCentralWidget(tabs); tabs->setDocumentMode(true); for (auto i = 0; i < 3; ++i) { auto editor = new QPlainTextEdit(); tabs->addTab(editor, "Editor"); } } MainWindow::~MainWindow() { delete ui; }
Any other file (main.cpp, form itself) is left untouched.
I do not use any additional styles, everything is out-of-the-box&