OfficePopupWindow Class

OfficePopupWindow class is a realization of a Microsoft Office popup window. Such window is widely used in products of Microsoft Office for showing messages or groups of messages. Typically, a window appears at the bottom right. Just above the desktop task bar. OfficeStyle and RibbonStyle have a property setPopupDecoration() to set the decoration of this window. With this property you can give a look of Microsoft Messanger (MSN) or it allows to decorate the window depending on the style which installed in QApplication. More...

Header: #include <OfficePopupWindow>
Inherits: QWidget

Public Types

enum PopupAnimation { PopupAnimationNone, PopupAnimationFade, PopupAnimationSlide, PopupAnimationUnfold }
enum PopupLocation { PopupLocationNearTaskBar, PopupLocationBottomRight, PopupLocationCenter }

Public Functions

OfficePopupWindow::PopupAnimation animation() const
int animationSpeed() const
const QString &bodyText() const
QWidget *centralWidget() const
const QPixmap &closeButtonPixmap() const
int displayTime() const
bool dragDropEnabled() const
QPoint getPosition() const
bool isTitleCloseButtonVisible() const
OfficePopupWindow::PopupLocation location() const
void setAnimation(OfficePopupWindow::PopupAnimation popupAnimation)
void setAnimationSpeed(int time)
void setBodyText(const QString &text)
void setCentralWidget(QWidget *widget)
void setCloseButtonPixmap(const QPixmap &pixmap)
void setDisplayTime(int time)
void setDragDropEnabled(bool enabled)
void setLocation(OfficePopupWindow::PopupLocation location)
void setPosition(const QPoint &pos)
void setTitleCloseButtonVisible(bool visible = true)
void setTitleIcon(const QIcon &icon)
void setTitleText(const QString &text)
void setTransparency(qreal transparency)
bool showPopup()
bool showPopup(const QPoint &pos)
const QIcon &titleIcon() const
const QString &titleText() const
qreal transparency() const

Reimplemented Public Functions

virtual QSize sizeHint() const override

Public Slots

void closePopup()

Signals

void aboutToHide()
void aboutToShow()

Static Public Members

void showPopup(QWidget *parent, const QIcon &titleIcon, const QString &titleText, const QString &bodyText, bool closeButtonVisible = true)

Reimplemented Protected Functions

virtual void enterEvent(QEnterEvent *event) override
virtual bool event(QEvent *event) override
virtual void leaveEvent(QEvent *event) override
virtual void paintEvent(QPaintEvent *event) override

Detailed Description

Variants of the office popup windows with different decoration



Member Type Documentation

enum OfficePopupWindow::PopupAnimation

This enum describes the style of how window will appearing on the screen.

ConstantValueDescription
OfficePopupWindow::PopupAnimationNone0Animation is not using.
OfficePopupWindow::PopupAnimationFade1Fade method of animation
OfficePopupWindow::PopupAnimationSlide2Slide method of animation
OfficePopupWindow::PopupAnimationUnfold3Unfold method of animation

enum OfficePopupWindow::PopupLocation

This enum describes the start position of the OfficePopupWindow.

ConstantValueDescription
OfficePopupWindow::PopupLocationNearTaskBar0OfficePopupWindow appear at the bottom-right corner of the desktop (above the desktop taskbar). Please note this value is relevant to OS Windows only.
OfficePopupWindow::PopupLocationBottomRight1OfficePopupWindow appear in the bottom-right corner of the desktop.
OfficePopupWindow::PopupLocationCenter2OfficePopupWindow appear in the center of the desktop.

Member Function Documentation

[signal] void OfficePopupWindow::aboutToHide()

The signal is emitted just before the office popup window is hidden from the user.

See also aboutToShow() and showPopup().

[signal] void OfficePopupWindow::aboutToShow()

The signal is emitted just before the office popup window is shown to the user.

See also aboutToHide() and closePopup().

OfficePopupWindow::PopupAnimation OfficePopupWindow::animation() const

Returns the popup window animation type.

Note: Getter function for property animation.

See also setAnimation().

int OfficePopupWindow::animationSpeed() const

Returns the speed of the animation in milliseconds.

Note: Getter function for property animationSpeed.

See also setAnimationSpeed().

const QString &OfficePopupWindow::bodyText() const

Returns the text of the popup window body. Returned text is the same you have passed to setBodyText() function.

Note: Getter function for property bodyText.

See also setBodyText().

QWidget *OfficePopupWindow::centralWidget() const

Returns the central widget for the office popup window.

See also setCentralWidget().

const QPixmap &OfficePopupWindow::closeButtonPixmap() const

Returns the close button pixmap for painting on the office popup window title.

See also setCloseButtonPixmap().

[slot] void OfficePopupWindow::closePopup()

Hides the office popup window.

int OfficePopupWindow::displayTime() const

Returns the display time for showing office popup window. The returned value is in milliseconds.

Note: Getter function for property displayTime.

See also setDisplayTime().

bool OfficePopupWindow::dragDropEnabled() const

Returns the drag-and-drop flag for the popup box. If returned value is true then the user may use grip to drag-and-drop window over desktop.

See also setDragDropEnabled().

[override virtual protected] void OfficePopupWindow::enterEvent(QEnterEvent *event)

Reimplements: QWidget::enterEvent(QEnterEvent *event).

[override virtual protected] bool OfficePopupWindow::event(QEvent *event)

Reimplements: QWidget::event(QEvent *event).

QPoint OfficePopupWindow::getPosition() const

Returns the current popup window position on the desktop.

bool OfficePopupWindow::isTitleCloseButtonVisible() const

Returns the visibility of the title's close buttone.

Note: Getter function for property titleCloseButtonVisible.

[override virtual protected] void OfficePopupWindow::leaveEvent(QEvent *event)

Reimplements: QWidget::leaveEvent(QEvent *event).

OfficePopupWindow::PopupLocation OfficePopupWindow::location() const

Returns the start location of the office popup window.

Note: Getter function for property location.

See also setLocation().

[override virtual protected] void OfficePopupWindow::paintEvent(QPaintEvent *event)

Reimplements: QWidget::paintEvent(QPaintEvent *event).

void OfficePopupWindow::setAnimation(OfficePopupWindow::PopupAnimation popupAnimation)

Sets the popup window animation type with given popupAnimation parameter.

Note: Setter function for property animation.

See also animation().

void OfficePopupWindow::setAnimationSpeed(int time)

Sets the speed of the animation. time - the value of the speed in milliseconds.

Note: Setter function for property animationSpeed.

See also animationSpeed().

void OfficePopupWindow::setBodyText(const QString &text)

Sets the body text for the popup window. The body text can be pure text or HTML.

Note: Setter function for property bodyText.

See also bodyText().

void OfficePopupWindow::setCentralWidget(QWidget *widget)

Sets the central widget for the office popup window. The method is used when you have to show the non-standard contents inside the popup box. In this case the settings of the titleText(), titleIcon() and bodyText() will be ignored and given widget will be showing instead.

See also centralWidget().

void OfficePopupWindow::setCloseButtonPixmap(const QPixmap &pixmap)

Sets the close button pixmap for painting on the office popup window title.

See also closeButtonPixmap().

void OfficePopupWindow::setDisplayTime(int time)

Sets the display time for showing office popup window. Parameter time is the value in milliseconds.

Note: Setter function for property displayTime.

See also displayTime().

void OfficePopupWindow::setDragDropEnabled(bool enabled)

Sets the drag-and-drop enabled flag for the popup box. If enabled is true then the user may use grip to drag-and-drop window over desktop.

See also dragDropEnabled().

void OfficePopupWindow::setLocation(OfficePopupWindow::PopupLocation location)

Sets the start location of the office popup window.

Note: Setter function for property location.

See also location().

void OfficePopupWindow::setPosition(const QPoint &pos)

Sets the popup window position on the desktop with given pos parameter.

void OfficePopupWindow::setTitleCloseButtonVisible(bool visible = true)

Sets the visibility of the title's close button. Parameter visible is a visibility of the close button.

Note: Setter function for property titleCloseButtonVisible.

See also isTitleCloseButtonVisible().

void OfficePopupWindow::setTitleIcon(const QIcon &icon)

Sets the icon for the office popup window title.

Note: Setter function for property titleIcon.

See also titleIcon().

void OfficePopupWindow::setTitleText(const QString &text)

Sets the text for the office popup window title. Text can be pure text or HTML.

Note: Setter function for property titleText.

See also titleText().

void OfficePopupWindow::setTransparency(qreal transparency)

Sets the start transparency of the office popup window.

Note: Setter function for property transparency.

See also transparency().

[static] void OfficePopupWindow::showPopup(QWidget *parent, const QIcon &titleIcon, const QString &titleText, const QString &bodyText, bool closeButtonVisible = true)

Static method to quick show the office popup box with given parent, titleIcon - title icon, titleText - title text and bodyText - body text. You may use HTML to fill titleText and bodyText. Optional parameters closeButtonVisible and decoration are used for the customization purposes. After it will be closed the instance of the window will be deleted automaticaly.

To show such message on the desktop you need invoke code bellow:

QString titleHtml = "<span style=\"font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:600; font-style:normal;\">John Smith</span><br>Re: Your request";
QString bodyHtml = "<a href='#'><img src=':/res/cross.ico'></a> \
                <a href='#'><img src=':/res/flag.ico'></a> \
                <span style=\"color:#0000ff; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;\"> \
                I am sending you the requested inform&nbsp;&nbsp;&nbsp;</span>";
OfficePopupWindow::showPopup(0, QIcon(":/res/letter.ico"), titleHtml, bodyHtml);

bool OfficePopupWindow::showPopup()

Shows popup box on the desktop.

bool OfficePopupWindow::showPopup(const QPoint &pos)

Shows popup box on the desktop at the given pos. This method is equal to: setPosition(pos); showPopup(); line of code.

[override virtual] QSize OfficePopupWindow::sizeHint() const

Reimplements an access function for property: QWidget::sizeHint.

const QIcon &OfficePopupWindow::titleIcon() const

Returns the icon of the office popup window title.

Note: Getter function for property titleIcon.

See also setTitleIcon().

const QString &OfficePopupWindow::titleText() const

Returns the text of the popup window title. Returned text is the same you have passed to setTitleText() function.

Note: Getter function for property titleText.

See also setTitleText().

qreal OfficePopupWindow::transparency() const

Returns the start transparency of the office popup window.

Note: Getter function for property transparency.

See also setTransparency().