Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
GUIUtil Namespace Reference

Utility functions used by the Bitcoin Qt UI. More...

Classes

class  ClickableLabel
 
class  ClickableProgressBar
 
class  ItemDelegate
 
class  LabelOutOfFocusEventFilter
 Qt event filter that intercepts QEvent::FocusOut events for QLabel objects, and resets their ‘textInteractionFlags’ property to get rid of the visible cursor. More...
 
class  TableViewLastColumnResizingFixer
 Makes a QTableView last column feel as if it was being resized from its left border. More...
 
class  ToolTipToRichTextFilter
 Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text representation if needed. More...
 

Typedefs

typedef ClickableProgressBar ProgressBar
 

Functions

QString dateTimeStr (const QDateTime &date)
 
QString dateTimeStr (qint64 nTime)
 
QFont fixedPitchFont ()
 
static std::string MakeAddrInvalid (std::string addr, const CChainParams &params)
 
std::string DummyAddress (const CChainParams &params)
 
QString convertToCashAddr (const CChainParams &params, const QString &addr)
 
void setupAddressWidget (QValidatedLineEdit *widget, QWidget *parent)
 
bool parseBitcoinURI (const QString &scheme, const QUrl &uri, SendCoinsRecipient *out)
 
bool parseBitcoinURI (const QString &scheme, QString uri, SendCoinsRecipient *out)
 
QString formatBitcoinURI (const SendCoinsRecipient &info)
 
QString formatBitcoinURI (const CChainParams &params, const SendCoinsRecipient &info)
 
bool isDust (interfaces::Node &node, const QString &address, const Amount amount, const CChainParams &chainParams)
 
QString HtmlEscape (const QString &str, bool fMultiLine)
 
QString HtmlEscape (const std::string &str, bool fMultiLine)
 
void copyEntryData (const QAbstractItemView *view, int column, int role=Qt::EditRole)
 Copy a field of the currently selected entry of a view to the clipboard.
 
QList< QModelIndexgetEntryData (const QAbstractItemView *view, int column)
 Return a field of the currently selected entry as a QString.
 
bool hasEntryData (const QAbstractItemView *view, int column, int role)
 Returns true if the specified field of the currently selected view entry is not empty.
 
QString getDefaultDataDirectory ()
 Determine default data directory for operating system.
 
QString getSaveFileName (QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
 Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when no suffix is provided by the user.
 
QString getOpenFileName (QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
 Get open filename, convenience wrapper for QFileDialog::getOpenFileName.
 
Qt::ConnectionType blockingGUIThreadConnection ()
 Get connection type to call object slot in GUI thread with invokeMethod.
 
bool checkPoint (const QPoint &p, const QWidget *w)
 
bool isObscured (QWidget *w)
 
void bringToFront (QWidget *w)
 
void handleCloseWindowShortcut (QWidget *w)
 
void openDebugLogfile ()
 
bool openBitcoinConf ()
 
QStringList splitSkipEmptyParts (const QString &s, const QString &separator)
 
bool GetStartOnSystemStartup ()
 
bool SetStartOnSystemStartup (bool fAutoStart)
 
void setClipboard (const QString &str)
 
fs::path qstringToBoostPath (const QString &path)
 Convert QString to OS specific boost path through UTF-8.
 
QString boostPathToQString (const fs::path &path)
 Convert OS specific boost path to QString through UTF-8.
 
QString NetworkToQString (Network net)
 Convert enum Network to QString.
 
QString formatDurationStr (std::chrono::seconds dur)
 Convert seconds into a QString with days, hours, mins, secs.
 
QString formatServicesStr (quint64 mask)
 Format CNodeStats.nServices bitmask into a user-readable string.
 
QString formatPingTime (std::chrono::microseconds ping_time)
 Format a CNodeStats.m_last_ping_time into a user-readable string or display N/A, if 0.
 
QString formatTimeOffset (int64_t nTimeOffset)
 Format a CNodeCombinedStats.nTimeOffset into a user-readable string.
 
QString formatNiceTimeOffset (qint64 secs)
 
QString formatBytes (uint64_t bytes)
 
qreal calculateIdealFontSize (int width, const QString &text, QFont font, qreal minPointSize, qreal font_size)
 
int TextWidth (const QFontMetrics &fm, const QString &text)
 Returns the distance in pixels appropriate for drawing a subsequent character after text.
 
void PolishProgressDialog (QProgressDialog *dialog)
 
void LogQtInfo ()
 Writes to debug.log short info about the used Qt and the host system.
 
void PopupMenu (QMenu *menu, const QPoint &point, QAction *at_action=nullptr)
 Call QMenu::popup() only on supported QT_QPA_PLATFORM.
 

Detailed Description

Utility functions used by the Bitcoin Qt UI.

Typedef Documentation

◆ ProgressBar

Definition at line 320 of file guiutil.h.

Function Documentation

◆ blockingGUIThreadConnection()

Qt::ConnectionType GUIUtil::blockingGUIThreadConnection ( )

Get connection type to call object slot in GUI thread with invokeMethod.

The call will be blocking.

Returns
If called from the GUI thread, return a Qt::DirectConnection. If called from another thread, return a Qt::BlockingQueuedConnection.

Definition at line 366 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ boostPathToQString()

QString GUIUtil::boostPathToQString ( const fs::path path)

Convert OS specific boost path to QString through UTF-8.

Definition at line 785 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bringToFront()

void GUIUtil::bringToFront ( QWidget *  w)

Definition at line 390 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateIdealFontSize()

qreal GUIUtil::calculateIdealFontSize ( int  width,
const QString text,
QFont  font,
qreal  minPointSize,
qreal  font_size 
)

Definition at line 915 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkPoint()

bool GUIUtil::checkPoint ( const QPoint p,
const QWidget *  w 
)

Definition at line 374 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convertToCashAddr()

QString GUIUtil::convertToCashAddr ( const CChainParams params,
const QString addr 
)

Definition at line 121 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyEntryData()

void GUIUtil::copyEntryData ( const QAbstractItemView view,
int  column,
int  role = Qt::EditRole 
)

Copy a field of the currently selected entry of a view to the clipboard.

Does nothing if nothing is selected.

Parameters
[in]columnData column to extract from the model
[in]roleData role to extract from the model
See also
TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress

Definition at line 263 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dateTimeStr() [1/2]

QString GUIUtil::dateTimeStr ( const QDateTime date)

Definition at line 78 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dateTimeStr() [2/2]

QString GUIUtil::dateTimeStr ( qint64  nTime)

Definition at line 83 of file guiutil.cpp.

Here is the call graph for this function:

◆ DummyAddress()

std::string GUIUtil::DummyAddress ( const CChainParams params)

Definition at line 106 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fixedPitchFont()

QFont GUIUtil::fixedPitchFont ( )

Definition at line 87 of file guiutil.cpp.

Here is the caller graph for this function:

◆ formatBitcoinURI() [1/2]

QString GUIUtil::formatBitcoinURI ( const CChainParams params,
const SendCoinsRecipient info 
)

Definition at line 214 of file guiutil.cpp.

Here is the call graph for this function:

◆ formatBitcoinURI() [2/2]

QString GUIUtil::formatBitcoinURI ( const SendCoinsRecipient info)

Definition at line 210 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatBytes()

QString GUIUtil::formatBytes ( uint64_t  bytes)

Definition at line 893 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatDurationStr()

QString GUIUtil::formatDurationStr ( std::chrono::seconds  dur)

Convert seconds into a QString with days, hours, mins, secs.

Definition at line 811 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatNiceTimeOffset()

QString GUIUtil::formatNiceTimeOffset ( qint64  secs)

Definition at line 864 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatPingTime()

QString GUIUtil::formatPingTime ( std::chrono::microseconds  ping_time)

Format a CNodeStats.m_last_ping_time into a user-readable string or display N/A, if 0.

Definition at line 851 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatServicesStr()

QString GUIUtil::formatServicesStr ( quint64  mask)

Format CNodeStats.nServices bitmask into a user-readable string.

Definition at line 835 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTimeOffset()

QString GUIUtil::formatTimeOffset ( int64_t  nTimeOffset)

Format a CNodeCombinedStats.nTimeOffset into a user-readable string.

Definition at line 859 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDefaultDataDirectory()

QString GUIUtil::getDefaultDataDirectory ( )

Determine default data directory for operating system.

Definition at line 290 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntryData()

QList< QModelIndex > GUIUtil::getEntryData ( const QAbstractItemView view,
int  column 
)

Return a field of the currently selected entry as a QString.

Does nothing if nothing is selected.

Parameters
[in]columnData column to extract from the model
See also
TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress

Definition at line 275 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOpenFileName()

QString GUIUtil::getOpenFileName ( QWidget *  parent,
const QString caption,
const QString dir,
const QString filter,
QString selectedSuffixOut 
)

Get open filename, convenience wrapper for QFileDialog::getOpenFileName.

Parameters
[in]parentParent window (or 0)
[in]captionWindow caption (or empty, for default)
[in]dirStarting directory (or empty, to default to documents directory)
[in]filterFilter specification such as "Comma Separated Files (*.csv)"
[out]selectedSuffixOutPointer to return the suffix (file type) that was selected (or 0). Can be useful when choosing the save file format based on suffix.

Definition at line 337 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSaveFileName()

QString GUIUtil::getSaveFileName ( QWidget *  parent,
const QString caption,
const QString dir,
const QString filter,
QString selectedSuffixOut 
)

Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when no suffix is provided by the user.

Parameters
[in]parentParent window (or 0)
[in]captionWindow caption (or empty, for default)
[in]dirStarting directory (or empty, to default to documents directory)
[in]filterFilter specification such as "Comma Separated Files (*.csv)"
[out]selectedSuffixOutPointer to return the suffix (file type) that was selected (or 0). Can be useful when choosing the save file format based on suffix.

Definition at line 294 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetStartOnSystemStartup()

bool GUIUtil::GetStartOnSystemStartup ( )

Definition at line 767 of file guiutil.cpp.

Here is the caller graph for this function:

◆ handleCloseWindowShortcut()

void GUIUtil::handleCloseWindowShortcut ( QWidget *  w)

Definition at line 407 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasEntryData()

bool GUIUtil::hasEntryData ( const QAbstractItemView view,
int  column,
int  role 
)

Returns true if the specified field of the currently selected view entry is not empty.

Parameters
[in]columnData column to extract from the model
[in]roleData role to extract from the model
See also
TransactionView::contextualMenu

Definition at line 282 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HtmlEscape() [1/2]

QString GUIUtil::HtmlEscape ( const QString str,
bool  fMultiLine 
)

Definition at line 251 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HtmlEscape() [2/2]

QString GUIUtil::HtmlEscape ( const std::string &  str,
bool  fMultiLine 
)

Definition at line 259 of file guiutil.cpp.

Here is the call graph for this function:

◆ isDust()

bool GUIUtil::isDust ( interfaces::Node node,
const QString address,
const Amount  amount,
const CChainParams chainParams 
)

Definition at line 243 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isObscured()

bool GUIUtil::isObscured ( QWidget *  w)

Definition at line 382 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LogQtInfo()

void GUIUtil::LogQtInfo ( )

Writes to debug.log short info about the used Qt and the host system.

Definition at line 964 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MakeAddrInvalid()

static std::string GUIUtil::MakeAddrInvalid ( std::string  addr,
const CChainParams params 
)
static

Definition at line 91 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NetworkToQString()

QString GUIUtil::NetworkToQString ( Network  net)

Convert enum Network to QString.

Definition at line 789 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ openBitcoinConf()

bool GUIUtil::openBitcoinConf ( )

Definition at line 422 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ openDebugLogfile()

void GUIUtil::openDebugLogfile ( )

Definition at line 412 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseBitcoinURI() [1/2]

bool GUIUtil::parseBitcoinURI ( const QString scheme,
const QUrl uri,
SendCoinsRecipient out 
)

Definition at line 144 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseBitcoinURI() [2/2]

bool GUIUtil::parseBitcoinURI ( const QString scheme,
QString  uri,
SendCoinsRecipient out 
)

Definition at line 197 of file guiutil.cpp.

Here is the call graph for this function:

◆ PolishProgressDialog()

void GUIUtil::PolishProgressDialog ( QProgressDialog dialog)

Definition at line 953 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PopupMenu()

void GUIUtil::PopupMenu ( QMenu menu,
const QPoint point,
QAction at_action 
)

Call QMenu::popup() only on supported QT_QPA_PLATFORM.

Definition at line 986 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qstringToBoostPath()

fs::path GUIUtil::qstringToBoostPath ( const QString path)

Convert QString to OS specific boost path through UTF-8.

Definition at line 781 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setClipboard()

void GUIUtil::setClipboard ( const QString str)

Definition at line 776 of file guiutil.cpp.

Here is the caller graph for this function:

◆ SetStartOnSystemStartup()

bool GUIUtil::SetStartOnSystemStartup ( bool  fAutoStart)

Definition at line 770 of file guiutil.cpp.

Here is the caller graph for this function:

◆ setupAddressWidget()

void GUIUtil::setupAddressWidget ( QValidatedLineEdit widget,
QWidget *  parent 
)

Definition at line 130 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ splitSkipEmptyParts()

QStringList GUIUtil::splitSkipEmptyParts ( const QString s,
const QString separator 
)

Definition at line 448 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TextWidth()

int GUIUtil::TextWidth ( const QFontMetrics fm,
const QString text 
)

Returns the distance in pixels appropriate for drawing a subsequent character after text.

In Qt 5.12 and before the QFontMetrics::width() is used and it is deprecated since Qt 13.0. In Qt 5.11 the QFontMetrics::horizontalAdvance() was introduced.

Definition at line 945 of file guiutil.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: