1 | /* $Id: VBoxUtils.h 74431 2018-09-24 09:16:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Declarations of utility classes and functions.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2018 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 | #ifndef ___VBoxUtils_h___
|
---|
19 | #define ___VBoxUtils_h___
|
---|
20 |
|
---|
21 | /* Qt includes: */
|
---|
22 | #include <QMouseEvent>
|
---|
23 | #include <QWidget>
|
---|
24 | #include <QTextBrowser>
|
---|
25 |
|
---|
26 | /* GUI includes: */
|
---|
27 | #include "UILibraryDefs.h"
|
---|
28 | #ifdef VBOX_WS_MAC
|
---|
29 | # include "VBoxUtils-darwin.h"
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | /* Other VBox includes: */
|
---|
33 | #include <iprt/types.h>
|
---|
34 |
|
---|
35 |
|
---|
36 | /** QObject subclass,
|
---|
37 | * allowing to apply string-property value for a certain QObject. */
|
---|
38 | class SHARED_LIBRARY_STUFF QObjectPropertySetter : public QObject
|
---|
39 | {
|
---|
40 | Q_OBJECT;
|
---|
41 |
|
---|
42 | public:
|
---|
43 |
|
---|
44 | /** Constructs setter for a property with certain @a strName, passing @a pParent to the base-class. */
|
---|
45 | QObjectPropertySetter(QObject *pParent, const QString &strName)
|
---|
46 | : QObject(pParent), m_strName(strName)
|
---|
47 | {}
|
---|
48 |
|
---|
49 | public slots:
|
---|
50 |
|
---|
51 | /** Assigns string property @a strValue. */
|
---|
52 | void sltAssignProperty(const QString &strValue)
|
---|
53 | {
|
---|
54 | parent()->setProperty(m_strName.toLatin1().constData(), strValue);
|
---|
55 | }
|
---|
56 |
|
---|
57 | private:
|
---|
58 |
|
---|
59 | /** Holds the property name. */
|
---|
60 | const QString m_strName;
|
---|
61 | };
|
---|
62 |
|
---|
63 |
|
---|
64 | #endif /* !___VBoxUtils_h___ */
|
---|
65 |
|
---|