TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicwidgetutils.h
Go to the documentation of this file.
1 #ifndef MUSICWIDGETUTILS_H
2 #define MUSICWIDGETUTILS_H
3 
4 /***************************************************************************
5  * This file is part of the TTK Music Player project
6  * Copyright (C) 2015 - 2024 Greedysky Studio
7 
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17 
18  * You should have received a copy of the GNU General Public License along
19  * with this program; If not, see <http://www.gnu.org/licenses/>.
20  ***************************************************************************/
21 
22 #include <QPainter>
23 #include "musicuiobject.h"
24 #include "musicglobaldefine.h"
25 
26 class QMenu;
27 class QComboBox;
28 
32 namespace TTK
33 {
34  namespace Widget
35  {
39  TTK_MODULE_EXPORT void setFontSize(QWidget *widget, int size);
43  TTK_MODULE_EXPORT void setFontStyle(QWidget *widget, TTK::FontStyleMode type);
44 
48  TTK_MODULE_EXPORT QString elidedText(const QFont &font, const QString &text, Qt::TextElideMode mode, int width);
52  TTK_MODULE_EXPORT QString elidedTitleText(const QFont &font, const QString &text, int width);
53 
57  TTK_MODULE_EXPORT int fontTextWidth(const QFont &font, const QString &text);
61  TTK_MODULE_EXPORT int fontTextHeight(const QFont &font);
62 
66  TTK_MODULE_EXPORT void adjustMenuPosition(QMenu *menu);
70  TTK_MODULE_EXPORT void adjustWidgetPosition(QWidget *widget);
71 
75  TTK_MODULE_EXPORT void setTransparent(QWidget *widget, int alpha);
79  TTK_MODULE_EXPORT void setTransparent(QWidget *widget, const QColor &color);
80 
84  TTK_MODULE_EXPORT void setComboBoxText(QComboBox *widget, const QString &text);
88  TTK_MODULE_EXPORT void widgetToRound(QWidget *widget, int ratioX, int ratioY);
89 
93  TTK_MODULE_EXPORT void generateComboBoxFormat(QComboBox *widget, const QString &style = {});
97  TTK_MODULE_EXPORT void generateVScrollAreaFormat(QWidget *widget, QWidget *parent, bool background = true);
101  TTK_MODULE_EXPORT void generateHScrollAreaFormat(QWidget *widget, QWidget *parent, bool background = true);
102 
103  }
104 }
105 
106 #endif // MUSICWIDGETUTILS_H
#define TTK_MODULE_EXPORT
TTK_MODULE_EXPORT void generateHScrollAreaFormat(QWidget *widget, QWidget *parent, bool background=true)
voidpf void uLong size
Definition: ioapi.h:136
TTK_MODULE_EXPORT void setComboBoxText(QComboBox *widget, const QString &text)
TTK_MODULE_EXPORT void setFontStyle(QWidget *widget, TTK::FontStyleMode type)
TTK_MODULE_EXPORT void setFontSize(QWidget *widget, int size)
The namespace of the process utils.
Definition: ttkcompat.h:24
FontStyleMode
Definition: musicobject.h:180
TTK_MODULE_EXPORT void setTransparent(QWidget *widget, int alpha)
TTK_MODULE_EXPORT void adjustWidgetPosition(QWidget *widget)
TTK_MODULE_EXPORT QString elidedText(const QFont &font, const QString &text, Qt::TextElideMode mode, int width)
TTK_MODULE_EXPORT void generateComboBoxFormat(QComboBox *widget, const QString &style={})
TTK_MODULE_EXPORT void generateVScrollAreaFormat(QWidget *widget, QWidget *parent, bool background=true)
TTK_MODULE_EXPORT int fontTextWidth(const QFont &font, const QString &text)
TTK_MODULE_EXPORT QString elidedTitleText(const QFont &font, const QString &text, int width)
static unsigned char alpha[symbols+1]
Definition: rsecc.c:50
const char int mode
Definition: ioapi.h:135
TTK_MODULE_EXPORT void widgetToRound(QWidget *widget, int ratioX, int ratioY)
TTK_MODULE_EXPORT int fontTextHeight(const QFont &font)
TTK_MODULE_EXPORT void adjustMenuPosition(QMenu *menu)