1 | /* $Id: QIStatusBar.cpp 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QIStatusBar class implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2024 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 <QAccessibleWidget>
|
---|
30 |
|
---|
31 | /* GUI includes: */
|
---|
32 | #include "QIStatusBar.h"
|
---|
33 |
|
---|
34 |
|
---|
35 | /** QAccessibleWidget extension used as an accessibility interface for QIStatusBar. */
|
---|
36 | class QIAccessibilityInterfaceForQIStatusBar : public QAccessibleWidget
|
---|
37 | {
|
---|
38 | public:
|
---|
39 |
|
---|
40 | /** Returns an accessibility interface for passed @a strClassname and @a pObject. */
|
---|
41 | static QAccessibleInterface *pFactory(const QString &strClassname, QObject *pObject)
|
---|
42 | {
|
---|
43 | /* Creating QIStatusBar accessibility interface: */
|
---|
44 | if (pObject && strClassname == QLatin1String("QIStatusBar"))
|
---|
45 | return new QIAccessibilityInterfaceForQIStatusBar(qobject_cast<QWidget*>(pObject));
|
---|
46 |
|
---|
47 | /* Null by default: */
|
---|
48 | return 0;
|
---|
49 | }
|
---|
50 |
|
---|
51 | /** Constructs an accessibility interface passing @a pWidget to the base-class. */
|
---|
52 | QIAccessibilityInterfaceForQIStatusBar(QWidget *pWidget)
|
---|
53 | : QAccessibleWidget(pWidget, QAccessible::ToolBar)
|
---|
54 | {
|
---|
55 | // We are not interested in status-bar text as it's a mean of
|
---|
56 | // accessibility in case when accessibility is disabled.
|
---|
57 | // Since accessibility is enabled in our case, we wish
|
---|
58 | // to pass control token to our sub-elements.
|
---|
59 | // So we are using QAccessible::ToolBar.
|
---|
60 | }
|
---|
61 | };
|
---|
62 |
|
---|
63 |
|
---|
64 | /*********************************************************************************************************************************
|
---|
65 | * Class QIStatusBar implementation. *
|
---|
66 | *********************************************************************************************************************************/
|
---|
67 |
|
---|
68 | QIStatusBar::QIStatusBar(QWidget *pParent)
|
---|
69 | : QStatusBar(pParent)
|
---|
70 | {
|
---|
71 | /* Install QIStatusBar accessibility interface factory: */
|
---|
72 | QAccessible::installFactory(QIAccessibilityInterfaceForQIStatusBar::pFactory);
|
---|
73 |
|
---|
74 | /* Make sure we remember the last one status message: */
|
---|
75 | connect(this, &QIStatusBar::messageChanged,
|
---|
76 | this, &QIStatusBar::sltRememberLastMessage);
|
---|
77 |
|
---|
78 | /* Remove that ugly border around the status-bar items on every platform: */
|
---|
79 | setStyleSheet("QStatusBar::item { border: 0px none black; }");
|
---|
80 | }
|
---|