2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2009-08-06 16:01:51 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2009-08-06 16:01:51 +02:00
|
|
|
|
|
|
|
|
#include "utils_global.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QMainWindow>
|
2009-10-01 16:38:08 +02:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QSettings;
|
|
|
|
|
QT_END_NAMESPACE
|
2009-08-06 16:01:51 +02:00
|
|
|
|
|
|
|
|
namespace Utils {
|
|
|
|
|
|
2014-09-29 17:03:25 +02:00
|
|
|
struct FancyMainWindowPrivate;
|
2010-03-17 17:44:46 +01:00
|
|
|
|
2009-08-06 16:01:51 +02:00
|
|
|
class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2018-05-07 17:33:02 +02:00
|
|
|
explicit FancyMainWindow(QWidget *parent = nullptr);
|
2018-05-07 15:07:21 +02:00
|
|
|
~FancyMainWindow() override;
|
2009-08-06 16:01:51 +02:00
|
|
|
|
2010-04-06 11:23:11 +02:00
|
|
|
/* The widget passed in should have an objectname set
|
|
|
|
|
* which will then be used as key for QSettings. */
|
2016-07-22 15:53:11 +02:00
|
|
|
QDockWidget *addDockForWidget(QWidget *widget, bool immutable = false);
|
2018-09-26 09:35:47 +02:00
|
|
|
const QList<QDockWidget *> dockWidgets() const;
|
2009-08-06 16:01:51 +02:00
|
|
|
|
|
|
|
|
void setTrackingEnabled(bool enabled);
|
|
|
|
|
|
|
|
|
|
void saveSettings(QSettings *settings) const;
|
2010-04-06 11:23:11 +02:00
|
|
|
void restoreSettings(const QSettings *settings);
|
2009-08-10 13:01:10 +02:00
|
|
|
QHash<QString, QVariant> saveSettings() const;
|
|
|
|
|
void restoreSettings(const QHash<QString, QVariant> &settings);
|
2009-08-06 16:01:51 +02:00
|
|
|
|
2010-04-20 16:46:35 +02:00
|
|
|
// Additional context menu actions
|
2014-09-29 17:03:25 +02:00
|
|
|
QAction *menuSeparator1() const;
|
|
|
|
|
QAction *autoHideTitleBarsAction() const;
|
|
|
|
|
QAction *menuSeparator2() const;
|
2010-04-20 16:46:35 +02:00
|
|
|
QAction *resetLayoutAction() const;
|
2016-09-07 18:14:04 +02:00
|
|
|
QAction *showCentralWidgetAction() const;
|
2014-07-15 12:47:15 +02:00
|
|
|
void addDockActionsToMenu(QMenu *menu);
|
2010-04-20 16:46:35 +02:00
|
|
|
|
2014-10-10 12:32:53 +02:00
|
|
|
bool autoHideTitleBars() const;
|
2019-03-22 07:35:48 +01:00
|
|
|
void setAutoHideTitleBars(bool on);
|
|
|
|
|
|
|
|
|
|
bool isCentralWidgetShown() const;
|
|
|
|
|
void showCentralWidget(bool on);
|
2014-08-26 13:40:12 +02:00
|
|
|
|
2010-04-20 16:46:35 +02:00
|
|
|
signals:
|
|
|
|
|
// Emitted by resetLayoutAction(). Connect to a slot
|
|
|
|
|
// restoring the default layout.
|
|
|
|
|
void resetLayout();
|
|
|
|
|
|
2014-09-29 17:03:25 +02:00
|
|
|
public slots:
|
|
|
|
|
void setDockActionsVisible(bool v);
|
|
|
|
|
|
2009-08-06 16:01:51 +02:00
|
|
|
protected:
|
2018-05-07 15:07:21 +02:00
|
|
|
void hideEvent(QHideEvent *event) override;
|
|
|
|
|
void showEvent(QShowEvent *event) override;
|
|
|
|
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
2014-07-14 16:47:51 +02:00
|
|
|
|
2016-06-28 22:31:02 +03:00
|
|
|
private:
|
2009-08-06 16:01:51 +02:00
|
|
|
void handleVisibilityChanged(bool visible);
|
|
|
|
|
|
2010-03-17 17:44:46 +01:00
|
|
|
FancyMainWindowPrivate *d;
|
2009-08-06 16:01:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Utils
|