diff options
-rw-r--r-- | gui/process-detector-fancy-table.cpp | 13 | ||||
-rw-r--r-- | gui/process-detector-fancy-table.hpp | 14 | ||||
-rw-r--r-- | gui/process_detector.cpp | 1 | ||||
-rw-r--r-- | gui/process_detector.h | 24 | ||||
-rw-r--r-- | gui/process_widget.ui | 2 |
5 files changed, 32 insertions, 22 deletions
diff --git a/gui/process-detector-fancy-table.cpp b/gui/process-detector-fancy-table.cpp new file mode 100644 index 00000000..af3aa830 --- /dev/null +++ b/gui/process-detector-fancy-table.cpp @@ -0,0 +1,13 @@ +#include "process-detector-fancy-table.hpp" + +void FancyTable::resizeEvent(QResizeEvent* e) +{ + QTableView::resizeEvent(e); + int w = width(); + setColumnWidth(2, 32); + w -= 48; + setColumnWidth(0, w / 2); + setColumnWidth(1, w / 2); +} + +FancyTable::FancyTable(QWidget* parent) : QTableWidget(parent) {} diff --git a/gui/process-detector-fancy-table.hpp b/gui/process-detector-fancy-table.hpp new file mode 100644 index 00000000..48ea8006 --- /dev/null +++ b/gui/process-detector-fancy-table.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include <QObject> +#include <QWidget> +#include <QTableWidget> + +class FancyTable final : public QTableWidget +{ + Q_OBJECT +public: + void resizeEvent(QResizeEvent* e) override; +public: + FancyTable(QWidget* parent = nullptr); +}; diff --git a/gui/process_detector.cpp b/gui/process_detector.cpp index 7df8e980..fc4c1c58 100644 --- a/gui/process_detector.cpp +++ b/gui/process_detector.cpp @@ -15,6 +15,7 @@ #include <QString> #include <QHash> #include <QPushButton> +#include <QSettings> void settings::set_game_list(const QString &game_list) { diff --git a/gui/process_detector.h b/gui/process_detector.h index a659c178..9dd0da91 100644 --- a/gui/process_detector.h +++ b/gui/process_detector.h @@ -13,25 +13,9 @@ #include <QTableWidget> #include <QResizeEvent> +#include "ui_process_widget.h" +#include "process-detector-fancy-table.hpp" #include "options/options.hpp" -using namespace options; - -class FancyTable : public QTableWidget -{ - Q_OBJECT -public: - void resizeEvent(QResizeEvent* e) override - { - QTableView::resizeEvent(e); - int w = width(); - setColumnWidth(2, 32); - w -= 48; - setColumnWidth(0, w / 2); - setColumnWidth(1, w / 2); - } -public: - FancyTable(QWidget* parent = nullptr) : QTableWidget(parent) {} -}; struct settings { @@ -42,9 +26,7 @@ struct settings void set_is_enabled(bool enabled); }; -#include "ui_process_widget.h" - -class process_detector : public QWidget +class process_detector final : public QWidget { Q_OBJECT diff --git a/gui/process_widget.ui b/gui/process_widget.ui index 63ad9472..aec0cf36 100644 --- a/gui/process_widget.ui +++ b/gui/process_widget.ui @@ -113,7 +113,7 @@ <customwidget> <class>FancyTable</class> <extends>QTableWidget</extends> - <header>process_detector.h</header> + <header>process-detector-fancy-table.hpp</header> </customwidget> </customwidgets> <resources/> |