2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-08-06 16:01:51 +02:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2009-08-06 16:01:51 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-08-06 16:01:51 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:58:39 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-08-06 16:01:51 +02:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
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
|