NDE-FileMAN
Loading...
Searching...
No Matches
statusbar.h
1/*
2 This program is free software; you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation; either version 2 of the License, or
5 (at your option) any later version.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License along
13 with this program; if not, write to the Free Software Foundation, Inc.,
14 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15*/
16
17#ifndef FM_STATUSBAR_H
18#define FM_STATUSBAR_H
19
20#include <QStatusBar>
21#include <QLabel>
22#include <QTimer>
23
24namespace NDEFileMAN {
25
26class Label : public QLabel {
27Q_OBJECT
28
29public:
30 explicit Label(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
31
32protected:
33 void paintEvent(QPaintEvent *event) override;
34
35private:
36 QString elidedText_;
37 QString lastText_;
38 int lastWidth_;
39};
40
41class StatusBar : public QStatusBar {
42Q_OBJECT
43
44public:
45 explicit StatusBar(QWidget *parent = 0);
46 ~StatusBar();
47
48public Q_SLOTS:
49 void showMessage(const QString &message, int timeout = 0);
50
51protected Q_SLOTS:
52 void reallyShowMessage();
53
54private:
55 Label* statusLabel_; // for a stable (elided) text
56 QTimer* messageTimer_;
57 QString lastMessage_;
58 int lastTimeOut_;
59};
60
61}
62
63#endif // FM_STATUSBAR_H
Definition statusbar.h:26
Definition statusbar.h:41