toolbar.h

来自「c++的guiQt做的开发」· C头文件 代码 · 共 59 行

H
59
字号
#ifndef __TOOLBAR_H__#define __TOOLBAR_H__#include <QToolBar>class QMainWindow;namespace gui {class ToolButton;/** Minimal allowed size of one ToolButton */const int MIN_TOOLBUTTON_SIZE=12;/** Maximal allowed size of one ToolButton */const int MAX_TOOLBUTTON_SIZE=128;/** Default size of one ToolButton */const int DEFAULT_TOOLBUTTON_SIZE=22;/** Class wrapping QToolBar, providing "click forwarding" from TButtons. Buttons must be added with addButton() for this to work properly \brief Application toolbar */class ToolBar : public QToolBar { Q_OBJECTpublic: ToolBar(const QString &label,QMainWindow *mainWindow); void addButton(ToolButton *qb);signals: /**  Signal emitted to buttons when request to resize them is received  @param sz new size of toolbar buttons */ void setNewSize(int sz); /**  Signal emitted when clicked on one of toolbar buttons.  Send pointer to button with it.  @param id pointer to clicked button */ void itemClicked(ToolButton *id); /**  Send help message when mouse cursor enters/leaves on of toolbar buttons.  Help message is sent on entering and QString::null on leaving.  @param message Help message */ void helpText(const QString &message);public slots: void setButtonSizes(int newSize); void slotClicked(ToolButton *id); void receiveHelpText(const QString &message);private: /** Currently set button size, applied on new items */ int currentButtonSize;};} // namespace gui#endif

⌨️ 快捷键说明

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