diff options
| -rw-r--r-- | src/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/lcdnumber.cpp | 37 | ||||
| -rw-r--r-- | src/lcdnumber.h | 35 | ||||
| -rw-r--r-- | src/mainwindow.ui | 9 | ||||
| -rw-r--r-- | src/organizer.pro | 6 |
5 files changed, 85 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f004ddc..a084bae0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -92,6 +92,7 @@ SET(organizer_SRCS eventfilter.cpp moshortcut.cpp listdialog.cpp + lcdnumber.cpp shared/windows_error.cpp shared/error_report.cpp @@ -187,6 +188,7 @@ SET(organizer_HDRS descriptionpage.h moshortcut.h listdialog.h + lcdnumber.h shared/windows_error.h shared/error_report.h diff --git a/src/lcdnumber.cpp b/src/lcdnumber.cpp new file mode 100644 index 00000000..3191b434 --- /dev/null +++ b/src/lcdnumber.cpp @@ -0,0 +1,37 @@ +/* +This file is part of Mod Organizer. + +Mod Organizer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Mod Organizer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "lcdnumber.h" + +#include <QToolTip> +#include <QTimer> + +LCDNumber::LCDNumber(QWidget *parent) + : QLCDNumber(parent) +{ +} + +void LCDNumber::mousePressEvent(QMouseEvent *event) +{ + m_toolTipPosition = mapToGlobal(event->pos()); + QTimer::singleShot(100, this, SLOT(showToolTip())); +} + +void LCDNumber::showToolTip() +{ + QToolTip::showText(m_toolTipPosition, toolTip()); +} diff --git a/src/lcdnumber.h b/src/lcdnumber.h new file mode 100644 index 00000000..2f8e0454 --- /dev/null +++ b/src/lcdnumber.h @@ -0,0 +1,35 @@ +/* +This file is part of Mod Organizer. + +Mod Organizer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Mod Organizer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <QLCDNumber> +#include <QMouseEvent> +#include <QWidget> + +class LCDNumber : public QLCDNumber +{ + Q_OBJECT + +public: + LCDNumber(QWidget *parent = nullptr); + void mousePressEvent(QMouseEvent *event); + +public slots: + void showToolTip(); + +private: + QPoint m_toolTipPosition; +}; diff --git a/src/mainwindow.ui b/src/mainwindow.ui index f2b12037..b1ed8e5a 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -303,7 +303,7 @@ p, li { white-space: pre-wrap; } </widget>
</item>
<item>
- <widget class="QLCDNumber" name="activeModsCounter">
+ <widget class="LCDNumber" name="activeModsCounter">
<property name="minimumSize">
<size>
<width>0</width>
@@ -924,7 +924,7 @@ p, li { white-space: pre-wrap; } </widget>
</item>
<item>
- <widget class="QLCDNumber" name="activePluginsCounter">
+ <widget class="LCDNumber" name="activePluginsCounter">
<property name="minimumSize">
<size>
<width>0</width>
@@ -1678,6 +1678,11 @@ Right now this has very limited functionality</string> <extends>QTreeView</extends>
<header>pluginlistview.h</header>
</customwidget>
+ <customwidget>
+ <class>LCDNumber</class>
+ <extends>QLCDNumber</extends>
+ <header>lcdnumber.h</header>
+ </customwidget>
</customwidgets>
<resources>
<include location="resources.qrc"/>
diff --git a/src/organizer.pro b/src/organizer.pro index 582fde9f..df42db40 100644 --- a/src/organizer.pro +++ b/src/organizer.pro @@ -92,7 +92,8 @@ SOURCES += \ modinfobackup.cpp \
modinfooverwrite.cpp \
modinfoforeign.cpp \
- listdialog.cpp
+ listdialog.cpp \
+ lcdnumber.cpp
HEADERS += \
@@ -169,7 +170,8 @@ HEADERS += \ modinfobackup.h \
modinfooverwrite.h \
modinfoforeign.h \
- listdialog.h
+ listdialog.h \
+ lcdnumber.h
FORMS += \
transfersavesdialog.ui \
|
