VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonPress.cpp@ 98103

Last change on this file since 98103 was 98103, checked in by vboxsync, 17 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1/* $Id: QIArrowButtonPress.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - Qt extensions: QIArrowButtonPress class implementation.
4 */
5
6/*
7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28/* Qt includes: */
29#include <QKeyEvent>
30
31/* GUI includes: */
32#include "QIArrowButtonPress.h"
33
34
35QIArrowButtonPress::QIArrowButtonPress(QIArrowButtonPress::ButtonType enmButtonType,
36 QWidget *pParent /* = 0 */)
37 : QIWithRetranslateUI<QIRichToolButton>(pParent)
38 , m_enmButtonType(enmButtonType)
39{
40 /* Retranslate UI: */
41 retranslateUi();
42}
43
44void QIArrowButtonPress::retranslateUi()
45{
46 /* Retranslate: */
47 switch (m_enmButtonType)
48 {
49 case ButtonType_Back: setText(tr("&Back")); break;
50 case ButtonType_Next: setText(tr("&Next")); break;
51 default: break;
52 }
53}
54
55void QIArrowButtonPress::keyPressEvent(QKeyEvent *pEvent)
56{
57 /* Handle different keys: */
58 switch (pEvent->key())
59 {
60 /* Animate-click for the Space key: */
61 case Qt::Key_PageUp: if (m_enmButtonType == ButtonType_Next) return animateClick(); break;
62 case Qt::Key_PageDown: if (m_enmButtonType == ButtonType_Back) return animateClick(); break;
63 default: break;
64 }
65 /* Call to base-class: */
66 QIWithRetranslateUI<QIRichToolButton>::keyPressEvent(pEvent);
67}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use