Disable unavailable context menu items in transactions tab

This commit is contained in:
Kristaps Kaupe
2020-01-26 22:19:39 +02:00
parent fe3b58b959
commit 2b18fd2242
4 changed files with 31 additions and 14 deletions

View File

@@ -230,7 +230,7 @@ QString HtmlEscape(const std::string& str, bool 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())
return;
@@ -243,13 +243,20 @@ void copyEntryData(QAbstractItemView *view, int column, int role)
}
}
QList<QModelIndex> getEntryData(QAbstractItemView *view, int column)
QList<QModelIndex> getEntryData(const QAbstractItemView *view, int column)
{
if(!view || !view->selectionModel())
return QList<QModelIndex>();
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()
{
return boostPathToQString(GetDefaultDataDir());