Qt Utilities 6.14.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
desktoputils.h
Go to the documentation of this file.
1#ifndef DESKTOP_UTILS_DESKTOPSERVICES_H
2#define DESKTOP_UTILS_DESKTOPSERVICES_H
3
4#include "../global.h"
5
6#include <QMetaObject>
7#include <QPalette>
8
9#include <functional>
10#include <optional>
11
12QT_FORWARD_DECLARE_CLASS(QObject)
13QT_FORWARD_DECLARE_CLASS(QString)
14
15namespace QtUtilities {
16
17QT_UTILITIES_EXPORT bool openLocalFileOrDir(const QString &path);
18QT_UTILITIES_EXPORT bool isPaletteDark(const QPalette &palette = QPalette());
19QT_UTILITIES_EXPORT std::optional<bool> isDarkModeEnabled();
20QT_UTILITIES_EXPORT QMetaObject::Connection onDarkModeChanged(
21 std::function<void(bool)> &&darkModeChangedCallback, QObject *context = nullptr, bool invokeImmediately = true);
22
23} // namespace QtUtilities
24
25#endif // DESKTOP_UTILS_DESKTOPSERVICES_H
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
Definition global.h:14
QT_UTILITIES_EXPORT QMetaObject::Connection onDarkModeChanged(std::function< void(bool)> &&darkModeChangedCallback, QObject *context=nullptr, bool invokeImmediately=true)
Invokes the specified callback when the color scheme changed.
QT_UTILITIES_EXPORT std::optional< bool > isDarkModeEnabled()
Returns whether dark mode is enabled.
QT_UTILITIES_EXPORT bool isPaletteDark(const QPalette &palette=QPalette())
Returns whether palette is dark.
QT_UTILITIES_EXPORT bool openLocalFileOrDir(const QString &path)
Shows the specified file or directory using the default file browser.