From 046503ba7830427fcd055da569326f0ac814b979 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 5 Apr 2013 21:23:45 +0200 Subject: New Class: SmTreeView Code reusage: all 3 tabs had the same funtions: readHeaderConfig, writeHeaderConfig and toggleHeader, so turn it into a class derived from QTreeView. Unfortunately mATree didn't do things as later added Views, so it took some time to find the culprit in SheMov::readSettings :( Hopefully I didn't break too much... --- smtreeview.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 smtreeview.h (limited to 'smtreeview.h') diff --git a/smtreeview.h b/smtreeview.h new file mode 100644 index 0000000..eff41d5 --- /dev/null +++ b/smtreeview.h @@ -0,0 +1,32 @@ +/* + This program 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 + 2 of the License, or (at your option) any later version. +*/ + +#ifndef SMTREEVIEW_H +#define SMTREEVIEW_H + +#include + +class QActionGroup; + +class SmTreeView : public QTreeView { + Q_OBJECT + public: + SmTreeView(QWidget *parent = 0) : QTreeView(parent) {} + SmTreeView(const QString &hSetting, QWidget *parent = 0); + virtual void setHeaderGroup(QActionGroup *ag) { mHeaderGroup = ag; } + + public slots: + void readHeaderConfig(); + void writeHeaderConfig(); + void toggleHeader(QObject *action); + + private: + const QString mHeaderSetting; + QActionGroup *mHeaderGroup; +}; + +#endif // SMTREEVIEW_H -- cgit v1.2.3-70-g09d2