Commit cc5fc1c2 authored by Robert Lancaster's avatar Robert Lancaster Committed by Jasem Mutlaq
Browse files

More OSX window fixes to stay on top

parent 40ad4565
......@@ -54,7 +54,7 @@ KSWizard::KSWizard( QWidget *parent ) :
QDialog( parent )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
wizardStack = new QStackedWidget( this );
......
......@@ -38,7 +38,7 @@ ThumbnailEditor::ThumbnailEditor( ThumbnailPicker *_tp, double _w, double _h )
: QDialog( _tp ), tp( _tp )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ui = new ThumbnailEditorUI( this );
w = _w;
......
......@@ -48,7 +48,7 @@ ThumbnailPicker::ThumbnailPicker( SkyObject *o, const QPixmap &current, QWidget
: QDialog( parent ), SelectedImageIndex(-1), dd((DetailDialog*)parent), Object(o), bImageFound( false )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
wid = _w;
ht = _h;
......
......@@ -41,7 +41,7 @@ AddCatDialog::AddCatDialog( KStars *_ks )
: QDialog( ( QWidget* )_ks )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
QDir::setCurrent( QDir::homePath() );
acd = new AddCatDialogUI(this);
......
......@@ -34,7 +34,7 @@ AddLinkDialog::AddLinkDialog( QWidget *parent, const QString &oname )
: QDialog( parent ), ObjectName( oname )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ald = new AddLinkDialogUI(this);
......
......@@ -75,7 +75,7 @@ DetailDialog::DetailDialog(SkyObject *o, const KStarsDateTime &ut, GeoLocation *
Data(0), DataComet(0), Pos(0), Links(0), Adv(0), Log(0)
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
setFaceType( Tabbed );
setBackgroundRole( QPalette::Base );
......
......@@ -38,7 +38,7 @@ ExportImageDialog::ExportImageDialog(const QString &url, const QSize &size, Imag
: QDialog((QWidget*) KStars::Instance()), m_KStars(KStars::Instance()), m_Url(url), m_Size(size)
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
m_DialogUI = new ExportImageDialogUI(this);
......
......@@ -61,7 +61,7 @@ FindDialog::FindDialog( QWidget* parent ) :
m_targetObject( 0 )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ui = new FindDialogUI( this );
......
......@@ -36,7 +36,7 @@ FocusDialog::FocusDialog( KStars *_ks )
: QDialog( _ks ), ks( _ks )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
//initialize point to the current focus position
Point = *ks->map()->focus();
......
......@@ -76,7 +76,7 @@ FOVDialog::FOVDialog( QWidget* p ) :
QDialog( p )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
// Register FOV* data type
if( fovID == -1 )
......
......@@ -42,7 +42,7 @@ LocationDialog::LocationDialog( QWidget* parent ) :
QDialog( parent ), timer( 0 )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
KStarsData* data = KStarsData::Instance();
......
......@@ -37,7 +37,7 @@ TimeDialog::TimeDialog( const KStarsDateTime &now, GeoLocation *_geo, QWidget *p
: QDialog( parent ), geo( _geo )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
UTCNow = UTCFrame;
......
......@@ -50,10 +50,14 @@
EkosManager::EkosManager(QWidget *parent) : QDialog(parent)
{
#ifdef Q_OS_OSX
if(Options::independentWindowEkos())
if(Options::independentWindowEkos())
setWindowFlags(Qt::Window);
else
setWindowFlags(Qt::Tool);
else{
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(changeAlwaysOnTop(Qt::ApplicationState)));
}
#endif
setupUi(this);
......@@ -168,6 +172,17 @@ EkosManager::EkosManager(QWidget *parent) : QDialog(parent)
//resize(1000,750);
}
void EkosManager::changeAlwaysOnTop(Qt::ApplicationState state)
{
if(isVisible()){
if (state == Qt::ApplicationActive)
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
else
setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
show();
}
}
EkosManager::~EkosManager()
{
delete captureProcess;
......
......@@ -152,6 +152,8 @@ public slots:
private slots:
void changeAlwaysOnTop(Qt::ApplicationState state);
void updateLog();
void clearLog();
......
......@@ -41,7 +41,7 @@ internalCalibration::internalCalibration(cgmath *mathObject, Ekos::Guide *parent
: QWidget(parent)
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ui.setupUi(this);
......
......@@ -31,7 +31,7 @@ ProfileEditorUI::ProfileEditorUI( QWidget *p ) : QFrame( p )
ProfileEditor::ProfileEditor(QWidget *w ) : QDialog( w )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ui = new ProfileEditorUI( this );
......
......@@ -72,9 +72,11 @@ FITSViewer::FITSViewer (QWidget *parent)
{
#ifdef Q_OS_OSX
if(Options::independentWindowFITS())
setWindowFlags(Qt::Window);
else
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Window);
else{
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(changeAlwaysOnTop(Qt::ApplicationState)));
}
#endif
fitsTab = new QTabWidget(this);
......@@ -266,6 +268,17 @@ FITSViewer::FITSViewer (QWidget *parent)
resize(INITIAL_W, INITIAL_H);
}
void FITSViewer::changeAlwaysOnTop(Qt::ApplicationState state)
{
if(isVisible()){
if (state == Qt::ApplicationActive)
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
else
setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
show();
}
}
FITSViewer::~FITSViewer()
{
fitsTab->disconnect();
......
......@@ -88,7 +88,7 @@ protected:
void showEvent(QShowEvent *);
public slots:
void changeAlwaysOnTop(Qt::ApplicationState state);
void openFile();
void saveFile();
void saveFileAs();
......
......@@ -94,7 +94,7 @@ DriverManager::DriverManager(QWidget *parent)
: QDialog( parent )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
currentPort = Options::serverPortStart().toInt()-1;
......
......@@ -58,9 +58,11 @@ GUIManager::GUIManager(QWidget *parent) : QWidget(parent, Qt::Window)
{
#ifdef Q_OS_OSX
if(Options::independentWindowINDI())
setWindowFlags(Qt::Window);
else
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Window);
else{
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(changeAlwaysOnTop(Qt::ApplicationState)));
}
#endif
mainLayout = new QVBoxLayout(this);
......@@ -92,6 +94,17 @@ GUIManager::GUIManager(QWidget *parent) : QWidget(parent, Qt::Window)
resize( 640, 480);
}
void GUIManager::changeAlwaysOnTop(Qt::ApplicationState state)
{
if(isVisible()){
if (state == Qt::ApplicationActive)
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
else
setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
show();
}
}
void GUIManager::closeEvent(QCloseEvent * /*event*/)
{
KStars *ks = KStars::Instance();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment