Add tMessageBox class

This commit is contained in:
Victor 2019-03-01 12:14:55 +11:00
parent b910575d7f
commit 8a4640a85f
3 changed files with 46 additions and 2 deletions

View file

@ -33,7 +33,8 @@ SOURCES += tvariantanimation.cpp \
tapplication.cpp \
tshortcuthud.cpp \
tstackedwidget.cpp \
tpopover.cpp
tpopover.cpp \
tmessagebox.cpp
HEADERS += tvariantanimation.h\
the-libs_global.h \
@ -46,7 +47,8 @@ HEADERS += tvariantanimation.h\
tpromise.h \
tshortcuthud.h \
tstackedwidget.h \
tpopover.h
tpopover.h \
tmessagebox.h
TRANSLATIONS += \
translations/au_AU.ts \

22
lib/tmessagebox.cpp Normal file
View file

@ -0,0 +1,22 @@
#include "tmessagebox.h"
tMessageBox::tMessageBox(QWidget *parent) : QMessageBox(parent)
{
}
void tMessageBox::setWindowTitle(QString windowTitle) {
#ifdef Q_OS_MAC
QMessageBox::setText(windowTitle);
#else
QMessageBox::setWindowTitle(windowTitle);
#endif
}
void tMessageBox::setText(QString text) {
#ifdef Q_OS_MAC
QMessageBox::setInformativeText(text);
#else
QMessageBox::setText(text);
#endif
}

20
lib/tmessagebox.h Normal file
View file

@ -0,0 +1,20 @@
#ifndef TMESSAGEBOX_H
#define TMESSAGEBOX_H
#include "the-libs_global.h"
#include <QMessageBox>
class THELIBSSHARED_EXPORT tMessageBox : public QMessageBox
{
Q_OBJECT
public:
explicit tMessageBox(QWidget *parent = nullptr);
signals:
public slots:
void setWindowTitle(QString windowTitle);
void setText(QString text);
};
#endif // TMESSAGEBOX_H