本文整理汇总了C++中KPushButton::setIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ KPushButton::setIcon方法的具体用法?C++ KPushButton::setIcon怎么用?C++ KPushButton::setIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPushButton
的用法示例。
在下文中一共展示了KPushButton::setIcon方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupActions
void CommandMonitorItem::setupActions() {
KPushButton* btnView = new KPushButton();
btnView->setIcon(KIcon(KStandardDirs::locate( "appdata", "pixmap/22x22/eye.png")));
btnView->setMinimumSize(40,22);
btnView->setStyleSheet("border: 1px black solid;border-color:#555555;border-style:solid;border-radius:3px;");
actionLayout->addWidget(btnView);
QObject::connect(btnView, SIGNAL(clicked()), this, SLOT(connectTerm()));
KPushButton* btnStartNow = new KPushButton();
btnStartNow->setIcon(KIcon("arrow-right"));
btnStartNow->setMinimumSize(40,22);
btnStartNow->setStyleSheet("border: 1px black solid;border-color:#555555;border-style:solid;border-radius:3px;");
actionLayout->addWidget(btnStartNow);
KPushButton* btnPause = new KPushButton();
btnPause->setIcon(KIcon(KStandardDirs::locate( "appdata", "pixmap/22x22/pause.png")));
btnPause->setMinimumSize(40,22);
btnPause->setStyleSheet("border: 1px black solid;border-color:#555555;border-style:solid;border-radius:3px;");
actionLayout->addWidget(btnPause);
KPushButton* btnStop = new KPushButton();
btnStop->setIcon(KIcon("dialog-close"));
btnStop->setMinimumSize(40,22);
btnStop->setStyleSheet("border: 1px black solid;border-color:#555555;border-style:solid;border-radius:3px;");
actionLayout->addWidget(btnStop);
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
actionLayout->addItem(horizontalSpacer);
}
示例2: setupUi
void TwitterApiDMessageDialog::setupUi( QWidget *mainWidget )
{
QLabel *lblTo = new QLabel( i18nc("Send message to", "To:"), this);
d->comboFriendsList = new KComboBox(this);
d->comboFriendsList->setDuplicatesEnabled(false);
KPushButton *btnReload = new KPushButton(this);
btnReload->setToolTip(i18n("Reload friends list"));
btnReload->setIcon(KIcon("view-refresh"));
btnReload->setMaximumWidth(25);
connect( btnReload, SIGNAL(clicked(bool)), SLOT(reloadFriendslist()) );
QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget);
QHBoxLayout *toLayout = new QHBoxLayout;
toLayout->addWidget(lblTo);
toLayout->addWidget(d->comboFriendsList);
toLayout->addWidget(btnReload);
mainLayout->addLayout(toLayout);
d->editor = new Choqok::UI::TextEdit( d->account->microblog()->postCharLimit() );
connect( d->editor, SIGNAL(returnPressed(QString)), SLOT(submitPost(QString)) );
mainLayout->addWidget(d->editor);
d->editor->setFocus();
}
示例3: createGroupBox
QGroupBox *
SelectableSubtitleDialog::createSubtitleGroupBox(const QString &title, bool addToLayout)
{
m_subtitleGroupBox = createGroupBox(title, addToLayout);
m_subtitleUrlLineEdit = new KLineEdit(m_subtitleGroupBox);
m_subtitleUrlLineEdit->setCompletionObject(new KUrlCompletion());
QLabel *subtitlePathLabel = new QLabel(m_subtitleGroupBox);
subtitlePathLabel->setText(i18n("Path:"));
subtitlePathLabel->setBuddy(m_subtitleUrlLineEdit);
KPushButton *subtitleButton = new KPushButton(m_subtitleGroupBox);
subtitleButton->setIcon(KIcon("document-open"));
subtitleButton->setToolTip(i18n("Select subtitle"));
int buttonSize = subtitleButton->sizeHint().height();
subtitleButton->setFixedSize(buttonSize, buttonSize);
connect(subtitleButton, SIGNAL(clicked()), SLOT(selectSubtitle()));
m_subtitleEncodingComboBox = new KComboBox(m_subtitleGroupBox);
m_subtitleEncodingComboBox->addItem(i18n("Autodetect"));
m_subtitleEncodingComboBox->addItems(app()->availableEncodingNames());
m_subtitleEncodingComboBox->setCurrentIndex(0);
QLabel *subtitleEncodingLabel = new QLabel(m_subtitleGroupBox);
subtitleEncodingLabel->setText(i18n("Encoding:"));
subtitleEncodingLabel->setBuddy(m_subtitleEncodingComboBox);
QHBoxLayout *subtitlePathLayout = new QHBoxLayout();
subtitlePathLayout->addWidget(m_subtitleUrlLineEdit, 2);
subtitlePathLayout->addWidget(subtitleButton);
QHBoxLayout *subtitleEncodingLayout = new QHBoxLayout();
subtitleEncodingLayout->addWidget(m_subtitleEncodingComboBox);
subtitleEncodingLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum));
m_subtitleLayout = createLayout(m_subtitleGroupBox);
m_subtitleLayout->setColumnStretch(1, 2);
m_subtitleLayout->addWidget(subtitlePathLabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);
m_subtitleLayout->addLayout(subtitlePathLayout, 0, 1, 1, 2);
m_subtitleLayout->addWidget(subtitleEncodingLabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);
m_subtitleLayout->addLayout(subtitleEncodingLayout, 1, 1);
return m_subtitleGroupBox;
}
示例4: updateItemWidgets
void ItemsViewDelegate::updateItemWidgets( const QList<QWidget*> widgets,
const QStyleOptionViewItem& option,
const QPersistentModelIndex& index ) const
{
const GluonPlayer::GameItemsModel* model = qobject_cast<const GluonPlayer::GameItemsModel*>( index.model() );
if( !model )
{
kDebug() << "Warning - Invalid Model!";
return;
}
// setup the install button
int margin = option.fontMetrics.height() / 2;
int right = option.rect.width();
const_cast<QSize&>( m_buttonSize ) = QSize( 32, 32 );
KPushButton* playButton = qobject_cast<KPushButton*>( widgets.at( DelegatePlayButton ) );
if( playButton )
{
playButton->setIcon( KIcon( "media-playback-start" ) );
playButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding );
playButton->resize( m_buttonSize );
playButton->move( right - playButton->width() - margin, option.fontMetrics.height() + playButton->height() * 0.5 );
}
GameTextLabel* gameName = qobject_cast<GameTextLabel*>( widgets.at( DelegateGameName ) );
// gameName->setWordWrap(true);
if( gameName )
{
gameName->move( margin + m_buttonSize.width() * 3, option.fontMetrics.height() );
gameName->resize( QSize( option.rect.width() - ( margin * 4 ) - m_buttonSize.width() * 4, option.fontMetrics.height() * 2 ) );
gameName->setText( index.data( GluonPlayer::GameItemsModel::GameNameRole ).toString() );
}
GameTextLabel* gameDescription = qobject_cast<GameTextLabel*>( widgets.at( DelegateGameDescription ) );
// gameName->setWordWrap(true);
if( gameDescription )
{
gameDescription->move( margin + m_buttonSize.width() * 3, option.fontMetrics.height() * 1 + gameName->size().height() );
gameDescription->resize( QSize( option.rect.width() - ( margin * 4 ) - m_buttonSize.width() * 4, option.fontMetrics.height() * 2 ) );
gameDescription->setText( index.data( GluonPlayer::GameItemsModel::GameDescriptionRole ).toString() );
}
}
示例5: updateItemWidgets
void ServiceItemDelegate::updateItemWidgets(const QList<QWidget*> widgets,
const QStyleOptionViewItem& option,
const QPersistentModelIndex& index) const
{
QCheckBox* checkBox = static_cast<QCheckBox*>(widgets[0]);
KPushButton *configureButton = static_cast<KPushButton*>(widgets[1]);
const int itemHeight = sizeHint(option, index).height();
// Update the checkbox showing the service name and icon
const QAbstractItemModel* model = index.model();
checkBox->setText(model->data(index).toString());
const QString iconName = model->data(index, Qt::DecorationRole).toString();
if (!iconName.isEmpty()) {
checkBox->setIcon(KIcon(iconName));
}
checkBox->setChecked(model->data(index, Qt::CheckStateRole).toBool());
const bool configurable = model->data(index, ServiceModel::ConfigurableRole).toBool();
int checkBoxWidth = option.rect.width();
if (configurable) {
checkBoxWidth -= configureButton->sizeHint().width();
}
checkBox->resize(checkBoxWidth, checkBox->sizeHint().height());
checkBox->move(0, (itemHeight - checkBox->height()) / 2);
// Update the configuration button
if (configurable) {
configureButton->setEnabled(checkBox->isChecked());
configureButton->setIcon(KIcon("configure"));
configureButton->resize(configureButton->sizeHint());
configureButton->move(option.rect.right() - configureButton->width(),
(itemHeight - configureButton->height()) / 2);
}
configureButton->setVisible(configurable);
}
示例6: KVBox
DietWizardDialog::DietWizardDialog( QWidget *parent, RecipeDB *db ) : KVBox( parent )
{
// Initialize internal variables
database = db;
mealNumber = 1;
dayNumber = 1;
dietRList = new RecipeList();
//Design the dialog
setSpacing( 5 );
// Options Box
optionsBox = new KHBox( this );
daysSliderBox = new QGroupBox( optionsBox );
daysSliderBox->setTitle( i18nc( "@label:slider", "Number of Days" ) );
QHBoxLayout *daysSliderBoxLayout = new QHBoxLayout;
daysSliderBox->setLayout( daysSliderBoxLayout );
dayNumberLabel = new QLabel;
dayNumberLabel->setText( "- 1 -" );
dayNumberLabel->setAlignment( Qt::AlignCenter );
dayNumberSelector = new QSlider;
daysSliderBoxLayout->addWidget( dayNumberSelector );
daysSliderBoxLayout->addWidget( dayNumberLabel );
dayNumberSelector->setOrientation( Qt::Horizontal );
dayNumberSelector->setRange( 1, 10 );
dayNumberSelector->setSingleStep( 1 );
dayNumberSelector->setPageStep( 1 );
dayNumberSelector->setTickPosition( QSlider::TicksBelow );
dayNumberSelector->setFixedWidth( 100 );
mealsSliderBox = new QGroupBox( optionsBox );
mealsSliderBox->setTitle( i18nc( "@label:slider", "Meals per Day" ) );
QHBoxLayout *mealsSliderBoxLayout = new QHBoxLayout;
mealsSliderBox->setLayout( mealsSliderBoxLayout );
mealNumberLabel = new QLabel;
mealNumberLabel->setText( "- 1 -" );
mealNumberLabel->setAlignment( Qt::AlignCenter );
mealNumberSelector = new QSlider;
mealsSliderBoxLayout->addWidget( mealNumberSelector );
mealsSliderBoxLayout->addWidget( mealNumberLabel );
mealNumberSelector->setOrientation( Qt::Horizontal );
mealNumberSelector->setRange( 1, 10 );
mealNumberSelector->setSingleStep( 1 );
mealNumberSelector->setPageStep( 1 );
mealNumberSelector->setTickPosition( QSlider::TicksBelow );
mealNumberSelector->setFixedWidth( 100 );
// Tabs
mealTabs = new KTabWidget( this );
mealTabs->setContentsMargins( 5 , 5, 5, 5 );
// Button bar
KHBox *bottom_layout = new KHBox( this );
//bottom_layout->layout()->addItem( new QSpacerItem( 10,10, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) );
okButton = new KPushButton( bottom_layout );
okButton->setIcon( KIcon( "dialog-ok" ) );
okButton->setText( i18nc( "@action:button", "Create the diet" ) );
KPushButton *clearButton = new KPushButton( bottom_layout );
clearButton->setIcon( KIcon( "edit-clear" ) );
clearButton->setText( i18nc( "@action:button Clear Diet","Clear" ) );
// Create Tabs
//don't use newTab, it'll load data and we don't want it to do that at startup
mealTab = new MealInput( mealTabs, database );
// keep this string the same as when creating the other tabs to ease translation
mealTabs->addTab( mealTab, i18ncp( "@title:tab" , "Meal 1" , "Meal %1" , 1 ) );
mealTabs->setCurrentIndex( mealTabs->indexOf( mealTab ) );
// Signals & Slots
connect( mealNumberSelector, SIGNAL( valueChanged( int ) ), this, SLOT( changeMealNumber( int ) ) );
connect( dayNumberSelector, SIGNAL( valueChanged( int ) ), this, SLOT( changeDayNumber( int ) ) );
connect( okButton, SIGNAL( clicked() ), this, SLOT( createDiet() ) );
connect( clearButton, SIGNAL( clicked() ), this, SLOT( clear() ) );
}
示例7: updateItemWidgets
void CommentItemsViewDelegate::updateItemWidgets( const QList<QWidget*> widgets,
const QStyleOptionViewItem& option,
const QPersistentModelIndex& index ) const
{
const GluonPlayer::CommentItemsModel* model = qobject_cast<const GluonPlayer::CommentItemsModel*>( index.model() );
if( !model )
{
kDebug() << "Warning - Invalid Model!";
return;
}
// setup the install button
int margin = option.fontMetrics.height() / 2;
int right = option.rect.width();
int bottom = option.rect.height();
const_cast<QSize&>( m_buttonSize ) = QSize( 32, 32 );
KPushButton* replyButton = qobject_cast<KPushButton*>( widgets.at( DelegateCommentReplyButton ) );
if( replyButton )
{
replyButton->setVisible( const_cast<GluonPlayer::CommentItemsModel*>( model )->isOnline() );
replyButton->setIcon( KIcon( "edit-undo" ) );
replyButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding );
replyButton->resize( m_buttonSize );
replyButton->move( right - replyButton->width() - margin, bottom - m_buttonSize.height() * 1.5 );
}
KSqueezedTextLabel* author = qobject_cast<KSqueezedTextLabel*>( widgets.at( DelegateCommentAuthor ) );
if( author )
{
author->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding );
author->resize( right / 5, m_buttonSize.height() );
author->move( margin, option.fontMetrics.height() );
author->setText( index.data( GluonPlayer::CommentItemsModel::AuthorRole ).toString() );
}
KSqueezedTextLabel* dateTime = qobject_cast<KSqueezedTextLabel*>( widgets.at( DelegateCommentDateTime ) );
if( dateTime )
{
dateTime->resize( author->size().width(), author->size().height() );
dateTime->move( author->x() + author->size().width(), author->y() );
dateTime->setText( index.data( GluonPlayer::CommentItemsModel::DateTimeRole ).toString() );
}
KSqueezedTextLabel* title = qobject_cast<KSqueezedTextLabel*>( widgets.at( DelegateCommentTitle ) );
if( title )
{
title->resize( dateTime->size().width(), dateTime->size().height() );
title->move( dateTime->x() + dateTime->size().width(), dateTime->y() );
title->setText( index.data( GluonPlayer::CommentItemsModel::TitleRole ).toString() );
}
KSqueezedTextLabel* rating = qobject_cast<KSqueezedTextLabel*>( widgets.at( DelegateCommentRating ) );
if( rating )
{
rating->resize( title->size().width(), title->size().height() );
rating->move( title->x() + title->size().width(), title->y() );
rating->setText( index.data( GluonPlayer::CommentItemsModel::RatingRole ).toString() );
}
KSqueezedTextLabel* body = qobject_cast<KSqueezedTextLabel*>( widgets.at( DelegateCommentBody ) );
if( body )
{
body->resize( right - 2 * margin, bottom - author->size().height() - 2 * margin );
body->move( margin, option.fontMetrics.height() + author->size().height() );
body->setText( index.data( GluonPlayer::CommentItemsModel::BodyRole ).toString() );
}
}
示例8: KDialog
GalleryWindow::GalleryWindow(Interface* interface, QWidget *parent, Gallery* pGallery)
: KDialog(parent),
m_interface(interface),
mpGallery(pGallery),
d(new Private(this))
{
setWindowTitle( i18n("Gallery Export") );
setButtons( KDialog::Close | KDialog::User1 | KDialog::Help);
setModal(false);
// About data.
m_about = new KPAboutData(ki18n("Gallery Export"),
0,
KAboutData::License_GPL,
ki18n("A Kipi plugin to export image collections to a remote Gallery server."),
ki18n("(c) 2003-2005, Renchi Raju\n"
"(c) 2006-2007, Colin Guthrie\n"
"(c) 2006-2009, Gilles Caulier\n"
"(c) 2008, Andrea Diamantini\n"));
m_about->addAuthor(ki18n("Renchi Raju"), ki18n("Author"),
"renchi dot raju at gmail dot com");
m_about->addAuthor(ki18n("Colin Guthrie"), ki18n("Maintainer"),
"kde at colin dot guthr dot ie");
m_about->addAuthor(ki18n("Andrea Diamantini"), ki18n("Developer"),
"adjam7 at gmail dot com");
m_about->addAuthor(ki18n("Gilles Caulier"), ki18n("Developer"),
"caulier dot gilles at gmail dot com");
// help button
disconnect(this, SIGNAL(helpClicked()),
this, SLOT(slotHelp()));
KHelpMenu *helpMenu = new KHelpMenu(this, m_about, false);
helpMenu->menu()->removeAction(helpMenu->menu()->actions().first());
QAction *handbook = new QAction(i18n("Handbook"), this);
connect(handbook, SIGNAL(triggered(bool)),
this, SLOT(slotHelp()));
helpMenu->menu()->insertAction(helpMenu->menu()->actions().first(), handbook);
button(Help)->setMenu(helpMenu->menu());
// User1 Button : to conf gallery settings
KPushButton *confButton = button( User1 );
confButton->setText( i18n("Settings") );
confButton->setIcon( KIcon("configure") );
connect(confButton, SIGNAL(clicked()),
this, SLOT(slotSettings()) );
// we need to let m_talker work..
m_talker = new GalleryTalker(d->widget);
// setting progressDlg and its numeric hints
m_progressDlg = new QProgressDialog(this);
m_progressDlg->setModal(true);
m_progressDlg->setAutoReset(true);
m_progressDlg->setAutoClose(true);
m_uploadCount = 0;
m_uploadTotal = 0;
mpUploadList = new QStringList;
// connect functions
connectSignals();
// read Settings
readSettings();
slotDoLogin();
}