#include <sourceeditor.h>
Signals | |
void | updateMainWindow (void) |
Emitted every time the owner of this widget needs to update. | |
void | shaderChangedCompletely (void) |
Indicates that the used opened an existing or created a new shader. | |
Public Member Functions | |
CSourceEdit (int shaderType) | |
Constructs a CSourceEdit object. | |
void | loadInitialShaderSource (void) |
Load the initial source code for the assigned shader type. | |
int | shaderType (void) const |
Returns the shader type assigned to this source editor. | |
void | newFile (void) |
Clears the content to an empty string. | |
void | open (void) |
Asks the user to open a file. | |
bool | save (void) |
Saves the currently opened file. | |
bool | saveAs (void) |
Asks the user for a file name and saves the content in that file. | |
bool | maybeSave (void) |
Asks the user to save changes, if necessary. | |
QString | fileName (void) const |
Returns the filename of the currently opened file. | |
void | loadFile (const QString &fileName) |
Tells the widget to directly load a named file. |
It is simply an improved QTextEdit with some additional functionality like open/save/new file operations and syntax highlighting. This widget known about the shader type it is editing. This allows automatic selection of filename filters in dialogs. The shader type must be set during object construction.
CSourceEdit::CSourceEdit | ( | int | shaderType | ) |
Constructs a CSourceEdit object.
A shader type must be specified that controls some aspects of the editor, like filters in open/save dialogs.
shaderType | Shader type from IShader. |
void CSourceEdit::loadInitialShaderSource | ( | void | ) |
Load the initial source code for the assigned shader type.
The source code loaded is based on the shaderType argument passed to the constructor.
void CSourceEdit::newFile | ( | void | ) |
Clears the content to an empty string.
Pops up a 'save changes' dialog if necessary.
void CSourceEdit::open | ( | void | ) |
Asks the user to open a file.
Pops up a 'save changes' dialog if necessary.
bool CSourceEdit::save | ( | void | ) |
Saves the currently opened file.
If no filename is stored, the uses is asked for a file name.
bool CSourceEdit::maybeSave | ( | void | ) |
Asks the user to save changes, if necessary.
QString CSourceEdit::fileName | ( | void | ) | const |
Returns the filename of the currently opened file.
An empty string indicates that no file name is assigned to the current content.
void CSourceEdit::loadFile | ( | const QString & | fileName | ) |
Tells the widget to directly load a named file.
fileName | Name of the file to load. |
void CSourceEdit::updateMainWindow | ( | void | ) | [signal] |
Emitted every time the owner of this widget needs to update.
For example, this happens when the documents modified flag changed.
void CSourceEdit::shaderChangedCompletely | ( | void | ) | [signal] |
Indicates that the used opened an existing or created a new shader.
It is emitted every time a document was successfully loaded from disk.