LMMS
Loading...
Searching...
No Matches
SimpleTextFloat.h
Go to the documentation of this file.
1/*
2 * TextFloat.h - class textFloat, a floating text-label
3 *
4 * Copyright (c) 2023 LMMS team
5*
6* This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (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 GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23*/
24
25#ifndef LMMS_GUI_SIMPLE_TEXT_FLOAT_H
26#define LMMS_GUI_SIMPLE_TEXT_FLOAT_H
27
28#include <QWidget>
29
30#include "lmms_export.h"
31
32class QLabel;
33class QTimer;
34
35namespace lmms::gui
36{
37
38class LMMS_EXPORT SimpleTextFloat : public QWidget
39{
40 Q_OBJECT
41public:
43 ~SimpleTextFloat() override = default;
44
45 void setText(const QString & text);
46
47 void showWithDelay(int msecBeforeDisplay, int msecDisplayTime);
48
49 void showWithTimeout(int msec)
50 {
51 showWithDelay(0, msec);
52 }
53
54 void moveGlobal(QWidget * w, const QPoint & offset)
55 {
56 move(w->mapToGlobal(QPoint(0, 0)) + offset);
57 }
58
59 void show();
60 void hide();
61
63 const QObject* source() const { return m_source; }
64
66 void setSource(const QObject* source) { m_source = source; }
67
68private:
69 QLabel * m_textLabel;
70 QTimer * m_showTimer;
71 QTimer * m_hideTimer;
72
74 const QObject* m_source = nullptr;
75};
76
77} // namespace lmms::gui
78
79#endif // LMMS_GUI_SIMPLE_TEXT_FLOAT_H
void setText(const QString &text)
Definition SimpleTextFloat.cpp:57
QTimer * m_hideTimer
Definition SimpleTextFloat.h:71
void setSource(const QObject *source)
Sets which object is currently controlling this text float.
Definition SimpleTextFloat.h:66
const QObject * source() const
Definition SimpleTextFloat.h:63
~SimpleTextFloat() override=default
SimpleTextFloat()
Definition SimpleTextFloat.cpp:38
const QObject * m_source
Which object is currently controlling this text float.
Definition SimpleTextFloat.h:74
void showWithDelay(int msecBeforeDisplay, int msecDisplayTime)
Definition SimpleTextFloat.cpp:62
void moveGlobal(QWidget *w, const QPoint &offset)
Definition SimpleTextFloat.h:54
void showWithTimeout(int msec)
Definition SimpleTextFloat.h:49
QLabel * m_textLabel
Definition SimpleTextFloat.h:69
QTimer * m_showTimer
Definition SimpleTextFloat.h:70
UINT_D64 w
Definition inflate.c:942
Definition AudioPortAudio.cpp:209
const char * text
Definition swell-functions.h:167