PopupMenu Class
The Qtitan::PopupMenu class provides a menu widget for use in menu bars, context menus, and other popup menus. More...
Header: | #include <PopupMenu> |
Inherits: | QMenu |
Inherited By: |
Public Functions
PopupMenu(QWidget *parent) | |
int | maxItemCount() const |
QWidget * | previewWidget() const |
void | setMaxItemCount(int maxCount) |
void | setPreviewWidget(QWidget *preview) |
Reimplemented Public Functions
virtual QSize | sizeHint() const override |
Reimplemented Protected Functions
virtual void | changeEvent(QEvent *event) override |
virtual void | keyPressEvent(QKeyEvent *event) override |
virtual void | paintEvent(QPaintEvent *event) override |
virtual void | resizeEvent(QResizeEvent *event) override |
Detailed Description
The Qtitan::PopupMenu is derived from QMenu and should be used in the same cases where regular QMenu is used. Additionally to the QMenu features, this class implements the ability to scroll items vertically if they do not fit completely on the screen or the number of items on the screen is limited by the property - PopupMenu::setMaxItemCount(). Moreover, it allows to display a custom QWidget on the right part from the menu items view which can be used as a preview for the selected item or jsut for additional info for the end-users.
Member Function Documentation
[explicit]
PopupMenu::PopupMenu(QWidget *parent)
Constructor of the class Qtitan::PopupMenu. The parameter parent
is a widget which will be parent and owner for the menu.
[override virtual protected]
void PopupMenu::changeEvent(QEvent *event)
Reimplements: QMenu::changeEvent(QEvent *e).
[override virtual protected]
void PopupMenu::keyPressEvent(QKeyEvent *event)
Reimplements: QMenu::keyPressEvent(QKeyEvent *e).
int PopupMenu::maxItemCount() const
Returns the maximum count of items at the menu view.
See also setMaxItemCount().
[override virtual protected]
void PopupMenu::paintEvent(QPaintEvent *event)
Reimplements: QMenu::paintEvent(QPaintEvent *e).
QWidget *PopupMenu::previewWidget() const
Returns the preview widget for the menu.
See also setPreviewWidget().
[override virtual protected]
void PopupMenu::resizeEvent(QResizeEvent *event)
Reimplements: QWidget::resizeEvent(QResizeEvent *event).
void PopupMenu::setMaxItemCount(int maxCount)
Sets the maximum count of items at the menu view to maxCount. By default the count of items is not limited, but the menu height will be limited by the screen size. If the menu items do not fit completely at the view, then scrolling buttons will appear.
See also maxItemCount().
void PopupMenu::setPreviewWidget(QWidget *preview)
Sets the preview widget for the menu. It will be shown at the right side from the menu items.
See also previewWidget().
[override virtual]
QSize PopupMenu::sizeHint() const
Reimplements: QMenu::sizeHint() const.