📄 mainwindow.h
字号:
/************************************************************************ Copyright (C) 2000 Trolltech AS. All rights reserved.**** This file is part of Qt Designer.**** This file may be distributed and/or modified under the terms of the** GNU General Public License version 2 as published by the Free Software** Foundation and appearing in the file LICENSE.GPL included in the** packaging of this file.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.**** See http://www.trolltech.com/gpl/ for GPL licensing information.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.************************************************************************/#ifndef MAINWINDOW_H#define MAINWINDOW_H#include "metadatabase.h"#include "../interfaces/actioninterface.h" // for GCC 2.7.* compatibility#include "../interfaces/editorinterface.h"#include "../interfaces/templatewizardiface.h"#include "../interfaces/languageinterface.h"#include "../interfaces/filterinterface.h"#include "../interfaces/programinterface.h"#include "../interfaces/interpreterinterface.h"#include "../interfaces/preferenceinterface.h"#include "../interfaces/projectsettingsiface.h"#include "../interfaces/sourcetemplateiface.h"#include "sourceeditor.h"#include <qaction.h>#include <qmainwindow.h>#include <qmap.h>#include <qguardedptr.h>#include <private/qpluginmanager_p.h>#include <qobjectlist.h>class QCategoryWidget;class PropertyEditor;class QWorkspace;class QMenuBar;class FormWindow;class QPopupMenu;class HierarchyView;class QCloseEvent;class Workspace;class ActionEditor;class Project;class OutputWindow;class QTimer;class FindDialog;struct DesignerProject;class ReplaceDialog;class GotoLineDialog;class SourceFile;class FormFile;class QAssistantClient;#if defined(Q_FULL_TEMPLATE_INSTANTIATION)#include <qtoolbar.h>#elseclass QToolBar;#endifclass Preferences;class MainWindow : public QMainWindow{ Q_OBJECTpublic: enum LineMode { Error, Step, StackFrame }; MainWindow( bool asClient, bool single = FALSE, const QString &plgDir = "/designer" ); ~MainWindow(); HierarchyView *objectHierarchy() const; Workspace *workspace() const; PropertyEditor *propertyeditor() const; ActionEditor *actioneditor() const; void resetTool(); int currentTool() const; FormWindow *formWindow(); bool unregisterClient( FormWindow *w ); void editorClosed( SourceEditor *e ); QWidget *isAFormWindowChild( QObject *o ) const; QWidget *isAToolBarChild( QObject *o ) const; void insertFormWindow( FormWindow *fw ); QWorkspace *qWorkspace() const; void popupFormWindowMenu( const QPoint &gp, FormWindow *fw ); void popupWidgetMenu( const QPoint &gp, FormWindow *fw, QWidget *w ); QPopupMenu *setupNormalHierarchyMenu( QWidget *parent ); QPopupMenu *setupTabWidgetHierarchyMenu( QWidget *parent, const char *addSlot, const char *removeSlot ); FormWindow *openFormWindow( const QString &fn, bool validFileName = TRUE, FormFile *ff = 0 ); bool isCustomWidgetUsed( MetaDataBase::CustomWidget *w ); void setGrid( const QPoint &p ); void setShowGrid( bool b ); void setSnapGrid( bool b ); QPoint grid() const { return grd; } bool showGrid() const { return sGrid; } bool snapGrid() const { return snGrid && sGrid; } QString documentationPath() const; static MainWindow *self; QString templatePath() const { return templPath; } void editFunction( const QString &func, const QString &l = QString::null, bool rereadSource = FALSE ); bool isPreviewing() const { return previewing; } Project *currProject() const { return currentProject; } FormWindow *activeForm() const { return lastActiveFormWindow; } TemplateWizardInterface* templateWizardInterface( const QString& className ); QStringList sourceTemplates() const; SourceTemplateInterface* sourceTemplateInterface( const QString& templ ); QUnknownInterface* designerInterface() const { return desInterface; } QPtrList<DesignerProject> projectList() const; QStringList projectNames() const; QStringList projectFileNames() const; Project *findProject( const QString &projectName ) const; void setCurrentProject( Project *pro ); void setCurrentProjectByFilename( const QString& proFilename ); OutputWindow *outputWindow() const { return oWindow; } void addPreferencesTab( QWidget *tab, const QString &title, QObject *receiver, const char *init_slot, const char *accept_slot ); void addProjectTab( QWidget *tab, const QString &title, QObject *receiver, const char *init_slot, const char *accept_slot ); void setModified( bool b, QWidget *window ); void functionsChanged(); void updateFunctionList(); void updateWorkspace(); void runProjectPrecondition(); void runProjectPostcondition( QObjectList *l ); void formNameChanged( FormWindow *fw ); int currentLayoutDefaultSpacing() const; int currentLayoutDefaultMargin() const; void saveAllBreakPoints(); void resetBreakPoints(); SourceFile *sourceFile(); void createNewProject( const QString &lang ); void popupProjectMenu( const QPoint &pos ); QObject *findRealObject( QObject *o ); void setSingleProject( Project *pro ); bool singleProjectMode() const { return singleProject; } void showSourceLine( QObject *o, int line, LineMode lm ); void shuttingDown(); void showGUIStuff( bool b ); void setEditorsReadOnly( bool b ); bool areEditorsReadOnly() const { return editorsReadOnly; } void toggleSignalHandlers( bool show ); bool showSignalHandlers() const { return sSignalHandlers; } void writeConfig(); void openProject( const QString &fn ); void setPluginDirectory( const QString &pd ); QString pluginDirectory() const { return pluginDir; } QAssistantClient* assistantClient() const { return assistant; }public slots: void showProperties( QObject *w ); void updateProperties( QObject *w ); void showDialogHelp(); void showDebugStep( QObject *o, int line ); void showStackFrame( QObject *o, int line ); void showErrorMessage( QObject *o, int line, const QString &errorMessage ); void finishedRun(); void breakPointsChanged();signals: void currentToolChanged(); void hasActiveForm( bool ); void hasActiveWindow( bool ); void hasActiveWindowOrProject( bool ); void hasNonDummyProject( bool ); void formModified( bool ); void formWindowsChanged(); void formWindowChanged(); void projectChanged(); void editorChanged();protected: bool eventFilter( QObject *o, QEvent *e ); void closeEvent( QCloseEvent *e );public slots: void fileNew(); void fileNewDialog(); void fileNewFile(); void fileClose(); void fileQuit(); void fileCloseProject(); // not visible in menu, called from fileClose void fileOpen(); void fileOpen( const QString &filter, const QString &extension, const QString &filename = "" , bool inProject = TRUE ); bool fileSave(); bool fileSaveForm(); // not visible in menu, called from fileSave bool fileSaveProject(); // not visible in menu, called from fileSaveProject bool fileSaveAs(); void fileSaveAll(); void fileCreateTemplate();public slots: void editUndo(); void editRedo(); void editCut(); void editCopy(); void editPaste(); void editDelete(); void editSelectAll(); void editLower(); void editRaise(); void editAdjustSize(); void editLayoutHorizontal(); void editLayoutVertical(); void editLayoutHorizontalSplit(); void editLayoutVerticalSplit(); void editLayoutGrid(); void editLayoutContainerHorizontal(); void editLayoutContainerVertical();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -