Isis 3 Programmer Reference
PaletteWindow.cpp
1#include "PaletteWindow.h"
2
3#include "IString.h"
4
5namespace Isis {
14 parent->installEventFilter(this);
15 p_appName = parent->windowTitle();
16 }
17
18
25 void PaletteWindow::closeEvent(QCloseEvent *event) {
27 }
28
29
36 void PaletteWindow::hideEvent(QHideEvent *event) {
38 }
39
40
47 QString instanceName = this->windowTitle();
48 FileName config("$HOME/.Isis/" + p_appName + "/" + instanceName + ".config");
49 QSettings settings(config.expanded(), QSettings::NativeFormat);
50 QPoint pos = settings.value("pos", QPoint(300, 100)).toPoint();
51 QSize size = settings.value("size", QSize(900, 500)).toSize();
52 resize(size);
53 move(pos);
54 }
55
56
64 /*We do not want to write the settings unless the window is
65 visible at the time of closing the application*/
66 if(!this->isVisible()) return;
67
68 QString instanceName = this->windowTitle();
69 FileName config("$HOME/.Isis/" + p_appName + "/" + instanceName + ".config");
70 QSettings settings(config.expanded(), QSettings::NativeFormat);
71 settings.setValue("pos", pos());
72 settings.setValue("size", size());
73 }
74
75
87 bool PaletteWindow::eventFilter(QObject *o, QEvent *e) {
88 switch(e->type()) {
89 case QEvent::Close: {
91 }
92
93 default: {
94 return false;
95 }
96 }
97 }
98
99}
100
File name manipulation and expansion.
Definition FileName.h:100
QString p_appName
Application name.
void hideEvent(QHideEvent *event)
This method ensure that the settings get written even if the Palette window was only hidden,...
PaletteWindow(QWidget *parent=0)
PaletteWindow constructor.
void closeEvent(QCloseEvent *event)
This method is overridden so that we can be sure to write the current settings of the Palette window.
void writeSettings()
This method is called when the Palette window is closed or hidden to write the size and location sett...
void readSettings()
This method is called from the constructor so that when the Palette window is created,...
bool eventFilter(QObject *o, QEvent *e)
This event filter is installed on the parent of this window.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16