forked from osmocom/wireshark
Qt: Support ampersand in funnel menu and button
An ampersand in the menu item or a button is used as shortcut, so
use "&&" to get a real ampersand.
(cherry picked from commit c84681aca2
)
This commit is contained in:
parent
d5ea403f8d
commit
b668d0a9d5
|
@ -58,13 +58,16 @@ static void progress_window_destroy(struct progdlg *progress_dialog);
|
|||
class FunnelAction : public QAction
|
||||
{
|
||||
public:
|
||||
FunnelAction(const QString title, funnel_menu_callback callback, gpointer callback_data, gboolean retap, QObject *parent = nullptr) :
|
||||
FunnelAction(QString title, funnel_menu_callback callback, gpointer callback_data, gboolean retap, QObject *parent = nullptr) :
|
||||
QAction(parent),
|
||||
title_(title),
|
||||
callback_(callback),
|
||||
callback_data_(callback_data),
|
||||
retap_(retap)
|
||||
{
|
||||
// Use "&&" to get a real ampersand in the menu item.
|
||||
title.replace('&', "&&");
|
||||
|
||||
setText(title);
|
||||
setObjectName(FunnelStatistics::actionName());
|
||||
}
|
||||
|
|
|
@ -118,8 +118,11 @@ void FunnelTextDialog::setTextEditable(gboolean editable)
|
|||
ui->textEdit->setReadOnly(!editable);
|
||||
}
|
||||
|
||||
void FunnelTextDialog::addButton(funnel_bt_t *funnel_button, const QString label)
|
||||
void FunnelTextDialog::addButton(funnel_bt_t *funnel_button, QString label)
|
||||
{
|
||||
// Use "&&" to get a real ampersand in the button.
|
||||
label.replace('&', "&&");
|
||||
|
||||
QPushButton *button = new QPushButton(label);
|
||||
ui->buttonBox->addButton(button, QDialogButtonBox::ActionRole);
|
||||
text_button_to_funnel_button_[button] = funnel_button;
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
const char *getText();
|
||||
void setCloseCallback(text_win_close_cb_t close_cb, void* close_cb_data);
|
||||
void setTextEditable(gboolean editable);
|
||||
void addButton(funnel_bt_t *button_cb, const QString label);
|
||||
void addButton(funnel_bt_t *button_cb, QString label);
|
||||
|
||||
private slots:
|
||||
void buttonClicked();
|
||||
|
|
Loading…
Reference in New Issue