Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
kdwidget_helper.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of KDWinutils, KDAB's MFC to Qt migration tool.
4**
5** Copyright (C) 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6** All rights reserved.
7**
8** This file is intended solely for use by the migration tools and services
9** provided by Klarälvdalens Datakonsult AB.
10**
11** Any other use or distribution of this software that is not otherwise agreed
12** upon in writing and signed by an authorized representative of Klarälvdalens
13** Datakonsult AB, KDAB (USA) LLC, KDAB (Deutschland) GmbH & Co. K.G.,
14** KDAB (France) SAS, KDAB (UK), Ltd., or any future subsidiary of Klarälvdalens
15** Datakonsult AB is hereby prohibited.
16**
17** Contact info@kdab.com if any conditions stated above are unclear to you.
18**
19****************************************************************************/
20
21#pragma once
22
24
25#include <QList>
26#include <QRect>
27
28#ifdef KDWINUTILS_WITHMFC
29#include <windows.h>
30#endif
31
32class QAction;
33class QMenu;
34class QWidget;
35
37
38namespace Utils {
39
41KDWINUTILS_EXPORT void centerWindow(QWidget *dialogWidget, const QRect &parentRect);
42
44KDWINUTILS_EXPORT float scaleFactor(QWidget *widget);
45
47#ifdef KDWINUTILS_WITHMFC
48KDWINUTILS_EXPORT HWND nativeHandle(QWidget *_widget);
49#endif
50
55KDWINUTILS_EXPORT QAction *findCommand(const QList<QAction *> &actionList, int id);
56
61KDWINUTILS_EXPORT QAction *findCommand(const QList<QAction *> &actionList, const QString &menuText);
62
67KDWINUTILS_EXPORT bool setCommandChecked(const QList<QAction *> &actionList, int id, bool checked);
68
73KDWINUTILS_EXPORT bool setCommandEnabled(const QList<QAction *> &actionList, int id, bool enable);
74
75} // namespace Utils
76
#define KDWINUTILS_EXPORT
Definition kdwinutils_export.h:31
#define KDWINUTILS_BEGIN_NAMESPACE
Definition kdwinutils_global.h:27
#define KDWINUTILS_END_NAMESPACE
Definition kdwinutils_global.h:28
Definition kdwincore_utils.h:34
bool setCommandEnabled(const QList< QAction * > &actionList, int id, bool enable)
Enables the command with the specified ID from a list of commands.
void centerWindow(QWidget *dialogWidget, const QRect &parentRect)
Centers the dialog widget in the parentRect.
bool setCommandChecked(const QList< QAction * > &actionList, int id, bool checked)
Checks the command with the specified ID from a list of commands.
QAction * findCommand(const QList< QAction * > &actionList, int id)
Finds a command with the specified ID from a list of commands.
float scaleFactor(QWidget *widget)
Returns the scale factor of the widget.
HWND nativeHandle(QWidget *_widget)
Returns the native handle of the widget.