Files
qt-creator/src/plugins/coreplugin/rightpane.h

75 lines
1.4 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
2008-12-02 15:08:31 +01:00
#pragma once
2008-12-02 12:01:29 +01:00
#include "core_global.h"
#include <utils/id.h>
2008-12-02 15:08:31 +01:00
#include <QWidget>
#include <QPointer>
2009-10-01 17:09:10 +02:00
QT_BEGIN_NAMESPACE
class QSettings;
2009-10-01 17:09:10 +02:00
QT_END_NAMESPACE
2008-12-02 12:01:29 +01:00
namespace Utils {
class QtcSettings;
}
2008-12-02 12:01:29 +01:00
namespace Core {
class RightPaneWidget;
class CORE_EXPORT RightPanePlaceHolder : public QWidget
{
friend class Core::RightPaneWidget;
Q_OBJECT
2008-12-02 12:01:29 +01:00
public:
explicit RightPanePlaceHolder(Utils::Id mode, QWidget *parent = nullptr);
~RightPanePlaceHolder() override;
2008-12-02 12:01:29 +01:00
static RightPanePlaceHolder *current();
2008-12-02 12:01:29 +01:00
private:
void currentModeChanged(Utils::Id mode);
2008-12-02 12:01:29 +01:00
void applyStoredSize(int width);
Utils::Id m_mode;
2008-12-02 12:01:29 +01:00
static RightPanePlaceHolder* m_current;
};
class CORE_EXPORT RightPaneWidget : public QWidget
{
Q_OBJECT
2008-12-02 12:01:29 +01:00
public:
RightPaneWidget();
~RightPaneWidget() override;
2008-12-02 12:01:29 +01:00
void saveSettings(Utils::QtcSettings *settings);
2008-12-02 12:01:29 +01:00
void readSettings(QSettings *settings);
bool isShown() const;
2008-12-02 12:01:29 +01:00
void setShown(bool b);
static RightPaneWidget *instance();
2008-12-02 12:01:29 +01:00
void setWidget(QWidget *widget);
QWidget *widget() const;
int storedWidth() const;
2008-12-02 12:01:29 +01:00
protected:
void resizeEvent(QResizeEvent *) override;
2008-12-02 12:01:29 +01:00
private:
void clearWidget();
bool m_shown = true;
int m_width = 0;
QPointer<QWidget> m_widget;
2008-12-02 12:01:29 +01:00
static RightPaneWidget *m_instance;
};
} // namespace Core