poppingtabwidget.h

来自「Qt开发的GRE背单词软件」· C头文件 代码 · 共 40 行

H
40
字号
/*
*  TabWidget that auto-hides when mouse leaves or double-clicks on the tab
*  shows up when mouse enters or double-clicks on the tab
*/

#ifndef POPPINGTABWIDGET_H
#define POPPINGTABWIDGET_H

#include <QTabWidget>
#include <QTimer>

class PoppingTabWidget : public QTabWidget
{
	Q_OBJECT

public:
	PoppingTabWidget(QWidget *parent);

protected:
	virtual void  showEvent (QShowEvent*);
	virtual void  leaveEvent(QEvent* event);
	virtual void  enterEvent(QEvent* event);

private slots:
	void slotExtend();
	void slotShrink();

private:
	bool autoHide()  const;
	int  showDelay() const;
	int  hideDelay() const;
	int  getMinShowWidth() const;

private:
	QTimer timerHide;
	QTimer timerShow;
};

#endif // POPPINGTABWIDGET_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?