Files
qt-creator/src/libs/utils/fancymainwindow.h

72 lines
1.9 KiB
C
Raw Normal View History

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "utils_global.h"
#include <QMainWindow>
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
namespace Utils {
struct FancyMainWindowPrivate;
2010-03-17 17:44:46 +01:00
class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit FancyMainWindow(QWidget *parent = nullptr);
~FancyMainWindow() override;
/* The widget passed in should have an objectname set
* which will then be used as key for QSettings. */
QDockWidget *addDockForWidget(QWidget *widget, bool immutable = false);
const QList<QDockWidget *> dockWidgets() const;
void setTrackingEnabled(bool enabled);
void saveSettings(QSettings *settings) const;
void restoreSettings(const QSettings *settings);
QHash<QString, QVariant> saveSettings() const;
void restoreSettings(const QHash<QString, QVariant> &settings);
// Additional context menu actions
QAction *menuSeparator1() const;
QAction *autoHideTitleBarsAction() const;
QAction *menuSeparator2() const;
QAction *resetLayoutAction() const;
QAction *showCentralWidgetAction() const;
void addDockActionsToMenu(QMenu *menu);
bool autoHideTitleBars() const;
Debugger: Re-organize dock widget persisting Looks like the mainwindow cannot be convinced to handle multiple sets of dockwidgets. So switch back to a single set containing everything and keep track of non-default visibility in the perspectives, and persist these sets. The following pass: 1. Start Creator with new settings Goto Debug Mode Move Break dock widget to right, switch on Global log widget Leave Creator Start Creator Goto Debug Mode Check: Debugger Selected, Break on right, Global log visible 2. Start Creator with new settings Goto Debug Mode Move Break dock widget to right, switch on Global log widget Switch to QmlProfiler sub-perspective Leave Creator Start Creator Goto Debug Mode Check QmlProfiler selected Switch to Debugger sub-perspective Check: Debugger Selected, Break on right, Global log visible 3. Start Creator with new settings Use any C++ test project Start debugging / stop at main() (F10) Wait for stop Switch to Edit mode Switch back to Debug mode Check: Only "running" debugger dock widget layout present (not the normal + preset at the same time) Quit Qt Creator while this debugger is running Check: Shuts down without crash 4. Use any C++ test project Start debugging Switch to Debugger Preset perspective Start a second debugger Kill either instance Check: Application dies, Debugger Preset perspective gets displayed Switch to perspective of second instance Check: Perspective looks ok (docks visible as before) Task-number: QTCREATORBUG-21083 Task-number: QTCREATORBUG-21669 Task-number: QTCREATORBUG-21668 Task-number: QTCREATORBUG-21813 Task-number: QTCREATORBUG-21851 Task-number: QTCREATORBUG-22110 Task-number: QTCREATORBUG-22169 Task-number: QTCREATORBUG-22189 Change-Id: Ic9eb41ff7699ac0f48a85e68376daa80b2b6847e Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-03-22 07:35:48 +01:00
void setAutoHideTitleBars(bool on);
bool isCentralWidgetShown() const;
void showCentralWidget(bool on);
signals:
// Emitted by resetLayoutAction(). Connect to a slot
// restoring the default layout.
void resetLayout();
public slots:
void setDockActionsVisible(bool v);
protected:
void hideEvent(QHideEvent *event) override;
void showEvent(QShowEvent *event) override;
void contextMenuEvent(QContextMenuEvent *event) override;
private:
void handleVisibilityChanged(bool visible);
2010-03-17 17:44:46 +01:00
FancyMainWindowPrivate *d;
};
} // namespace Utils