本文整理汇总了C++中QToolButton::objectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::objectName方法的具体用法?C++ QToolButton::objectName怎么用?C++ QToolButton::objectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::objectName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: browseCommand
void ConfigGeneralWidget::browseCommand()
{
QToolButton *button = qobject_cast<QToolButton*>(sender());
if (button->objectName() == QLatin1String("latexButton"))
browseCommand(ui.latexEdit);
else if (button->objectName() == QLatin1String("pdftopsButton"))
browseCommand(ui.pdftopsEdit);
else if (button->objectName() == QLatin1String("editorButton"))
browseCommand(ui.editorEdit);
else if (button->objectName() == QLatin1String("tikzDocButton"))
browseCommand(ui.tikzDocEdit, false);
}
示例2: getProgram
void
MidiProgramsEditor::slotKeyMapButtonPressed()
{
QToolButton* button = dynamic_cast<QToolButton*>(const_cast<QObject *>(sender()));
if (!button) {
RG_DEBUG << "MidiProgramsEditor::slotKeyMapButtonPressed() : %%% ERROR - signal sender is not a QPushButton\n";
return ;
}
// std::cout << "editor button name" << button->objectName().toStdString() << std::endl;
QString senderName = button->objectName();
if (!m_device)
return ;
const KeyMappingList &kml = m_device->getKeyMappings();
if (kml.empty())
return ;
// Adjust value back to zero rated
//
unsigned int id = senderName.toUInt() - 1;
MidiProgram *program = getProgram(*getCurrentBank(), id);
if (!program)
return ;
m_currentMenuProgram = id;
RosegardenPopupMenu *menu = new RosegardenPopupMenu(button);
const MidiKeyMapping *currentMapping =
m_device->getKeyMappingForProgram(*program);
int currentKeyMap = 0;
QAction *a = menu->addAction(tr("<no key mapping>"));
a->setObjectName("0");
for (size_t i = 0; i < kml.size(); ++i) {
a = menu->addAction(strtoqstr(kml[i].getName()));
a->setObjectName(QString("%1").arg(i+1));
if (currentMapping && (kml[i] == *currentMapping)) currentKeyMap = int(i + 1);
}
connect(menu, SIGNAL(triggered(QAction *)),
this, SLOT(slotKeyMapMenuItemSelected(QAction *)));
int itemHeight = menu->actionGeometry(actions().value(0)).height() + 2;
QPoint pos = QCursor::pos();
pos.rx() -= 10;
pos.ry() -= (itemHeight / 2 + currentKeyMap * itemHeight);
menu->popup(pos);
}
示例3: on_mB_toggled
void Dialog::on_mB_toggled(bool)
{
QToolButton* mB = dynamic_cast<QToolButton*>(sender());
if (bt_pres == "mB_sel"){
QPainter painter(&pix);
painter.drawPixmap(x_tm,y_tm,tmp);
pixsel.fill(Qt::transparent);
mv_x = 0;mv_y = 0;
sel_M = false;sel_B = false;
}
bt_pres = mB->objectName();
ui->label_3->setText(bt_pres);
damj();
}
示例4: setColorDialog
void SettingsDialog::setColorDialog()
{
QString objName;
QToolButton *button = qobject_cast<QToolButton *>(sender());
if (button){
objName = button->objectName();
}else
return;
QColor color = QColorDialog::getColor(Qt::white, this, button->text(), QColorDialog::DontUseNativeDialog );
button->setStyleSheet("background-color: " + color.name() );
// QString string;
// QString r = string.setNum(backgroundColor.red(),10);
// QString g = string.setNum(backgroundColor.green(), 10);
// QString b = string.setNum(backgroundColor.blue(),10);
setStyleSheet();
}