1 | /* $Id: QIToolButton.cpp 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QIToolButton class implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-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 | /* GUI includes: */
|
---|
29 | #include "QIToolButton.h"
|
---|
30 |
|
---|
31 |
|
---|
32 | QIToolButton::QIToolButton(QWidget *pParent /* = 0 */)
|
---|
33 | : QToolButton(pParent)
|
---|
34 | {
|
---|
35 | #ifdef VBOX_WS_MAC
|
---|
36 | /* Keep size-hint alive: */
|
---|
37 | const QSize sh = sizeHint();
|
---|
38 | setStyleSheet("QToolButton { border: 0px none black; margin: 0px 0px 0px 0px; } QToolButton::menu-indicator {image: none;}");
|
---|
39 | setFixedSize(sh);
|
---|
40 | #else /* !VBOX_WS_MAC */
|
---|
41 | setAutoRaise(true);
|
---|
42 | #endif /* !VBOX_WS_MAC */
|
---|
43 | }
|
---|
44 |
|
---|
45 | void QIToolButton::setAutoRaise(bool fEnabled)
|
---|
46 | {
|
---|
47 | #ifdef VBOX_WS_MAC
|
---|
48 | /* Ignore for macOS: */
|
---|
49 | Q_UNUSED(fEnabled);
|
---|
50 | #else /* !VBOX_WS_MAC */
|
---|
51 | /* Call to base-class: */
|
---|
52 | QToolButton::setAutoRaise(fEnabled);
|
---|
53 | #endif /* !VBOX_WS_MAC */
|
---|
54 | }
|
---|
55 |
|
---|
56 | void QIToolButton::removeBorder()
|
---|
57 | {
|
---|
58 | setStyleSheet("QToolButton { border: 0px }");
|
---|
59 | }
|
---|