VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMenuBar.cpp@ 76553

Last change on this file since 76553 was 76553, checked in by vboxsync, 5 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1/* $Id: UIMenuBar.cpp 76553 2019-01-01 01:45:53Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMenuBar class implementation.
4 */
5
6/*
7 * Copyright (C) 2010-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifdef VBOX_WITH_PRECOMPILED_HEADERS
19# include <precomp.h>
20#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
21
22/* Qt includes: */
23# include <QPainter>
24# include <QPaintEvent>
25# include <QPixmapCache>
26
27/* GUI includes: */
28# include "VBoxGlobal.h"
29# include "UIImageTools.h"
30# include "UIMenuBar.h"
31
32#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
33
34
35UIMenuBar::UIMenuBar(QWidget *pParent /* = 0 */)
36 : QMenuBar(pParent)
37 , m_fShowBetaLabel(false)
38{
39 /* Check for beta versions: */
40 if (vboxGlobal().isBeta())
41 m_fShowBetaLabel = true;
42}
43
44void UIMenuBar::paintEvent(QPaintEvent *pEvent)
45{
46 /* Call to base-class: */
47 QMenuBar::paintEvent(pEvent);
48
49 /* Draw BETA label if necessary: */
50 if (m_fShowBetaLabel)
51 {
52 QPixmap betaLabel;
53 const QString key("vbox:betaLabel");
54 if (!QPixmapCache::find(key, betaLabel))
55 {
56 betaLabel = ::betaLabel();
57 QPixmapCache::insert(key, betaLabel);
58 }
59 QSize s = size();
60 QPainter painter(this);
61 painter.setClipRect(pEvent->rect());
62 painter.drawPixmap(s.width() - betaLabel.width() - 10, (height() - betaLabel.height()) / 2, betaLabel);
63 }
64}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use