本文整理汇总了C++中QAbstractButton::toolTip方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::toolTip方法的具体用法?C++ QAbstractButton::toolTip怎么用?C++ QAbstractButton::toolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::toolTip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buttonContextMenu
void LaunchPad::buttonContextMenu(const QPoint& /*pos*/)
{
QAbstractButton* btn = static_cast<QAbstractButton*>(sender());
int id = mButtons.id(btn);
QDialog dialog;
QGridLayout layout(&dialog);
QLabel* label;
int row = 0; // Count layout rows
label = new QLabel(tr("Name"));
label->setAlignment(Qt::AlignRight);
layout.addWidget(label, row, 0);
QLineEdit name(btn->text());
name.setToolTip(tr("Button caption"));
layout.addWidget(&name, row++, 1);
layout.setColumnStretch(1, 1);
label = new QLabel(tr("Tip"));
label->setAlignment(Qt::AlignRight);
layout.addWidget(label, row, 0);
QLineEdit tip(btn->toolTip());
tip.setToolTip(tr("Button tool tip"));
tip.setCursorPosition(0);
layout.addWidget(&tip, row++, 1, 1, 2);
layout.setColumnStretch(2, 3);
label = new QLabel(tr("Command"));
label->setAlignment(Qt::AlignRight);
layout.addWidget(label, row, 0);
QLineEdit command(mCommands.at(id));
//QTextEdit command(mCommands.at(id));
command.setCursorPosition(0);
command.setToolTip(tr("Available Tags are: %1").arg("[Provider] [Symbol] [Market] "
"[FiId] [MarketId]"));
layout.addWidget(&command, row++, 1, 1, 2); // Spawn over two colums...
// layout.setColumnStretch(2, 2); // ...and take more space
label = new QLabel(tr("Symbol Type"));
label->setAlignment(Qt::AlignRight);
layout.addWidget(label, row, 0);
// QLineEdit symbolType(mSymbolTypes.at(id));
QComboBox symbolType;
symbolType.setToolTip(tr("Witch type has to be [Symbol]. When empty is called once with any symbol\n"
"(You should not use [Symbol] in this case at the command)"));
SymbolTypeTuple* st = mFilu->getSymbolTypes(Filu::eAllTypes);
if(st)
{
while(st->next()) symbolType.addItem(st->caption());
}
symbolType.addItem("");
symbolType.setCurrentIndex(symbolType.findText(mSymbolTypes.at(id)));
layout.addWidget(&symbolType, row, 1);
QCheckBox allMarkets(tr("All Markets"));
allMarkets.setToolTip(tr("Call multiple times with all markets by 'Symbol Type'"));
allMarkets.setChecked(mMultis.at(id));
layout.addWidget(&allMarkets, row++, 2);
// Add an empty row to take unused space
layout.addWidget(new QWidget, row, 1);
layout.setRowStretch(row++, 2);
// Build the button line
QDialogButtonBox dlgBtns(QDialogButtonBox::Save | QDialogButtonBox::Discard);
QPushButton* db = dlgBtns.button(QDialogButtonBox::Discard);
dlgBtns.addButton(db, QDialogButtonBox::RejectRole);
connect(&dlgBtns, SIGNAL(accepted()), &dialog, SLOT(accept()));
connect(&dlgBtns, SIGNAL(rejected()), &dialog, SLOT(reject()));
DialogButton* remove = new DialogButton(tr("&Remove"), -1);
remove->setToolTip(tr("Remove button"));
dlgBtns.addButton(remove, QDialogButtonBox::ActionRole);
connect(remove, SIGNAL(clicked(int)), &dialog, SLOT(done(int)));
DialogButton* add = new DialogButton(tr("&Add"), 2);
add->setToolTip(tr("Copy to new button"));
dlgBtns.addButton(add, QDialogButtonBox::ActionRole);
connect(add, SIGNAL(clicked(int)), &dialog, SLOT(done(int)));
layout.addWidget(&dlgBtns, row, 1, 1, 2);
dialog.setWindowTitle(tr("LaunchPad - Edit button '%1'").arg(btn->text()));
dialog.setMinimumWidth(350);
switch (dialog.exec())
{
case 0: // Discard
return;
break;
case -1: // Remove
{
int ret = QMessageBox::warning(&dialog
, tr("LaunchPad - Last chance to keep your data")
, tr("Are you sure to delete button <b>'%1'</b> with all your work<b>?</b>")
.arg(btn->text())
, QMessageBox::Yes | QMessageBox::No
, QMessageBox::No);
//.........这里部分代码省略.........