本文整理汇总了C++中QStyle::standardIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ QStyle::standardIcon方法的具体用法?C++ QStyle::standardIcon怎么用?C++ QStyle::standardIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStyle
的用法示例。
在下文中一共展示了QStyle::standardIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QPixmap
static QPixmap
getStandardIcon(QMessageBox::Icon icon,
int size,
QWidget* widget)
{
QStyle *style = widget ? widget->style() : QApplication::style();
QIcon tmpIcon;
switch (icon) {
case QMessageBox::Information:
tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, 0, widget);
break;
case QMessageBox::Warning:
tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, widget);
break;
case QMessageBox::Critical:
tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, 0, widget);
break;
case QMessageBox::Question:
tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, 0, widget);
default:
break;
}
if ( !tmpIcon.isNull() ) {
return tmpIcon.pixmap(size, size);
}
return QPixmap();
}
示例2: text
PropertiesDialog::PropertiesDialog(const QWebdavUrlInfo & infos, QWidget * parent)
: QDialog(parent)
{
QStyle *style = QApplication::style();
QIcon icon;
setupUi(this);
if (infos.isDir()) {
icon = style->standardIcon(QStyle::SP_DirIcon);
nameLabel->setText(QFileInfo(infos.name()).dir().dirName());
typeLabel->setText(tr("Folder"));
} else {
icon = style->standardIcon(QStyle::SP_FileIcon);
nameLabel->setText(QFileInfo(infos.name()).fileName());
typeLabel->setText(infos.mimeType());
}
sizeLabel->setText(QString("%1").arg(infos.size()));
createdAtLabel->setText(infos.createdAt().toString());
lastModifiedLabel->setText(infos.lastModified().toString());
iconLabel->setPixmap(icon.pixmap(64, 64));
QString str;
QTextStream text(&str);
text << infos.propElement();
textEdit->setText(str);
}
示例3: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
coordinatesIsNeeded(true)
{
ui->setupUi(this);
ui->enableGpsCheckbox->setChecked(coordinatesIsNeeded);
ui->videoSlider->setEnabled(false);
connect(ui->actionOpen, SIGNAL(triggered()), SLOT(openFile()));
connect(&timer, SIGNAL(timeout()), this, SLOT(stepVideo()));
connect(ui->videoSlider, SIGNAL(sliderMoved(int)), this, SLOT(startVideo(int)));
connect(ui->videoSlider, SIGNAL(valueChanged(int)), this, SLOT(startVideo(int)));
connect(ui->calcSpeedButton, SIGNAL(clicked()), this, SLOT(calculateSpeed()));
connect(ui->enableGpsCheckbox, SIGNAL(stateChanged(int)), this, SLOT(changeGpsOutputState(int)));
connect(ui->playPauseButton, SIGNAL(clicked()), this, SLOT(playPause()));
connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(stop()));
connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
QStyle *pStyle = qApp->style();
QIcon icon = pStyle->standardIcon(QStyle::SP_MediaPlay);
ui->playPauseButton->setIcon(icon);
icon = pStyle->standardIcon(QStyle::SP_MediaStop);
ui->stopButton->setIcon(icon);
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
}
示例4: getIcon
QVariant RemuxQueueModel::getIcon(RemuxEntryState state)
{
QVariant icon;
QStyle *style = QApplication::style();
switch (state) {
case RemuxEntryState::Complete:
icon = style->standardIcon(
QStyle::SP_DialogApplyButton);
break;
case RemuxEntryState::InProgress:
icon = style->standardIcon(
QStyle::SP_ArrowRight);
break;
case RemuxEntryState::Error:
icon = style->standardIcon(
QStyle::SP_DialogCancelButton);
break;
case RemuxEntryState::InvalidPath:
icon = style->standardIcon(
QStyle::SP_MessageBoxWarning);
break;
}
return icon;
}
示例5: action
QAction* QWKPage::action(WebAction action) const
{
if (action == QWKPage::NoWebAction || action >= WebActionCount)
return 0;
if (d->actions[action])
return d->actions[action];
QString text;
QIcon icon;
QStyle* style = qobject_cast<QApplication*>(QCoreApplication::instance())->style();
bool checkable = false;
switch (action) {
case Back:
text = contextMenuItemTagGoBack();
icon = style->standardIcon(QStyle::SP_ArrowBack);
break;
case Forward:
text = contextMenuItemTagGoForward();
icon = style->standardIcon(QStyle::SP_ArrowForward);
break;
case Stop:
text = contextMenuItemTagStop();
icon = style->standardIcon(QStyle::SP_BrowserStop);
break;
case Reload:
text = contextMenuItemTagReload();
icon = style->standardIcon(QStyle::SP_BrowserReload);
break;
default:
return 0;
break;
}
if (text.isEmpty())
return 0;
QAction* a = new QAction(d->q);
a->setText(text);
a->setData(action);
a->setCheckable(checkable);
a->setIcon(icon);
connect(a, SIGNAL(triggered(bool)), this, SLOT(_q_webActionTriggered(bool)));
d->actions[action] = a;
d->updateAction(action);
return a;
}
示例6: initializePage
void AMScanDatabaseImportWizardReviewRunsPage::initializePage()
{
controller_->analyzeFacilitiesForDuplicates();
controller_->analyzeRunsForDuplicates();
runsFoundList_->clear();
runsToMergeList_->clear();
QStyle* style = QApplication::style();
QIcon icon = style->standardIcon(QStyle::SP_DirIcon);
QMap<int, int> runIdMapping = controller_->runIdMapping();
QMapIterator<int, int> i(runIdMapping);
while(i.hasNext()) {
i.next();
runsFoundList_->addItem(new QListWidgetItem(icon, controller_->runName(i.key())));
if(i.value() != -1) {
QListWidgetItem* item = new QListWidgetItem(icon, controller_->runName(i.key()));
item->setData(Qt::UserRole, i.key());
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setData(Qt::CheckStateRole, false);
runsToMergeList_->addItem(item);
}
}
}
示例7: QDialog
//-----------------------------------------------------------------------------
qtConfirmationDialog::qtConfirmationDialog(
const QString& askKey, QWidget* parent, Qt::WindowFlags flags)
: QDialog(parent, flags), d_ptr(new qtConfirmationDialogPrivate)
{
QTE_D(qtConfirmationDialog);
d->AskKey = askKey;
// Create UI
d->UI.setupUi(this);
this->setConfirmText("Continue");
qtUtil::setStandardIcons(d->UI.buttonBox);
// Set dialog icon
QStyle* style = this->style();
int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, this);
QIcon icon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, this);
QPixmap pixmap = icon.pixmap(iconSize, iconSize);
d->UI.image->setPixmap(pixmap);
d->UI.image->setFixedSize(pixmap.size());
// Hide unneeded "don't ask" controls
d->UI.noAsk->setHidden(askKey.isEmpty());
d->UI.noAskSession->hide();
d->UI.noAskEver->hide();
}
示例8: QFrame
CaptionFrame::CaptionFrame(QWidget *parent)
: QFrame(parent)
{
qfLogFuncFrame();
setFrameShape(QFrame::StyledPanel);
setFrameShadow(QFrame::Raised);
QBoxLayout *ly = new QHBoxLayout(this);
//ly->setMargin(0);
ly->setContentsMargins(5, 1, 5, 1);
ly->setSpacing(6);
m_captionIconLabel = new QLabel();
//captionLabel->setPixmap(icon.pixmap(32));
ly->addWidget(m_captionIconLabel);
m_captionLabel = new QLabel();
ly->addWidget(m_captionLabel);
ly->addStretch();
m_closeButton = new QToolButton();
m_closeButton->setVisible(false);
QStyle *sty = style();
m_closeButton->setIcon(sty->standardIcon(QStyle::SP_DialogDiscardButton));
connect(m_closeButton, SIGNAL(clicked()), this, SIGNAL(closeButtonClicked()));
m_closeButton->setAutoRaise(true);
ly->addWidget(m_closeButton);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
//setFrameStyle(StyleDefault);
connect(this, &CaptionFrame::alertChanged, this, &CaptionFrame::update);
}
示例9: pause
void MainWindow::pause()
{
timer.stop();
QStyle *pStyle = qApp->style();
QIcon icon = pStyle->standardIcon(QStyle::SP_MediaPlay);
ui->playPauseButton->setIcon(icon);
}
示例10: resume
void MainWindow::resume()
{
timer.start(frameDelay);
QStyle *pStyle = qApp->style();
QIcon icon = pStyle->standardIcon(QStyle::SP_MediaPause);
ui->playPauseButton->setIcon(icon);
}
示例11: setFileList
void CleanDialog::setFileList(const QString &workingDirectory, const QStringList &l)
{
d->m_workingDirectory = workingDirectory;
d->ui.groupBox->setTitle(tr("Repository: %1").
arg(QDir::toNativeSeparators(workingDirectory)));
if (const int oldRowCount = d->m_filesModel->rowCount())
d->m_filesModel->removeRows(0, oldRowCount);
QStyle *style = QApplication::style();
const QIcon folderIcon = style->standardIcon(QStyle::SP_DirIcon);
const QIcon fileIcon = style->standardIcon(QStyle::SP_FileIcon);
const QString diffSuffix = QLatin1String(".diff");
const QString patchSuffix = QLatin1String(".patch");
const QString proUserSuffix = QLatin1String(".pro.user");
const QString qmlProUserSuffix = QLatin1String(".qmlproject.user");
const QChar slash = QLatin1Char('/');
// Do not initially check patches or 'pro.user' files for deletion.
foreach(const QString &fileName, l) {
const QFileInfo fi(workingDirectory + slash + fileName);
const bool isDir = fi.isDir();
QStandardItem *nameItem = new QStandardItem(QDir::toNativeSeparators(fileName));
nameItem->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
nameItem->setIcon(isDir ? folderIcon : fileIcon);
const bool saveFile = !isDir && (fileName.endsWith(diffSuffix)
|| fileName.endsWith(patchSuffix)
|| fileName.endsWith(proUserSuffix)
|| fileName.endsWith(qmlProUserSuffix));
nameItem->setCheckable(true);
nameItem->setCheckState(saveFile ? Qt::Unchecked : Qt::Checked);
nameItem->setData(QVariant(fi.absoluteFilePath()), fileNameRole);
nameItem->setData(QVariant(isDir), isDirectoryRole);
// Tooltip with size information
if (fi.isFile()) {
const QString lastModified = fi.lastModified().toString(Qt::DefaultLocaleShortDate);
nameItem->setToolTip(tr("%1 bytes, last modified %2")
.arg(fi.size()).arg(lastModified));
}
d->m_filesModel->appendRow(nameItem);
}
for (int c = 0; c < d->m_filesModel->columnCount(); c++)
d->ui.filesTreeView->resizeColumnToContents(c);
}
示例12: initializeUi
void CMessageDialog::initializeUi( QMessageBox::Icon iconStyle ) {
ui->setupUi(this);
ui->label_2->setFrameShape( QFrame::NoFrame );
connect( ui->btnOK, SIGNAL( clicked() ), this, SLOT( close() ) );
connect( ui->btnCopy, SIGNAL( clicked() ), this, SLOT( copyToClipboard() ) );
connect( ui->btnSave, SIGNAL( clicked() ), this, SLOT( save() ) );
QMessageBox* mb = new QMessageBox();
QStyle *style = mb ? mb->style() : QApplication::style();
QIcon tmpIcon;
switch( iconStyle ) {
case QMessageBox::NoIcon:
// Do nothing
break;
case QMessageBox::Information:
tmpIcon = style->standardIcon( QStyle::SP_MessageBoxInformation );
break;
case QMessageBox::Warning:
tmpIcon = style->standardIcon( QStyle::SP_MessageBoxWarning );
break;
case QMessageBox::Critical:
tmpIcon = style->standardIcon( QStyle::SP_MessageBoxCritical );
break;
case QMessageBox::Question:
tmpIcon = style->standardIcon( QStyle::SP_MessageBoxQuestion );
break;
}
if( tmpIcon.isNull() )
ui->label_2->setGeometry( ui->label_2->x(), ui->label_2->y(), 0, 0 );
else {
int iconSize = style->pixelMetric( QStyle::PM_MessageBoxIconSize, 0, mb );
ui->label_2->setGeometry( ui->label_2->x(), ui->label_2->y(), iconSize, iconSize );
ui->label_2->setPixmap( tmpIcon.pixmap( iconSize, iconSize ) );
}
delete mb;
}
示例13: getIcon
QPixmap TimedMessageBox::getIcon(TimedMessageBox::Icons icon)
{
QStyle *style = this ? this->style() : QApplication::style();
int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, this);
QIcon tmpIcon;
switch (icon) {
case Infomation:
tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, 0, this);
break;
case Warning:
tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, this);
break;
case Critical:
tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, 0, this);
break;
}
if (!tmpIcon.isNull())
return tmpIcon.pixmap(iconSize, iconSize);
return QPixmap();
}
示例14: policy
QRDialog::QRDialog(QWidget *parent, AccountData* dataFrom, AccountData* dataTo, int xrpValue) :
QDialog(parent), ui(new Ui::QRDialog), dataFrom(dataFrom), dataTo(dataTo), xrpValue(xrpValue)
{
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
ui->setupUi(this);
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred);
policy.setHeightForWidth(true);
ui->qr->setSizePolicy(policy);
QStyle *style = QApplication::style();
ui->pushButton->setIcon(style->standardIcon(QStyle::SP_DialogApplyButton, 0, this));
ui->pushButton_2->setIcon(style->standardIcon(QStyle::SP_BrowserReload, 0, this));
ui->pushButton_3->setIcon(style->standardIcon(QStyle::SP_DialogCancelButton, 0, this));
SetLabelTexts();
GenerateQR();
}
示例15: initialise
//#---------------------------------------------------------------------------#
//#------- PRIVATE -----------------------------------------------------------#
//#---------------------------------------------------------------------------#
void EditRelationName::initialise()
{
QStyle* style = QApplication::style();
QIcon icon = style->standardIcon(QStyle::SP_MessageBoxWarning);
ui->nameAlert->setPixmap(icon.pixmap(20,20));
QRegExp rx("([A-Za-z\\d\\_]*\\,){100}");
QValidator *validator = new QRegExpValidator(rx, this);
ui->nameEdit->setValidator(validator);
ui->nameAlert->setVisible(false);
}