19 #ifndef WIDGET_STATE_SAVER_HH_
20 #define WIDGET_STATE_SAVER_HH_
31 #include <QMainWindow>
34 namespace ost{
namespace gui{
46 template<
class BASE,
typename T1=unused,
typename T2=unused,
typename T3=unused>
51 BASE(parent,t1,t2,t3),
61 WidgetStateSaver(
const QString& name,QPoint pos, QSize size, QWidget * parent ,T1 t1, T2 t2,T3 t3):
62 BASE(parent,t1,t2,t3),
83 settings.beginGroup(
name_);
85 BASE::move(settings.value(
"pos").toPoint());
86 BASE::resize(settings.value(
"size").toSize());
88 if(
dynamic_cast<QMainWindow*
>(
this)){
89 dynamic_cast<QMainWindow*
>(
this)->restoreState(settings.value(
"state").toByteArray());
102 settings.beginGroup(
name_);
103 settings.setValue(
"pos", BASE::pos());
104 settings.setValue(
"size", BASE::size());
106 if(
dynamic_cast<QMainWindow*
>(
this)){
107 settings.setValue(
"state",
dynamic_cast<QMainWindow*
>(
this)->saveState());
118 template<
class BASE,
typename T1,
typename T2>
134 QWidget * parent ,T1 t1, T2 t2):
156 settings.beginGroup(
name_);
158 BASE::move(settings.value(
"pos").toPoint());
159 BASE::resize(settings.value(
"size").toSize());
161 if(
dynamic_cast<QMainWindow*
>(
this)){
162 dynamic_cast<QMainWindow*
>(
this)->restoreState(settings.value(
"state").toByteArray());
175 settings.beginGroup(
name_);
176 settings.setValue(
"pos", BASE::pos());
177 settings.setValue(
"size", BASE::size());
179 if(
dynamic_cast<QMainWindow*
>(
this)){
180 settings.setValue(
"state",
dynamic_cast<QMainWindow*
>(
this)->saveState());
190 template<
class BASE,
typename T1>
206 QWidget * parent ,T1 t1):
228 settings.beginGroup(
name_);
230 BASE::move(settings.value(
"pos").toPoint());
231 BASE::resize(settings.value(
"size").toSize());
233 if(
dynamic_cast<QMainWindow*
>(
this)){
234 dynamic_cast<QMainWindow*
>(
this)->restoreState(settings.value(
"state").toByteArray());
247 settings.beginGroup(
name_);
248 settings.setValue(
"pos", BASE::pos());
249 settings.setValue(
"size", BASE::size());
251 if(
dynamic_cast<QMainWindow*
>(
this)){
252 settings.setValue(
"state",
dynamic_cast<QMainWindow*
>(
this)->saveState());
300 settings.beginGroup(
name_);
302 BASE::move(settings.value(
"pos").toPoint());
303 BASE::resize(settings.value(
"size").toSize());
305 if(
dynamic_cast<QMainWindow*
>(
this)){
306 dynamic_cast<QMainWindow*
>(
this)->restoreState(settings.value(
"state").toByteArray());
319 settings.beginGroup(
name_);
320 settings.setValue(
"pos", BASE::pos());
321 settings.setValue(
"size", BASE::size());
323 if(
dynamic_cast<QMainWindow*
>(
this)){
324 settings.setValue(
"state",
dynamic_cast<QMainWindow*
>(
this)->saveState());
#define DLLEXPORT_OST_GUI