From 655a4f5515f02c057dc47abd7bdfbd4059ff494c Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Fri, 25 May 2012 19:05:38 +0200 Subject: [PATCH] Fix painting of hidden tabbar on gtk When there is a single document open, the tabbar gets hidden. The only and selected tab is still visible though as a break in the line delining the tabwidget. To fix this we paint the tabwidget ourselves and remove the presence of the hidden tab. --- src/frontends/qt4/GuiWorkArea.cpp | 19 +++++++++++++++++++ src/frontends/qt4/GuiWorkArea.h | 1 + 2 files changed, 20 insertions(+) diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 5eca896fa1..362f062059 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -1555,6 +1555,25 @@ TabWorkArea::TabWorkArea(QWidget * parent) } +void TabWorkArea::paintEvent(QPaintEvent * event) +{ + if (tabBar()->isVisible()) { + QTabWidget::paintEvent(event); + } else { + // Prevent the selected tab to influence the + // painting of the frame of the tab widget. + // This is needed for gtk style in Qt. + QStylePainter p(this); + QStyleOptionTabWidgetFrameV2 opt; + initStyleOption(&opt); + opt.rect = style()->subElementRect(QStyle::SE_TabWidgetTabPane, + &opt, this); + opt.selectedTabRect = QRect(); + p.drawPrimitive(QStyle::PE_FrameTabWidget, opt); + } +} + + void TabWorkArea::mouseDoubleClickEvent(QMouseEvent * event) { if (event->button() != Qt::LeftButton) diff --git a/src/frontends/qt4/GuiWorkArea.h b/src/frontends/qt4/GuiWorkArea.h index 42bde9de90..e283d3130a 100644 --- a/src/frontends/qt4/GuiWorkArea.h +++ b/src/frontends/qt4/GuiWorkArea.h @@ -201,6 +201,7 @@ public: GuiWorkArea * currentWorkArea(); GuiWorkArea * workArea(Buffer & buffer); GuiWorkArea * workArea(int index); + void paintEvent(QPaintEvent *); Q_SIGNALS: /// -- 2.39.2