QtCanpool 3.3.0
载入中...
搜索中...
未找到
QxApp::QxWorkspaceManager类 参考

The named layouts of one shell. 更多...

#include <qxapp/qxworkspacemanager.h>

类 QxApp::QxWorkspaceManager 继承关系图:

Public 成员函数

 QxWorkspaceManager (QxAppShell *shell, QObject *parent=0)
 
 ~QxWorkspaceManager () override
 
QxAppShell * shell () const
 The shell whose layout this manages; null only for a default-built one.
 
QxCore::QxSettings * settings () const
 The settings object the workspaces are stored in - the one the shell uses, so there is a single configuration file.
 
int count () const
 How many workspaces are stored.
 
QStringList workspaceNames () const
 Their names, in the order they were saved - the order a menu wants.
 
bool contains (const QString &name) const
 Whether a workspace called name is stored.
 
QString currentWorkspace () const
 The workspace applied or saved last, empty when there is none.
 
bool saveWorkspace (const QString &name)
 Stores the dock layout and the visible page under name, which becomes the current workspace.
 
bool applyWorkspace (const QString &name)
 Brings back the layout stored under name: the dock state is restored and the page that was in front comes to the front again.
 
bool removeWorkspace (const QString &name)
 Forgets the workspace called name.
 
bool renameWorkspace (const QString &from, const QString &to)
 Moves everything stored under from to to, keeping its place in the order.
 
void clearWorkspaces ()
 Forgets every workspace.
 
void workspaceSaved (const QString &name)
 A workspace was stored, first time or overwriting.
 
void workspaceApplied (const QString &name)
 A workspace was brought back on screen.
 
void workspaceRemoved (const QString &name)
 A workspace was forgotten - also emitted once per name by clearWorkspaces().
 
void currentWorkspaceChanged (const QString &name)
 The current workspace changed; name is empty when there is none now.
 

详细描述

The named layouts of one shell.

QxAppShell already persists a layout - geometry, dock state and the visible page - and restores it on the next start. What it cannot do is keep more than one: the arrangement you use while writing code and the one you use while reading output are the same slot, and "give me back what I had" has no name to be called by. This class adds the name.

workspaces->saveWorkspace(tr("Writing"));
// ...the user moves the panels around...
workspaces->applyWorkspace(tr("Writing")); // the panels go back
QxWorkspaceManager * workspaceManager() const
The named layouts of this shell, created on first use and owned by it.
The named layouts of one shell.
bool applyWorkspace(const QString &name)
Brings back the layout stored under name: the dock state is restored and the page that was in front c...
QxAppShell * shell() const
The shell whose layout this manages; null only for a default-built one.
bool saveWorkspace(const QString &name)
Stores the dock layout and the visible page under name, which becomes the current workspace.

A workspace is the dock layout plus the page that was in front - the two things that make an arrangement what it is. It deliberately does not carry the window geometry: geometry belongs to the window, and moving or resizing it because a panel arrangement was picked is a surprise on a maximized or multi-monitor window. Geometry stays with QxAppShell::saveLayout(), which is the one unnamed workspace every application gets for free.

The names live in the settings object the shell already uses, so workspaces outlive the process and are shared by every shell reading the same file. Nothing is applied on start-up: whether to restore a workspace, and which one, is the application's call - currentWorkspace() is remembered so it can ask.

在文件 qxworkspacemanager.h 第 51 行定义.

构造及析构函数说明

◆ QxWorkspaceManager()

QxApp::QxWorkspaceManager::QxWorkspaceManager ( QxAppShell *  shell,
QObject *  parent = 0 
)
explicit

在文件 qxworkspacemanager.cpp 第 120 行定义.

◆ ~QxWorkspaceManager()

QxApp::QxWorkspaceManager::~QxWorkspaceManager ( )
override

在文件 qxworkspacemanager.cpp 第 128 行定义.

成员函数说明

◆ applyWorkspace()

bool QxApp::QxWorkspaceManager::applyWorkspace ( const QString &  name)

Brings back the layout stored under name: the dock state is restored and the page that was in front comes to the front again.

Returns false when there is no workspace called name, when nothing was ever stored under it, or when the stored state no longer applies - the usual reason being that a dock of the arrangement no longer exists.

在文件 qxworkspacemanager.cpp 第 207 行定义.

◆ clearWorkspaces()

void QxApp::QxWorkspaceManager::clearWorkspaces ( )

Forgets every workspace.

The rest of the settings file is untouched.

在文件 qxworkspacemanager.cpp 第 339 行定义.

◆ contains()

bool QxApp::QxWorkspaceManager::contains ( const QString &  name) const

Whether a workspace called name is stored.

The name is trimmed.

在文件 qxworkspacemanager.cpp 第 157 行定义.

◆ count()

int QxApp::QxWorkspaceManager::count ( ) const

How many workspaces are stored.

在文件 qxworkspacemanager.cpp 第 145 行定义.

◆ currentWorkspace()

QString QxApp::QxWorkspaceManager::currentWorkspace ( ) const

The workspace applied or saved last, empty when there is none.

It is read from the settings file rather than kept in memory, so two shells reading the same file agree on it.

在文件 qxworkspacemanager.cpp 第 163 行定义.

◆ currentWorkspaceChanged()

void QxApp::QxWorkspaceManager::currentWorkspaceChanged ( const QString &  name)

The current workspace changed; name is empty when there is none now.

◆ removeWorkspace()

bool QxApp::QxWorkspaceManager::removeWorkspace ( const QString &  name)

Forgets the workspace called name.

Removing the current one leaves no current workspace behind.

Returns false when there is no such workspace.

在文件 qxworkspacemanager.cpp 第 249 行定义.

◆ renameWorkspace()

bool QxApp::QxWorkspaceManager::renameWorkspace ( const QString &  from,
const QString &  to 
)

Moves everything stored under from to to, keeping its place in the order.

Refuses to overwrite an existing workspace, and reports a rename of a name onto itself as the no-op it is.

在文件 qxworkspacemanager.cpp 第 278 行定义.

◆ saveWorkspace()

bool QxApp::QxWorkspaceManager::saveWorkspace ( const QString &  name)

Stores the dock layout and the visible page under name, which becomes the current workspace.

Saving under a name that exists overwrites it.

Returns false for an empty name or without a shell.

在文件 qxworkspacemanager.cpp 第 169 行定义.

◆ settings()

QxCore::QxSettings * QxApp::QxWorkspaceManager::settings ( ) const

The settings object the workspaces are stored in - the one the shell uses, so there is a single configuration file.

Null without a shell.

在文件 qxworkspacemanager.cpp 第 139 行定义.

◆ shell()

QxAppShell * QxApp::QxWorkspaceManager::shell ( ) const

The shell whose layout this manages; null only for a default-built one.

在文件 qxworkspacemanager.cpp 第 133 行定义.

◆ workspaceApplied()

void QxApp::QxWorkspaceManager::workspaceApplied ( const QString &  name)

A workspace was brought back on screen.

◆ workspaceNames()

QStringList QxApp::QxWorkspaceManager::workspaceNames ( ) const

Their names, in the order they were saved - the order a menu wants.

在文件 qxworkspacemanager.cpp 第 151 行定义.

◆ workspaceRemoved()

void QxApp::QxWorkspaceManager::workspaceRemoved ( const QString &  name)

A workspace was forgotten - also emitted once per name by clearWorkspaces().

◆ workspaceSaved()

void QxApp::QxWorkspaceManager::workspaceSaved ( const QString &  name)

A workspace was stored, first time or overwriting.


该类的文档由以下文件生成: