本文整理汇总了C++中QPushButton::icon方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::icon方法的具体用法?C++ QPushButton::icon怎么用?C++ QPushButton::icon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::icon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QPushButton
void CSVWorld::SceneToolMode::addButton (const std::string& icon, const std::string& id)
{
QPushButton *button = new QPushButton (QIcon (QPixmap (icon.c_str())), "", mPanel);
button->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed));
button->setIconSize (QSize (mIconSize, mIconSize));
button->setFixedSize (mButtonSize, mButtonSize);
mLayout->addWidget (button);
mButtons.insert (std::make_pair (button, id));
connect (button, SIGNAL (clicked()), this, SLOT (selected()));
if (mButtons.size()==1)
setIcon (button->icon());
}
示例2: init
void QG_ExitDialog::init()
{
QPushButton * bSave = buttonBox->button ( QDialogButtonBox::Save );
QPushButton * bSaveAs = buttonBox->button ( QDialogButtonBox::SaveAll );
bSaveAs->setText(tr("Save As..."));
bSaveAs->setIcon(bSave->icon());
//set dlg icon
QMessageBox mb("","",QMessageBox::Question, QMessageBox::Ok, Qt::NoButton, Qt::NoButton);
l_icon->setPixmap( mb.iconPixmap());
// bLeave->setIcon(QIcon(":/actions/fileclose.png"));
// RVT_PORT makeLetterAccell( bLeave );
// bSave->setIcon(QIcon(":/actions/filesave2.png"));
// RVT_PORT makeLetterAccell( bSave );
// bSaveAs->setIcon(QIcon(":/actions/filesaveas.png"));
// RVT_PORT makeLetterAccell( bSaveAs );
// RVT_PORT makeLetterAccell( bCancel );
}
示例3: setButtonsPict
void setButtonsPict(QWidget *w)
{
QList<QObject *> l = w->findChildren<QObject *>("QPushButton");
QListIterator<QObject *> it( l );
QObject *obj;
while ( it.hasNext()) {
obj = it.next();
QPushButton *btn = static_cast<QPushButton*>(obj);
if (! btn->icon().isNull()) continue;
const QString &text = btn->text();
const char *icon = NULL;
if ((text == i18n("&OK")) || (text == i18n("&Yes")) ||
(text == i18n("&Apply")) || (text == i18n("&Register"))){
icon = "button_ok";
}else if ((text == i18n("&Cancel")) || (text == i18n("&Close")) ||
(text == i18n("&No"))){
icon = "button_cancel";
}else if (text == i18n("&Help")){
icon = "help";
}
if (icon == NULL) continue;
btn->setIcon(Icon(icon));
}
}