Changeset - cb97d68d7245
[Not reviewed]
default
0 2 0
Hasan Yavuz ÖZDERYA - 10 years ago 2015-09-02 00:31:04
hy@ozderya.net
hide tabs with double click
2 files changed with 7 insertions and 0 deletions:
0 comments (0 inline, 0 general)
hidabletabwidget.cpp
Show inline comments
 
@@ -7,30 +7,36 @@ HidableTabWidget::HidableTabWidget(QWidg
 
    QTabWidget(parent),
 
    hideAction("▾", this)
 
{
 
    hideAction.setCheckable(true);
 
    hideAction.setToolTip("Hide Panels");
 
    QToolButton* hideButton = new QToolButton();
 
    hideButton->setDefaultAction(&hideAction);
 
    hideButton->setAutoRaise(true);
 
    this->setCornerWidget(hideButton);
 

	
 
    connect(&hideAction, SIGNAL(toggled(bool)), this, SLOT(onHideAction(bool)));
 
    connect(this, SIGNAL(tabBarClicked(int)), this, SLOT(onTabBarClicked()));
 
    connect(this, SIGNAL(tabBarDoubleClicked(int)), this, SLOT(onTabBarDoubleClicked()));
 
}
 

	
 
void HidableTabWidget::onHideAction(bool checked)
 
{
 
    if (checked)
 
    {
 
        this->setMaximumHeight(this->tabBar()->height());
 
    }
 
    else
 
    {
 
        this->setMaximumHeight(100000); // just a very big number
 
    }
 
}
 

	
 
void HidableTabWidget::onTabBarClicked()
 
{
 
    hideAction.setChecked(false);
 
}
 

	
 
void HidableTabWidget::onTabBarDoubleClicked()
 
{
 
    hideAction.setChecked(true);
 
}
hidabletabwidget.h
Show inline comments
 
@@ -5,15 +5,16 @@
 
#include <QAction>
 

	
 
class HidableTabWidget : public QTabWidget
 
{
 
    Q_OBJECT
 
public:
 
    explicit HidableTabWidget(QWidget *parent = 0);
 
    QAction hideAction;
 

	
 
private slots:
 
    void onHideAction(bool checked);
 
    void onTabBarClicked();
 
    void onTabBarDoubleClicked();
 
};
 

	
 
#endif // HIDABLETABWIDGET_H
0 comments (0 inline, 0 general)