mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-22 07:41:20 -04:00
Added new option to hide the tabbar with one open tab in forums and channels.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7450 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b6089f3b91
commit
d6408daafc
12 changed files with 107 additions and 6 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
RSTabWidget::RSTabWidget(QWidget *parent) : QTabWidget(parent)
|
||||
{
|
||||
mHideTabBarWithOneTab = false;
|
||||
}
|
||||
|
||||
QTabBar *RSTabWidget::tabBar() const
|
||||
|
@ -41,3 +42,40 @@ void RSTabWidget::hideCloseButton(int index)
|
|||
tabButton->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void RSTabWidget::setHideTabBarWithOneTab(bool hideTabBar)
|
||||
{
|
||||
if (mHideTabBarWithOneTab == hideTabBar) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHideTabBarWithOneTab = hideTabBar;
|
||||
hideTabBarWithOneTab();
|
||||
}
|
||||
|
||||
void RSTabWidget::tabInserted(int index)
|
||||
{
|
||||
QTabWidget::tabInserted(index);
|
||||
|
||||
if (mHideTabBarWithOneTab) {
|
||||
hideTabBarWithOneTab();
|
||||
}
|
||||
}
|
||||
|
||||
void RSTabWidget::tabRemoved(int index)
|
||||
{
|
||||
QTabWidget::tabRemoved(index);
|
||||
|
||||
if (mHideTabBarWithOneTab) {
|
||||
hideTabBarWithOneTab();
|
||||
}
|
||||
}
|
||||
|
||||
void RSTabWidget::hideTabBarWithOneTab()
|
||||
{
|
||||
if (mHideTabBarWithOneTab) {
|
||||
tabBar()->setVisible(count() > 1);
|
||||
} else {
|
||||
tabBar()->show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,20 @@ public:
|
|||
RSTabWidget(QWidget *parent = 0);
|
||||
|
||||
void hideCloseButton(int index);
|
||||
void setHideTabBarWithOneTab(bool hideTabBar);
|
||||
|
||||
public:
|
||||
QTabBar *tabBar() const;
|
||||
|
||||
protected:
|
||||
virtual void tabInserted(int index);
|
||||
virtual void tabRemoved(int index);
|
||||
|
||||
private:
|
||||
void hideTabBarWithOneTab();
|
||||
|
||||
private:
|
||||
bool mHideTabBarWithOneTab;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue