[kde-artists] Re: Oxygen Tab Widgets.
Alexis Ménard <[email protected]>
| Newsgroups | gmane.comp.kde.artists |
|---|---|
| Message-ID | <[email protected]> |
Hello Hugo, So I looked a bit inside Oxygen. I did a patch (which is wrong because it does not fix all the cases for QTabWidget) but seems to give almost the same look as before but fix the scrolling issue by avoiding overlap. Attached 3 screenshots: - The original one (today) (number1) - With your line commented (number2) - With my patch (number3) Also if I comment the line you said nothing happen because the overlap is used somewhere else. If I put no overlap like in the second diff attached a margin appears on top of the content. What do you think? On Mon, Apr 18, 2011 at 7:05 AM, Hugo Pereira Da Costa <[email protected]> wrote: > On Monday 18 April 2011 12:04:21 Hugo Pereira Da Costa wrote: >> On Monday 18 April 2011 11:49:52 Hugo Pereira Da Costa wrote: >> > Hello Alexis, >> > >> > So I did some digging, and well, I'm not sure I have the skills to fix >> > myself either. >> > >> > This "overlap" thing, corresponds to what QStyle::pixelMetrics( >> > PM_TabBarBaseOverlap ) should return (so Qt knows about it). >> > >> > it is used in these two methods >> > >> > Oxygen::Style::tabWidgetTabPaneRect >> > Oxygen::Style::tabWidgetTabContentsRect >> > >> > which are what's called (by Qt) via >> > >> > QStyle::subElementRect( SE_TabWidgetTabContents ) >> > QStyle::subElementRect( SE_TabWidgetTabPane ) >> > >> > Looking at QCommonStyle implementation for the two above, well, they >> > don't differ 'much' in terms of metrics handling. (in fact I remember >> > copying them, and "tuning" them with +/-1 pixels here and there to fix >> > some bugs when dealing with corner cases of QTabWidget/KTabWidget >> > handling). >> > >> > QTabWidget is (by far) the most painful widget to deal with in styling >> > land and I've already spend hours (tenth's of hours) on it. (notably, >> > there is no existing Qt Style that does not have one bug or another with >> > it, in one possible or the other). >> > >> > I'm ok to revisit it in view of the problem you raise, but this will take >> > time (and my hand are pretty full at the moment). >> > >> > Feel free to file an actual bug report to oxygen (style) with as much >> > detail as you can so that it does not get lost in translation. >> > >> > Cheers, >> > >> > Hugo >> >> PS: I don't have (yet) a Debug build of Qt. >> Could you check if the bug persist if you comment the two lines: >> >> case SE_TabWidgetTabContents: return tabWidgetTabContentsRect( >> option, widget ); >> case SE_TabWidgetTabPane: return tabWidgetTabPaneRect( option, >> widget ); >> >> in oxygenstyle.cpp ? >> this should fallback to QCommonStyle implementation, will raise more bugs >> in some applications, but might give me more clue about what's going >> wrong. >> >> (note: maybe you can also try just commenting the first) > > argh. Sorry. I meant: just the second, namely > case SE_TabWidgetTabPane: return tabWidgetTabPaneRect( option, widget ); > > They should be around line 880 and 881 > ______________________________________________________________________________ [email protected] | https://mail.kde.org/mailman/listinfo/kde-artists
oxygen-original-1.png
(image/png, 48 KB) - not displayed
oxygen-no-overlap-2.png
(image/png, 48.2 KB) - not displayed
oxygen-patch-alex-3.png
(image/png, 48.1 KB) - not displayed
oxygen.diff
(text/x-patch, 5.2 KB)
diff --git a/kstyles/oxygen/oxygenstyle.cpp b/kstyles/oxygen/oxygenstyle.cpp
index 095b5d2..15cda9f 100644
--- a/kstyles/oxygen/oxygenstyle.cpp
+++ b/kstyles/oxygen/oxygenstyle.cpp
@@ -5401,7 +5401,8 @@ namespace Oxygen
case QTabBar::RoundedNorth:
case QTabBar::TriangularNorth:
{
- if( selected ) r.translate( 0, -1 );
+ if( selected ) r.translate( 0, 3 );
+ else r.translate( 0, 4 );
painter->translate( r.topLeft() );
r.moveTopLeft( QPoint( 0,0 ) );
break;
@@ -5624,11 +5625,10 @@ namespace Oxygen
case QTabBar::RoundedNorth:
case QTabBar::TriangularNorth:
{
-
// part of the tab in which the text is drawn
// larger tabs when selected
- if( selected ) tabRect.adjust( 0, -1, 0, 2 );
- else tabRect.adjust( 0, 1, 0, 2 );
+ if( selected ) tabRect.adjust( 0, 2, 0, 6 );
+ else tabRect.adjust( 0, 3, 0, 5 );
// reduces the space between tabs
tabRect.adjust( -GlowWidth,0,GlowWidth,0 );
@@ -5636,7 +5636,6 @@ namespace Oxygen
// connection to the main frame
if( selected )
{
-
// do nothing if dragged
if( isDragged ) break;
@@ -5656,7 +5655,7 @@ namespace Oxygen
QRect frameRect( r );
frameRect.setLeft( frameRect.left() - 7 );
frameRect.setRight( tabRect.left() + 7 + 3 );
- frameRect.setTop( r.bottom() - 7 );
+ frameRect.setTop( r.bottom() - 3);
slabs << SlabRect( frameRect, TileSet::Top );
}
@@ -5676,7 +5675,7 @@ namespace Oxygen
QRect frameRect( r );
frameRect.setLeft( tabRect.right() - 7 - 3 );
frameRect.setRight( frameRect.right() + 7 );
- frameRect.setTop( r.bottom() - 7 );
+ frameRect.setTop( r.bottom() - 3 );
slabs << SlabRect( frameRect, TileSet::Top );
}
@@ -5689,7 +5688,7 @@ namespace Oxygen
QRect frameRect( r );
frameRect.setLeft( tabBarRect.left() - 7 + 1 );
frameRect.setRight( r.left() + 7 - 1 );
- frameRect.setTop( r.bottom() - 7 );
+ frameRect.setTop( r.bottom() - 3);
if( documentMode || reverseLayout ) slabs << SlabRect( frameRect, TileSet::Top );
else slabs << SlabRect( frameRect, TileSet::TopLeft );
@@ -5701,7 +5700,7 @@ namespace Oxygen
QRect frameRect( r );
frameRect.setLeft( r.right() - 7 + 1 );
frameRect.setRight( tabBarRect.right() + 7 - 1 );
- frameRect.setTop( r.bottom() - 7 );
+ frameRect.setTop( r.bottom() - 3);
if( documentMode || !reverseLayout ) slabs << SlabRect( frameRect, TileSet::Top );
else slabs << SlabRect( frameRect, TileSet::TopRight );
}
@@ -5716,7 +5715,7 @@ namespace Oxygen
frameRect.setLeft( tabRect.right() - 7 );
frameRect.setRight( frameRect.right() + GlowWidth );
frameRect.setTop( tabRect.bottom() - 13 );
- frameRect.setBottom( frameRect.bottom() + 7 - 2 );
+ frameRect.setBottom( frameRect.bottom() - 2 );
slabs << SlabRect( frameRect, TileSet::Right );
}
@@ -5728,7 +5727,7 @@ namespace Oxygen
frameRect.setLeft( frameRect.left() - GlowWidth );
frameRect.setRight( tabRect.left() + 7 );
frameRect.setTop( tabRect.bottom() - 13 );
- frameRect.setBottom( frameRect.bottom() + 7 - 2 );
+ frameRect.setBottom( frameRect.bottom() - 2 );
slabs << SlabRect( frameRect, TileSet::Left );
}
diff --git a/kstyles/oxygen/oxygenstyle.h b/kstyles/oxygen/oxygenstyle.h
index 3f71681..bb07386 100644
--- a/kstyles/oxygen/oxygenstyle.h
+++ b/kstyles/oxygen/oxygenstyle.h
@@ -884,7 +884,7 @@ namespace Oxygen
Splitter_Width = 3,
// tabs
- TabBar_BaseOverlap = 7,
+ TabBar_BaseOverlap = 0,
TabBar_BaseHeight = 2,
TabBar_ScrollButtonWidth = 18,
TabBar_TabContentsMargin = 4,
@@ -892,9 +892,9 @@ namespace Oxygen
TabBar_TabContentsMargin_Right = 5,
TabBar_TabContentsMargin_Top = 2,
TabBar_TabContentsMargin_Bottom = 4,
- TabBar_TabOverlap =0,
+ TabBar_TabOverlap = 0,
- TabWidget_ContentsMargin = 4,
+ TabWidget_ContentsMargin = 1,
// toolbuttons
ToolButton_ContentsMargin = 4,
oxygen-no-overlap.diff
(text/x-patch, 463 B)
diff --git a/kstyles/oxygen/oxygenstyle.h b/kstyles/oxygen/oxygenstyle.h
index 3f71681..254a40f 100644
--- a/kstyles/oxygen/oxygenstyle.h
+++ b/kstyles/oxygen/oxygenstyle.h
@@ -884,7 +884,7 @@ namespace Oxygen
Splitter_Width = 3,
// tabs
- TabBar_BaseOverlap = 7,
+ TabBar_BaseOverlap = 0,
TabBar_BaseHeight = 2,
TabBar_ScrollButtonWidth = 18,
TabBar_TabContentsMargin = 4,