[55401] | 1 | /* $Id: QIToolButton.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
[25177] | 2 | /** @file
|
---|
[71346] | 3 | * VBox Qt GUI - Qt extensions: QIToolButton class implementation.
|
---|
[25177] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2009-2023 Oracle and/or its affiliates.
|
---|
[25177] | 8 | *
|
---|
[96407] | 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
|
---|
[25177] | 26 | */
|
---|
| 27 |
|
---|
[71346] | 28 | /* GUI includes: */
|
---|
| 29 | #include "QIToolButton.h"
|
---|
[25177] | 30 |
|
---|
| 31 |
|
---|
[71346] | 32 | QIToolButton::QIToolButton(QWidget *pParent /* = 0 */)
|
---|
| 33 | : QToolButton(pParent)
|
---|
[25177] | 34 | {
|
---|
[60362] | 35 | #ifdef VBOX_WS_MAC
|
---|
[71346] | 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);
|
---|
[60362] | 40 | #else /* !VBOX_WS_MAC */
|
---|
[71346] | 41 | setAutoRaise(true);
|
---|
[60362] | 42 | #endif /* !VBOX_WS_MAC */
|
---|
[71346] | 43 | }
|
---|
[39932] | 44 |
|
---|
[71346] | 45 | void QIToolButton::setAutoRaise(bool fEnabled)
|
---|
| 46 | {
|
---|
[60362] | 47 | #ifdef VBOX_WS_MAC
|
---|
[71346] | 48 | /* Ignore for macOS: */
|
---|
| 49 | Q_UNUSED(fEnabled);
|
---|
[60362] | 50 | #else /* !VBOX_WS_MAC */
|
---|
[71346] | 51 | /* Call to base-class: */
|
---|
| 52 | QToolButton::setAutoRaise(fEnabled);
|
---|
[60362] | 53 | #endif /* !VBOX_WS_MAC */
|
---|
[71346] | 54 | }
|
---|
[54079] | 55 |
|
---|
[71346] | 56 | void QIToolButton::removeBorder()
|
---|
| 57 | {
|
---|
| 58 | setStyleSheet("QToolButton { border: 0px }");
|
---|
| 59 | }
|
---|