mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Create Overlay Widgets with Qt::Tool flag on Linux
Michael Dagenais found this change makes the widgets to play nicer with
Windows Managers and avoids them to get on top of other programs windows.
Minimize and Restore is automatically handled now, so this commit partially
reverts b89019264e, removing MainWindow
state changes tracking, but keeping VideoWindow position tracking.
This commit is contained in:
@@ -1027,17 +1027,6 @@ MainWindow::closeEvent(QCloseEvent* event)
|
||||
appsettings->setValue(GC_SETTINGS_MAIN_STATE, saveState());
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() != QEvent::WindowStateChange) return;
|
||||
|
||||
// Some overlay Widgets (Meter) are top level windows
|
||||
// and need to follow the MainWindow state
|
||||
Qt::WindowStates states = windowState();
|
||||
emit mainWindowStateChanged(states & Qt::WindowMinimized, isVisible());
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
// aside from the tabs, we may need to clean
|
||||
|
||||
@@ -94,9 +94,6 @@ class MainWindow : public QMainWindow
|
||||
// currently selected tab
|
||||
Tab *athleteTab() { return currentTab; }
|
||||
|
||||
signals:
|
||||
void mainWindowStateChanged(bool minimized, bool visible);
|
||||
|
||||
protected:
|
||||
|
||||
// used by ChooseCyclistDialog to see which athletes
|
||||
@@ -107,7 +104,6 @@ class MainWindow : public QMainWindow
|
||||
virtual void resizeEvent(QResizeEvent*);
|
||||
virtual void moveEvent(QMoveEvent*);
|
||||
virtual void closeEvent(QCloseEvent*);
|
||||
virtual void changeEvent(QEvent *);
|
||||
virtual void dragEnterEvent(QDragEnterEvent *);
|
||||
virtual void dropEvent(QDropEvent *);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ MeterWidget::MeterWidget(QString Name, QWidget *parent, QString Source) : QWidge
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
|
||||
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
#else
|
||||
setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
|
||||
|
||||
@@ -140,7 +140,6 @@ VideoWindow::VideoWindow(Context *context) :
|
||||
connect(context, SIGNAL(seek(long)), this, SLOT(seekPlayback(long)));
|
||||
connect(context, SIGNAL(unpause()), this, SLOT(resumePlayback()));
|
||||
connect(context, SIGNAL(mediaSelected(QString)), this, SLOT(mediaSelected(QString)));
|
||||
connect(this->window(), SIGNAL(mainWindowStateChanged(bool, bool)), this, SLOT(mainWindowStateChanged(bool, bool)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,12 +176,6 @@ void VideoWindow::resizeEvent(QResizeEvent * )
|
||||
prevPosition = mapToGlobal(pos());
|
||||
}
|
||||
|
||||
void VideoWindow::mainWindowStateChanged(bool minimized, bool visible)
|
||||
{
|
||||
if(minimized) foreach(MeterWidget* p, m_metersWidget) p->hide();
|
||||
else if(visible && isVisible()) foreach(MeterWidget* p, m_metersWidget) p->show();
|
||||
}
|
||||
|
||||
void VideoWindow::startPlayback()
|
||||
{
|
||||
if (context->currentVideoSyncFile()) {
|
||||
|
||||
@@ -158,7 +158,6 @@ class VideoWindow : public GcChartWindow
|
||||
void telemetryUpdate(RealtimeData rtd);
|
||||
void seekPlayback(long ms);
|
||||
void mediaSelected(QString filename);
|
||||
void mainWindowStateChanged(bool minimized, bool visible);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user