22 #include <QDesktopServices>
23 #include <QFileDialog>
28 #include <QTextDocumentFragment>
29 #include <QTextStream>
30 #include <QToolButton>
31 #include <QVBoxLayout>
37 #include "rapidjson/filereadstream.h"
67 bool PythonSerializer::write_control_file(
const std::filesystem::path& savedir,
const std::vector<PythonEditorControlEntry>& tabinfo)
80 for (
const PythonEditorControlEntry& pece : tabinfo)
83 tabObj[
"tab"] = pece.tabInx;
85 tabObj[
"active"] =
true;
86 if (!pece.restore.empty())
87 tabObj[
"restore"] = pece.restore;
88 tabObj[
"filename"] = pece.filename;
100 : savedir.string()));
103 std::vector<PythonEditorControlEntry> tabinfo;
106 if (!pedit)
return std::string();
109 for (
int tabInx=0; tabInx < tabw->
count(); tabInx++)
114 PythonEditorControlEntry pece;
115 pece.tabInx = tabInx;
128 ? tabPath.
mid(pydirPrefix.
size())
131 tabinfo.push_back(pece);
134 if (!write_control_file(savedir,tabinfo))
145 if (!relname.empty())
146 restoreTabs(loaddir, relname);
149 void PythonSerializer::restoreTabs(
const std::filesystem::path& loaddir,
const std::string& jsonfile)
151 std::filesystem::path jsonpath(loaddir);
152 jsonpath.append(jsonfile);
154 FILE* pytabFile = fopen(jsonpath.string().c_str(),
"rb");
155 if (pytabFile == NULL)
157 log_error(
"GroupingSerializer::deserialize",
"unable to open '{}'.", jsonpath.string());
164 rapidjson::FileReadStream frs(pytabFile, buffer,
sizeof(buffer));
165 rapidjson::Document document;
166 document.ParseStream<0, rapidjson::UTF8<>, rapidjson::FileReadStream>(frs);
168 QDir pyDir(
QString::fromStdString((loaddir / std::filesystem::path(document.HasMember(
"python_dir")?document[
"python_dir"].GetString():std::string(
"py"))).string()));
170 bool restoreAutosave =
false;
173 if (document.HasMember(
"tabs"))
175 for (
const rapidjson::Value& tabVal : document[
"tabs"].GetArray())
177 if (!tabVal.HasMember(
"tab") || !tabVal.HasMember(
"filename"))
continue;
178 int tabInx = tabVal[
"tab"].GetUint();
181 if (tabFilename.
startsWith(
".autosave_tab") && tabVal.HasMember(
"restore"))
186 tabPath = restorePath;
187 restoreAutosave =
true;
189 pedit->tabLoadFile(tabInx, tabPath);
190 if (tabVal.HasMember(
"active"))
196 pedit->getTabWidget()->setCurrentIndex(activeInx);
202 pedit->saveControl();
209 mActionSave(new
Action(this)), mActionSaveAs(new
Action(this)), mActionToggleMinimap(new
Action(this)), mActionNewFile(new
Action(this)),
210 mFileWatcher(nullptr)
235 mActionOpenFile->
setText(
"Open Script");
237 mActionSaveAs->
setText(
"Save as");
238 mActionRun->
setText(
"Execute Script");
239 mActionNewFile->
setText(
"New Script");
240 mActionToggleMinimap->
setText(
"Toggle Minimap");
274 mSettingFontSize =
new SettingsItemSpinbox(
"Font Size",
"python/font_size", 11,
"Python Editor",
"Size of Font measured in pt");
277 mSettingLineNumbers =
new SettingsItemCheckbox(
"Line Numbers",
"python/line_numbers",
true,
"Python Editor",
"Enables line numbers.");
279 mSettingHighlight =
new SettingsItemCheckbox(
"Highlight Current Lines",
"python/highlight_current_line",
true,
"Python Editor",
"The current line in the editor gets highlighted if enabled.");
281 mSettingLineWrap =
new SettingsItemCheckbox(
"Line Wrap",
"python/line_wrap",
false,
"Python Editor",
"Autowraps lines in the editor to prevent horizontal scroll bars.");
283 mSettingMinimap =
new SettingsItemCheckbox(
"Code Minimap",
"python/minimap",
false,
"Python Editor",
"Enable code minimap.");
286 "PyEditor Shortcut 'Open Python File'",
"keybinds/python_open_file",
QKeySequence(
"Ctrl+Shift+O"),
"Keybindings: PyEditor",
"Keybind for opening a python file in the Python Editor.");
289 "PyEditor Shortcut 'Save Python File'",
"keybinds/python_save_file",
QKeySequence(
"Ctrl+Shift+S"),
"Keybindings: PyEditor",
"Keybind for saving a python file in the Python Editor.");
292 "keybinds/python_save_file_as",
294 "Keybindings: PyEditor",
295 "Keybind for saving a python file in the Python Editor 'as ...' in the Python Editor.");
298 "PyEditor Shortcut 'Run Python File'",
"keybinds/python_run_file",
QKeySequence(
"Ctrl+R"),
"Keybindings: PyEditor",
"Keybind for executing a python file in the Python Editor.");
301 "keybinds/python_create_file",
303 "Keybindings: PyEditor",
304 "Keybind for creating a new python file in the Python Editor.");
308 using namespace std::placeholders;
317 netlist_name.
replace(
"/",
"-");
318 netlist_name.
replace(
"\\",
"-");
321 if (document.HasMember(
"PythonEditor"))
323 auto root = document[
"PythonEditor"].GetObject();
325 auto array = root[
"tabs"].GetArray();
326 for (
auto it = array.Begin(); it != array.End(); ++it)
329 if (mTabWidget->
count() < cnt)
333 auto val = it->GetObject();
335 if (val.HasMember(
"path"))
337 QFileInfo original_path(val[
"path"].GetString());
342 if (root.HasMember(
"selected_tab"))
363 removeSnapshotFile(editor);
396 mLastClickTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
401 if (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() - 100 < mLastClickTime)
417 if (mTabWidget->
count() > 0)
434 QAction* entryBasedAction[] = {mActionSave, mActionSaveAs, mActionRun, mActionToggleMinimap,
mSearchAction,
nullptr};
436 iconStyle << mSaveIconStyle << mSaveAsIconStyle << mRunIconStyle << mToggleMinimapIconStyle << mSearchIconStyle;
437 iconPath << mSaveIconPath << mSaveAsIconPath << mRunIconPath << mToggleMinimapIconPath << mSearchIconPath;
439 for (
int iacc = 0; entryBasedAction[iacc]; iacc++)
456 currentEditor->
search(
"");
504 list.
append(shortcutNewFile);
505 list.
append(shortcutOpenFile);
506 list.
append(shortcutSaveFile);
507 list.
append(shortcutSaveFileAs);
531 QString filter =
"Python Scripts(*.py)";
541 for (
auto fileName : file_names)
543 for (
int i = 0; i < mTabWidget->
count(); ++i)
546 if (editor->getAbsFilename() == fileName)
550 if (editor->document()->isModified())
571 QFile pyFile(fileName);
578 while (mTabWidget->
count() <= (
int)index)
587 tab->document()->setModified(
false);
588 tab->setFilename(fileName);
592 mPathEditorMap.insert(fileName, tab);
593 mFileWatcher->
addPath(fileName);
599 QString PythonEditor::getDefaultPath()
const
601 if (!mDefaultPath.
isEmpty())
return mDefaultPath;
616 QString filter =
"Python Scripts(*.py)";
620 bool isUnnamed =
false;
633 if (isAutosave && !currentFilename.
isEmpty())
638 bool changeFileLocation =
false;
645 if (selected_file_name.
isEmpty())
648 if (!selected_file_name.
endsWith(
".py"))
649 selected_file_name.
append(
".py");
651 changeFileLocation =
true;
660 selected_file_name = currentFilename;
662 removeSnapshotFile(currentEditor);
665 std::ofstream out(selected_file_name.
toStdString(), std::ios::out);
668 log_error(
"gui",
"could not open file path '{}' to serialize python script", selected_file_name.
toStdString());
669 QMessageBox::warning(
this,
"Save Script Error",
"Cannot save python script to\n<" + selected_file_name +
">");
673 if (changeFileLocation)
680 removeSnapshotFile(currentEditor);
681 QString snapShotDirectory = getSnapshotDirectory(
true);
682 if (!snapShotDirectory.
isEmpty())
684 QString new_snapshot_path = snapShotDirectory +
"/" + selected_file_name +
".py";
685 if(mTabToSnapshotPath.contains(currentEditor))
687 mTabToSnapshotPath[currentEditor] = new_snapshot_path;
691 mTabToSnapshotPath.insert(currentEditor, new_snapshot_path);
696 bool isFileWatched = mFileWatcher->
files().
contains(currentFilename);
700 mPathEditorMap.remove(currentFilename);
714 mPathEditorMap.insert(selected_file_name, currentEditor);
715 mFileWatcher->
addPath(selected_file_name);
723 while (unnamedTabName.
endsWith(
"*")) unnamedTabName.
chop(1);
724 mTabWidget->
setTabText(index, unnamedTabName);
735 return QString(
".unnamed_tab%1.py").
arg(index);
747 mGenericPath = genericPath;
750 for (
int inx=0; inx<mTabWidget->
count(); ++inx)
771 mPathEditorMap.remove(absFilename);
782 QString changedFiles =
"The following files have not been saved yet:\n";
784 int total = end - start - (exclude == -1 ? 0 : 1);
785 for (
int t = start; t < end; t++)
796 changedFiles.
append(
" -> " + fileName +
"\n");
807 msgBox.
setInformativeText(QStringLiteral(
"Are you sure you want to close %1 tabs, %2 unsaved, anyway?").arg(total).arg(unsaved));
808 msgBox.
setText(
"There are unsaved modifications that will be lost.");
845 QMessageBox::warning(
this,
"Script execution error",
"Please respond to code editor message before executing the script");
853 this->updateSnapshots();
857 mBlockedContextIds.
append(ctx->id());
866 for (
u32 ctxId : mBlockedContextIds)
871 mBlockedContextIds.clear();
902 QMenu context_menu(
this);
926 action->setData(absFilename);
935 assert(mTabRightclicked != -1);
941 assert(mTabRightclicked != -1);
942 int tabs = mTabWidget->
count();
945 for (
int t = 0; t < tabs; t++)
953 assert(mTabRightclicked != -1);
954 int tabs = mTabWidget->
count();
958 for (
int t = 0; t < tabs; t++)
961 if (t == mTabRightclicked)
972 assert(mTabRightclicked != -1);
975 for (
int t = 0; t < mTabRightclicked; t++)
984 assert(mTabRightclicked != -1);
985 int tabs = mTabWidget->
count();
988 for (
int t = mTabRightclicked + 1; t < tabs; t++)
1000 log_error(
"gui",
"could not cast sender into QAction.");
1008 log_error(
"gui",
"File does not exist.");
1017 PythonCodeEditor* editor_with_modified_base_file = mPathEditorMap.value(path);
1019 int tabIndex = mTabWidget->
indexOf(editor_with_modified_base_file);
1023 mTabWidget->
setTabText(tabIndex, tab_name +
"*");
1029 if (editor_with_modified_base_file == currentEditor)
1075 bool deleteSnapshots = askDeleteSnapshots(snapshots);
1076 if (deleteSnapshots)
1079 clearAllSnapshots(
true);
1085 if (mTabWidget->
count() == 1)
1092 int tabs = mTabWidget->
count();
1094 for (
int idx = 0; idx < tabs; idx++)
1100 bool load_snapshot = decideLoadSnapshot(saved_snapshots, original_path);
1104 this->setSnapshotContent(idx, saved_snapshots[original_path.
absoluteFilePath()]);
1110 for (
auto snapshot_original_path : saved_snapshots.
keys())
1112 QFileInfo original_path(snapshot_original_path);
1113 bool load_snapshot = decideLoadSnapshot(saved_snapshots, original_path);
1115 int tab_idx = mTabWidget->
count() - 1;
1119 this->setSnapshotContent(tab_idx, saved_snapshots[snapshot_original_path]);
1125 for (
QString snapshot_content : unsaved_snapshots)
1128 this->setSnapshotContent(mTabWidget->
count() - 1, snapshot_content);
1136 clearAllSnapshots(
true);
1139 while (mTabWidget->
count() > 0)
1141 mNewFileCounter = 0;
1162 if (mouseEvent->
button() == Qt::MouseButton::RightButton)
1164 mTabRightclicked = mTabWidget->
tabBar()->
tabAt(mouseEvent->
pos());
1183 QString file_content = stream.readAll();
1192 QString snapshot_path = this->getSnapshotDirectory(
false);
1200 QDir snapshot_dir(snapshot_path);
1204 for (
QString snapshot_file_name : snapshot_files)
1208 QString original_path = original_path_and_content.first;
1212 unstored_snapshots.
append(original_path_and_content.second);
1217 stored_snapshot_map.
insert(original_path_and_content.first, original_path_and_content.second);
1224 bool PythonEditor::writeSnapshotFile(
QFileInfo snapshot_file_path,
QString original_file_path,
QString content)
const
1229 log_error(
"gui",
"Cannot open snapshot file to write!");
1233 snapshot_file.write(original_file_path.
toUtf8());
1234 snapshot_file.write(
"\n");
1235 snapshot_file.write(content.
toUtf8());
1236 snapshot_file.close();
1241 QString PythonEditor::getSnapshotDirectory(
const bool create_if_non_existent)
1246 QDir snapshot_dir = info.absoluteDir();
1249 if (!snapshot_dir.
exists(completePath))
1251 if (create_if_non_existent)
1253 if (!snapshot_dir.
mkpath(completePath))
1255 log_error(
"gui",
"Failed to create snapshot directory.");
1262 return completePath;
1268 void PythonEditor::updateSnapshots()
1270 this->clearAllSnapshots(
false);
1271 mTabToSnapshotPath.clear();
1273 QDir snapshot_dir = this->getSnapshotDirectory(
true);
1275 int tabs = mTabWidget->
count();
1276 for (
int index = 0; index < tabs; index++)
1278 PythonCodeEditor* editor =
dynamic_cast<PythonCodeEditor*
>(mTabWidget->
widget(index));
1279 QString snapshot_file_name =
"~";
1280 if (editor->getRelFilename().isEmpty())
1283 snapshot_file_name +=
"unsaved_tab";
1288 QFileInfo original_file_name(editor->getRelFilename());
1289 snapshot_file_name += original_file_name.fileName();
1297 mTabToSnapshotPath.insert(editor, snapshot_file_path);
1299 if (editor->document()->isModified())
1302 this->writeSnapshotFile(snapshot_file_path, editor->getAbsFilename(), editor->toPlainText());
1307 void PythonEditor::clearAllSnapshots(
bool remove_dir)
1309 QString snapshot_dir_path = this->getSnapshotDirectory(
false);
1311 if (snapshot_dir_path ==
"")
1316 QDir snapshot_dir(snapshot_dir_path);
1336 snapshot_dir.
remove(dirFile);
1343 bool load_snapshot =
false;
1346 if (original_path.
exists())
1353 original_content =
"Cannot open original file...";
1363 load_snapshot =
true;
1366 return load_snapshot;
1369 void PythonEditor::setSnapshotContent(
const int idx,
const QString snapshot_content)
1371 if (idx < 0 || idx >= mTabWidget->
count())
1373 log_error(
"gui",
"Cannot insert snapshot content is tab. Index {} is out of range.", idx);
1375 PythonCodeEditor* tab =
dynamic_cast<PythonCodeEditor*
>(mTabWidget->
widget(idx));
1377 tab->setPlainText(snapshot_content);
1379 tab->document()->setModified(
true);
1389 bool PythonEditor::askLoadSnapshot(
const QString original_path,
const QString original_content,
const QString snapshot_content)
const
1393 msgBox.setWindowTitle(
"Python snapshot file detected");
1394 msgBox.setText(
"A snapshot file (for " + original_path
1395 +
") was found! This may happen due to a recent crash.\n"
1396 "Do you want to load the snapshot file or the (unsaved) original file?");
1403 detailed_text =
"=== Original File (" + original_path +
") ===\n" + original_content +
"\n=== Snapshot File ===\n" + snapshot_content;
1405 msgBox.setDetailedText(detailed_text);
1424 msgBox.setWindowTitle(
"Python snapshot file detected");
1425 msgBox.setText(
"You have just parsed an hdl file but there are still old snapshot files left. This may happen due to a recent crash. "
1426 "Do you want to ignore and delete all old snapshot files and stay with their last saved state? "
1427 "Or do you want to open the old python scripts to save them properly?");
1434 detailed_text =
"Snapshot files of the following paths were found:";
1435 for (
auto origPath : snapshots.first.keys())
1437 detailed_text +=
"\n'" + origPath +
"'";
1439 if (!snapshots.second.isEmpty())
1441 detailed_text +=
"\n+ " +
QString::number(snapshots.second.size()) +
" unsaved tabs";
1444 msgBox.setDetailedText(detailed_text);
1470 void PythonEditor::removeSnapshotFile(PythonCodeEditor* editor)
const
1472 if (!mTabToSnapshotPath.contains(editor))
1477 QFileInfo snapshot_path(mTabToSnapshotPath[editor]);
1478 if (snapshot_path.exists())
1480 QFile snapshot_file(snapshot_path.filePath());
1481 snapshot_file.remove();
1487 return mDisabledIconStyle;
1492 return mOpenIconPath;
1497 return mOpenIconStyle;
1502 return mSaveIconPath;
1507 return mSaveIconStyle;
1512 return mSaveAsIconPath;
1517 return mSaveAsIconStyle;
1522 return mRunIconPath;
1527 return mRunIconStyle;
1532 return mNewFileIconPath;
1537 return mNewFileIconStyle;
1542 return mToggleMinimapIconPath;
1547 return mToggleMinimapIconStyle;
1552 mDisabledIconStyle =
style;
1557 mOpenIconPath = path;
1562 mOpenIconStyle =
style;
1567 mSaveIconPath = path;
1572 mSaveIconStyle =
style;
1577 mSaveAsIconPath = path;
1582 mSaveAsIconStyle =
style;
1587 mRunIconPath = path;
1592 mRunIconStyle =
style;
1597 mNewFileIconPath = path;
1602 mNewFileIconStyle =
style;
1607 mToggleMinimapIconPath = path;
1612 mToggleMinimapIconStyle =
style;
1647 return mSearchIconPath;
1652 return mSearchIconStyle;
1657 return mSearchActiveIconStyle;
1662 mSearchIconPath = path;
1667 mSearchIconStyle =
style;
1672 mSearchActiveIconStyle =
style;
Provides an interface for triggerable functionality that can be inserted into widgets and also connec...
void setText(const QString &text)
void setHighlightCurrentLineEnabled(bool enabled)
void setLineWrapEnabled(bool enabled)
void setMinimapEnabled(bool enabled)
CodeEditorMinimap * minimap()
void search(const QString &string, SearchOptions searchOpts=8)
void setLineNumberEnabled(bool enabled)
QTextDocument * document()
PythonEditor * getPythonEditorWidget()
Abstract class for Widgets within HAL's ContentArea.
QKeySequence mSearchKeysequence
QShortcut * mSearchShortcut
QVBoxLayout * mContentLayout
static FileManager * get_instance()
void fileAboutToClose(const QString &fileName)
void fileOpened(const QString &fileName)
A dialog in form of a bar to let the user decide how to handle file changes outside of HAL.
void handleFileChanged(QString path)
void handleScriptExecute(QString path)
void fileChanged(const QUuid uuid, const QString &descriptor)
void fileSaved(const QUuid uuid)
Logical container for modules, gates, and nets.
GraphContext * getContextById(u32 id) const
QVector< GraphContext * > getContexts() const
JsonWriteObject & add_object()
bool serialize(const std::string &filename)
JsonWriteArray & add_array(const std::string &tag)
std::filesystem::path get_filename(const std::string &relative_filename) const
std::filesystem::path get_canonical_path() const
static ProjectManager * instance()
std::string get_filename(const std::string &serializer_name)
ProjectStatus get_project_status() const
const ProjectDirectory & get_project_directory() const
Code editor to write python code.
bool isBaseFileModified()
void setFilename(const QString &name)
QString getAbsFilename() const
void keyPressed(QKeyEvent *e)
void setBaseFileModified(bool base_file_modified)
QString getRelFilename() const
Interface for handling python outputs.
Main widget that combines all neccessary functionality to develop in python (for hal).
void handleActionNewTab()
virtual void clear() override
void handleActionOpenFile()
void handleBaseFileModifiedIgnore()
void setToggleMinimapIconStyle(const QString &style)
void handleCurrentTabChanged(int index)
void tabLoadFile(u32 index, QString fileName)
bool handleDeserializationFromHalFile(const std::filesystem::path &path, Netlist *netlist, rapidjson::Document &document)
void handleSearchbarTextEdited(const QString &text, SearchOptions opts)
void handleActionSaveFile()
QTextDocument::FindFlags getFindFlags()
void setSearchActiveIconStyle(const QString &style)
void handleActionCloseOtherTabs()
void handleTabCloseRequested(int index)
void handleTabFileChanged(QString path)
void setRunIconStyle(const QString &style)
void setRunIconPath(const QString &path)
bool confirmDiscardForRange(int start, int end, int exclude=-1)
void discardTab(int index)
virtual QList< QShortcut * > createShortcuts() override
void handleActionCloseTab()
void setSaveAsIconPath(const QString &path)
void forwardError(const QString &output)
void forwardStdout(const QString &output)
PythonCodeEditor * getPythonEditor(int tabIndex)
void setDisabledIconStyle(const QString &style)
QString searchActiveIconStyle
void handleActionSaveFileAs()
void handleThreadFinished()
void setSaveIconStyle(const QString &style)
void setSaveAsIconStyle(const QString &style)
QTabWidget * getTabWidget()
void handleFileOpened(QString fileName)
QString toggleMinimapIconPath
void handleActionCloseRightTabs()
PythonEditor(QWidget *parent=nullptr)
void handleBaseFileModifiedReload()
virtual void setupToolbar(Toolbar *Toolbar) override
void setSearchIconPath(const QString &path)
void handleFileAboutToClose(const QString &fileName)
void setSaveIconPath(const QString &path)
void setToggleMinimapIconPath(const QString &path)
virtual void handleError(const QString &output) override
bool eventFilter(QObject *obj, QEvent *event) override
void handleActionCloseAllTabs()
void handleActionTabMenu()
void setSearchIconStyle(const QString &style)
void setNewFileIconStyle(const QString &style)
virtual void handleStdout(const QString &output) override
bool saveFile(bool isAutosave, QueryFilenamePolicy queryPolicy, int index=-1)
void setOpenIconStyle(const QString &style)
void setToolbarButtonsEnabled(bool enable)
void saveAllTabs(const QString &genericPath, bool isAutosave)
void handleBaseFileModifiedOk()
QString toggleMinimapIconStyle
void handleActionCloseLeftTabs()
QString autosaveFilename(int index)
QString unnamedFilename(int index) const
void handleActionShowFile()
void setOpenIconPath(const QString &path)
void handleActionToggleMinimap()
void setNewFileIconPath(const QString &path)
QString disabledIconStyle
std::string serialize(Netlist *netlist, const std::filesystem::path &savedir, bool isAutosave)
static std::string sControlFileName
void deserialize(Netlist *netlist, const std::filesystem::path &loaddir)
std::string serialize_control(const std::filesystem::path &savedir=std::filesystem::path(), bool isAutosave=false)
static QString sPythonRelDir
A syntax highlighter that fits for python code.
bool isExactMatch() const
bool isCaseSensitive() const
A QFrame with a QLineEdit that can be used to input a substring to search for.
SearchOptions getSearchOptions() const
void setEmitTextWithFlags(bool)
void triggerNewSearch(const QString &text, int searchOptions)
A SettingsItem representing a Checkbox.
virtual QVariant value() const override
A SettingsItem to modify keybinds.
void keySequenceChanged(QKeySequence value)
virtual QVariant value() const override
A SettingsItem that represents a spinbox.
void intChanged(int value)
virtual QVariant value() const override
void setRange(int min, int max)
#define log_error(channel,...)
#define log_warning(channel,...)
QIcon getStyledSvgIcon(const QString &from_to_colors_enabled, const QString &svg_path, QString from_to_colors_disabled=QString())
PythonContext * gPythonContext
ContentManager * gContentManager
FileStatusManager * gFileStatusManager
GraphContextManager * gGraphContextManager
void setIcon(const QIcon &icon)
void setText(const QString &text)
void triggered(bool checked)
bool openUrl(const QUrl &url)
QString absoluteFilePath(const QString &fileName) const const
QString absolutePath() const const
QString dirName() const const
QStringList entryList(QDir::Filters filters, QDir::SortFlags sort) const const
bool exists() const const
bool mkpath(const QString &dirPath) const const
bool remove(const QString &fileName)
void setFilter(QDir::Filters filters)
void setNameFilters(const QStringList &nameFilters)
bool copy(const QString &newName)
virtual bool open(QIODevice::OpenMode mode) override
QStringList getOpenFileNames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
QString absoluteFilePath() const const
QString absolutePath() const const
QString completeBaseName() const const
QString completeSuffix() const const
bool exists() const const
QString fileName() const const
QString filePath() const const
bool isRelative() const const
QString path() const const
bool addPath(const QString &path)
void fileChanged(const QString &path)
QStringList files() const const
bool removePath(const QString &path)
virtual void addItem(QLayoutItem *item)=0
virtual QLayout * layout() override
void append(const T &value)
bool isEmpty() const const
bool contains(const Key &key) const const
QMap::iterator insert(const Key &key, const T &value)
bool isEmpty() const const
QList< Key > keys() const const
int remove(const Key &key)
void setDetailedText(const QString &text)
virtual int exec() override
void setInformativeText(const QString &text)
QMessageBox::StandardButton question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
void setText(const QString &text)
QMessageBox::StandardButton warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
virtual bool eventFilter(QObject *watched, QEvent *event)
void installEventFilter(QObject *filterObj)
QObject * sender() const const
QTextDocument * document() const const
void setPlainText(const QString &text)
QString toPlainText() const const
void setKey(const QKeySequence &key)
QString & append(QChar ch)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
const QChar at(int position) const const
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const const
QString fromStdString(const std::string &str)
QString fromUtf8(const char *str, int size)
bool isEmpty() const const
QString mid(int position, int n) const const
QString number(int n, int base)
QString & replace(int position, int n, QChar after)
QString section(QChar sep, int start, int end, QString::SectionFlags flags) const const
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const const
std::string toStdString() const const
QByteArray toUtf8() const const
bool contains(const QString &str, Qt::CaseSensitivity cs) const const
int tabAt(const QPoint &position) const const
void setTabText(int index, const QString &label)
QString tabText(int index) const const
bool isModified() const const
bool toBool() const const
int toInt(bool *ok) const const
QString toString() const const
void append(const T &value)
bool isEmpty() const const