Changeset View
Changeset View
Standalone View
Standalone View
src/qt/guiutil.cpp
Show First 20 Lines • Show All 242 Lines • ▼ Show 20 Lines | QString HtmlEscape(const QString &str, bool fMultiLine) { | ||||
} | } | ||||
return escaped; | return escaped; | ||||
} | } | ||||
QString HtmlEscape(const std::string &str, bool fMultiLine) { | QString HtmlEscape(const std::string &str, bool fMultiLine) { | ||||
return HtmlEscape(QString::fromStdString(str), fMultiLine); | return HtmlEscape(QString::fromStdString(str), fMultiLine); | ||||
} | } | ||||
void copyEntryData(QAbstractItemView *view, int column, int role) { | void copyEntryData(const QAbstractItemView *view, int column, int role) { | ||||
if (!view || !view->selectionModel()) { | if (!view || !view->selectionModel()) { | ||||
return; | return; | ||||
} | } | ||||
QModelIndexList selection = view->selectionModel()->selectedRows(column); | QModelIndexList selection = view->selectionModel()->selectedRows(column); | ||||
if (!selection.isEmpty()) { | if (!selection.isEmpty()) { | ||||
// Copy first item | // Copy first item | ||||
setClipboard(selection.at(0).data(role).toString()); | setClipboard(selection.at(0).data(role).toString()); | ||||
} | } | ||||
} | } | ||||
QList<QModelIndex> getEntryData(QAbstractItemView *view, int column) { | QList<QModelIndex> getEntryData(const QAbstractItemView *view, int column) { | ||||
if (!view || !view->selectionModel()) { | if (!view || !view->selectionModel()) { | ||||
return QList<QModelIndex>(); | return QList<QModelIndex>(); | ||||
} | } | ||||
return view->selectionModel()->selectedRows(column); | return view->selectionModel()->selectedRows(column); | ||||
} | } | ||||
bool hasEntryData(const QAbstractItemView *view, int column, int role) { | |||||
QModelIndexList selection = getEntryData(view, column); | |||||
if (selection.isEmpty()) { | |||||
return false; | |||||
} | |||||
return !selection.at(0).data(role).toString().isEmpty(); | |||||
} | |||||
QString getDefaultDataDirectory() { | QString getDefaultDataDirectory() { | ||||
return boostPathToQString(GetDefaultDataDir()); | return boostPathToQString(GetDefaultDataDir()); | ||||
} | } | ||||
QString getSaveFileName(QWidget *parent, const QString &caption, | QString getSaveFileName(QWidget *parent, const QString &caption, | ||||
const QString &dir, const QString &filter, | const QString &dir, const QString &filter, | ||||
QString *selectedSuffixOut) { | QString *selectedSuffixOut) { | ||||
QString selectedFilter; | QString selectedFilter; | ||||
▲ Show 20 Lines • Show All 647 Lines • Show Last 20 Lines |