Commit 1ff14009 authored by Robert Knight's avatar Robert Knight

Put the space between the tab bar and the main window in the view container...

Put the space between the tab bar and the main window in the view container (ie. the tab container) rather than the main window - so that it disappears when the tab bar is hidden.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=661690
parent a95ff805
......@@ -59,7 +59,7 @@ MainWindow::MainWindow()
// add a small amount of space between the top of the window and the main widget
// to prevent the menu bar and main widget borders touching (which looks very ugly) in styles
// where the menu bar has a lower border
setContentsMargins(0,2,0,0);
//setContentsMargins(0,2,0,0);
// create actions for menus
setXMLFile("konsole/konsoleui.rc");
......
......@@ -400,18 +400,34 @@ TabbedViewContainerV2::TabbedViewContainerV2(QObject* parent) : ViewContainer(pa
QVBoxLayout* layout = new QVBoxLayout;
layout->setSpacing(0);
layout->setMargin(0);
_tabBarSpacer = new QSpacerItem(0,TabBarSpace);
layout->addItem(_tabBarSpacer);
layout->addWidget(_tabBar);
layout->addWidget(_stackWidget);
_containerWidget->setLayout(layout);
}
void TabbedViewContainerV2::setTabBarVisible(bool visible)
{
_tabBar->setVisible(visible);
if ( visible )
{
_tabBarSpacer->changeSize(0,TabBarSpace);
}
else
{
_tabBarSpacer->changeSize(0,0);
}
}
void TabbedViewContainerV2::navigationDisplayModeChanged(NavigationDisplayMode mode)
{
if ( mode == AlwaysShowNavigation && _tabBar->isHidden() )
_tabBar->setVisible(true);
setTabBarVisible(true);
if ( mode == AlwaysHideNavigation && !_tabBar->isHidden() )
_tabBar->setVisible(false);
setTabBarVisible(false);
if ( mode == ShowNavigationAsNeeded )
dynamicTabBarVisibility();
......@@ -422,10 +438,10 @@ void TabbedViewContainerV2::dynamicTabBarVisibility()
qDebug() << "tab var hidden:" << _tabBar->isHidden();
if ( _tabBar->count() > 1 && _tabBar->isHidden() )
_tabBar->show();
setTabBarVisible(true);
if ( _tabBar->count() < 2 && !_tabBar->isHidden() )
_tabBar->hide();
setTabBarVisible(false);
}
TabbedViewContainerV2::~TabbedViewContainerV2()
{
......
......@@ -28,6 +28,7 @@
#include <QList>
#include <QTabBar>
class QSpacerItem;
class QStackedWidget;
class QWidget;
......@@ -268,10 +269,14 @@ private slots:
private:
void dynamicTabBarVisibility();
void setTabBarVisible(bool visible);
ViewContainerTabBar* _tabBar;
QStackedWidget* _stackWidget;
QWidget* _containerWidget;
QSpacerItem* _tabBarSpacer;
static const int TabBarSpace = 2;
};
/**
......
......@@ -303,7 +303,11 @@ void ViewManager::splitView(Qt::Orientation orientation)
container->containerWidget()->setFocus();
// ensure that the active view is focused after the split / unsplit
_viewSplitter->activeContainer()->activeView()->setFocus(Qt::OtherFocusReason);
ViewContainer* activeContainer = _viewSplitter->activeContainer();
QWidget* activeView = activeContainer ? activeContainer->activeView() : 0;
if ( activeView )
activeView->setFocus(Qt::OtherFocusReason);
}
void ViewManager::removeContainer(ViewContainer* container)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment