示例#1
0
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
0
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
0
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));
    }
}