本文整理汇总了C++中iconSize函数的典型用法代码示例。如果您正苦于以下问题:C++ iconSize函数的具体用法?C++ iconSize怎么用?C++ iconSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iconSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vectorLayerSymbologyV2
void QgsLegendLayer::refreshSymbology( const QString& key )
{
QgsMapLayer* theMapLayer = QgsMapLayerRegistry::instance()->mapLayer( key );
if ( !theMapLayer )
{
return;
}
if ( theMapLayer->type() == QgsMapLayer::VectorLayer ) // VECTOR
{
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( theMapLayer );
vectorLayerSymbologyV2( vlayer );
}
else if ( theMapLayer->type() == QgsMapLayer::RasterLayer ) // RASTER
{
QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer *>( theMapLayer );
rasterLayerSymbology( rlayer ); // get and change symbology
}
else if ( theMapLayer->type() == QgsMapLayer::PluginLayer )
{
QgsPluginLayer* player = qobject_cast<QgsPluginLayer *>( theMapLayer );
QSize iconSize( 16, 16 );
SymbologyList itemList = player->legendSymbologyItems( iconSize );
changeSymbologySettings( theMapLayer, itemList );
}
updateIcon();
}
示例2: pix
QIcon QgsPenStyleComboBox::iconForPen( Qt::PenStyle style )
{
QPixmap pix( iconSize() );
QPainter p;
pix.fill( Qt::transparent );
p.begin( &pix );
QPen pen( style );
pen.setWidth( 2 );
p.setPen( pen );
double mid = iconSize().height() / 2.0;
p.drawLine( 0, mid, iconSize().width(), mid );
p.end();
return QIcon( pix );
}
示例3: QLabel
void MainWindow::setupFindToolBar()
{
m_findToolBar->setObjectName("FindToolBar");
m_findToolBar->setVisible(false);
QLabel* findLabel = new QLabel("Find Text: ");
m_findLineEdit = new QLineEdit();
m_findLineEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_findLineEdit->setFocusPolicy(Qt::ClickFocus);
connect(m_findLineEdit, SIGNAL(textChanged(const QString&)),
this, SLOT(setFindText(const QString&)));
//add a spacer
QWidget* spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
//set the size of the buttons and the icon based on the height of the line edit
QSize buttonSize(m_findLineEdit->sizeHint().height()-4, m_findLineEdit->sizeHint().height()-4);
QSize iconSize(m_findLineEdit->sizeHint().height()-8, m_findLineEdit->sizeHint().height()-8);
QPushButton* closeButton = new QPushButton(QIcon(QString("icons/stop.png")), "");
closeButton->setToolTip("Close the find toolbar");
closeButton->setFlat(true);
closeButton->setFixedSize(buttonSize);
closeButton->setIconSize(iconSize);
closeButton->setFocusPolicy(Qt::ClickFocus);
connect(closeButton, SIGNAL(released()), this, SLOT(closeFindToolBar()));
m_findToolBar->addWidget(findLabel);
m_findToolBar->addWidget(m_findLineEdit);
m_findToolBar->addWidget(spacer);
m_findToolBar->addWidget(closeButton);
}
示例4: iconSize
QSize
AnimatedBarWidget::sizeHint() const
{
QSize size = QAbstractButton::sizeHint();
size.setHeight( iconSize().height() + 8 );
return size;
}
示例5: icon
void ElidingButton::elideText( const QSize &widgetSize )
{
const int width = widgetSize.width();
const int iconWidth = icon().isNull() ? 0 : iconSize().width();
int left, top, right, bottom;
getContentsMargins( &left, &top, &right, &bottom );
int padding = left + right + 4;
int textWidth = width - ( iconWidth + padding );
QFontMetrics fm( font() );
QString elidedText = fm.elidedText( m_fullText, Qt::ElideRight, textWidth );
QPushButton::setText( elidedText );
bool elided = ( elidedText != m_fullText );
// If there is no tooltip set, then we set it to be the full text when elided,
// and clear it if the button is no longer elided.
const QString tip = toolTip();
if( elided && tip.isEmpty() )
setToolTip( m_fullText );
else if( !elided && tip == m_fullText )
setToolTip( QString() );
if( elided )
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
else
setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Fixed );
if( m_isElided != elided )
{
m_isElided = elided;
emit( sizePolicyChanged() );
}
}
示例6: currentItem
void ResourceListWidget::startDrag(Qt::DropActions supportedActions)
{
if (supportedActions == Qt::MoveAction)
return;
QListWidgetItem *item = currentItem();
if (!item)
return;
const QString filePath = item->data(Qt::UserRole).toString();
const QIcon icon = item->icon();
QMimeData *mimeData = new QMimeData;
const QtResourceView::ResourceType type = icon.isNull() ? QtResourceView::ResourceOther : QtResourceView::ResourceImage;
mimeData->setText(QtResourceView::encodeMimeData(type , filePath));
QDrag *drag = new QDrag(this);
if (!icon.isNull()) {
const QSize size = icon.actualSize(iconSize());
drag->setPixmap(icon.pixmap(size));
drag->setHotSpot(QPoint(size.width() / 2, size.height() / 2));
}
drag->setMimeData(mimeData);
drag->exec(Qt::CopyAction);
}
示例7: paint
void paint(QPainter * painter,
const QStyleOptionGraphicsItem * option, QWidget * widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
// BasicWidget::paint(painter, option, widget);
if (iconInSvg().isValid()) {
QRectF iconRect = QRectF(QPointF(), iconSize());
QSizeF sizeDiff = size() - iconRect.size();
iconRect.setTopLeft(QPointF(sizeDiff.width() / 2, sizeDiff.height() / 2));
if (animate) {
iconInSvg().paint(painter,
iconRect.left(),
iconRect.top(),
"frame" + QString::number(frame));
} else {
iconInSvg().paint(painter,
iconRect.left(),
iconRect.top(),
"frame" + QString::number(
(frame > 0) ? frameCount : 0
));
}
}
}
示例8: size
void pDockWidgetTitleBar::updateStandardIcons()
{
const QSize size( 16, 16 );
QPixmap pixmap;
QRect rect( QPoint(), iconSize() );
QTransform transform;
transform.rotate( 90 );
pixmap = style()->standardIcon( QStyle::SP_ToolBarHorizontalExtensionButton, 0, widgetForAction( aOrientation ) ).pixmap( size );
rect.moveCenter( pixmap.rect().center() );
pixmap = pixmap.copy( rect );
pixmap = pixmap.transformed( transform, Qt::SmoothTransformation );
aOrientation->setIcon( pixmap );
pixmap = style()->standardIcon( QStyle::SP_TitleBarNormalButton, 0, widgetForAction( aFloat ) ).pixmap( size );
rect.moveCenter( pixmap.rect().center() );
pixmap = pixmap.copy( rect );
aFloat->setIcon( pixmap );
pixmap = style()->standardIcon( QStyle::SP_TitleBarCloseButton, 0, widgetForAction( aClose ) ).pixmap( size );
rect.moveCenter( pixmap.rect().center() );
pixmap = pixmap.copy( rect );
aClose->setIcon( pixmap );
}
示例9: Q_D
/*!
Initialize \a option with the values from this QPushButton. This method is useful
for subclasses when they need a QStyleOptionButton, but don't want to fill
in all the information themselves.
\sa QStyleOption::initFrom()
*/
void QPushButton::initStyleOption(QStyleOptionButton *option) const
{
if (!option)
return;
Q_D(const QPushButton);
option->initFrom(this);
option->features = QStyleOptionButton::None;
if (d->flat)
option->features |= QStyleOptionButton::Flat;
#ifndef QT_NO_MENU
if (d->menu)
option->features |= QStyleOptionButton::HasMenu;
#endif
if (autoDefault())
option->features |= QStyleOptionButton::AutoDefaultButton;
if (d->defaultButton)
option->features |= QStyleOptionButton::DefaultButton;
if (d->down || d->menuOpen)
option->state |= QStyle::State_Sunken;
if (d->checked)
option->state |= QStyle::State_On;
if (!d->flat && !d->down)
option->state |= QStyle::State_Raised;
option->text = d->text;
option->icon = d->icon;
option->iconSize = iconSize();
}
示例10: mouseMoveEvent
void RListWidget::mouseMoveEvent(QMouseEvent* e) {
if (e->x()-iconOffset < iconSize().width()) {
} else {
e->ignore();
QListWidget::mouseMoveEvent(e);
}
}
示例11: visualRect
QModelIndex FolderViewListView::indexAt(const QPoint& point) const {
QModelIndex index = QListView::indexAt(point);
// NOTE: QListView has a severe design flaw here. It does hit-testing based on the
// total bound rect of the item. The width of an item is determined by max(icon_width, text_width).
// So if the text label is much wider than the icon, when you click outside the icon but
// the point is still within the outer bound rect, the item is still selected.
// This results in very poor usability. Let's do precise hit-testing here.
// An item is hit only when the point is in the icon or text label.
// If the point is in the bound rectangle but outside the icon or text, it should not be selected.
if(viewMode() == QListView::IconMode && index.isValid()) {
// FIXME: this hack only improves the usability partially. We still need more precise sizeHint handling.
// FolderItemDelegate* delegate = static_cast<FolderItemDelegate*>(itemDelegateForColumn(FolderModel::ColumnFileName));
// Q_ASSERT(delegate != NULL);
// We use the grid size - (2, 2) as the size of the bounding rectangle of the whole item.
// The width of the text label hence is gridSize.width - 2, and the width and height of the icon is from iconSize().
QRect visRect = visualRect(index); // visibal area on the screen
QSize itemSize = gridSize();
itemSize.setWidth(itemSize.width() - 2);
itemSize.setHeight(itemSize.height() - 2);
QSize _iconSize = iconSize();
int textHeight = itemSize.height() - _iconSize.height();
if(point.y() < visRect.bottom() - textHeight) {
// the point is in the icon area, not over the text label
int iconXMargin = (itemSize.width() - _iconSize.width()) / 2;
if(point.x() < (visRect.left() + iconXMargin) || point.x() > (visRect.right() - iconXMargin))
return QModelIndex();
}
// qDebug() << "visualRect: " << visRect << "point:" << point;
}
return index;
}
示例12: qt_static_metacall
int QTabBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 8)
qt_static_metacall(this, _c, _id, _a);
_id -= 8;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< Shape*>(_v) = shape(); break;
case 1: *reinterpret_cast< int*>(_v) = currentIndex(); break;
case 2: *reinterpret_cast< int*>(_v) = count(); break;
case 3: *reinterpret_cast< bool*>(_v) = drawBase(); break;
case 4: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
case 5: *reinterpret_cast< Qt::TextElideMode*>(_v) = elideMode(); break;
case 6: *reinterpret_cast< bool*>(_v) = usesScrollButtons(); break;
case 7: *reinterpret_cast< bool*>(_v) = tabsClosable(); break;
case 8: *reinterpret_cast< SelectionBehavior*>(_v) = selectionBehaviorOnRemove(); break;
case 9: *reinterpret_cast< bool*>(_v) = expanding(); break;
case 10: *reinterpret_cast< bool*>(_v) = isMovable(); break;
case 11: *reinterpret_cast< bool*>(_v) = documentMode(); break;
}
_id -= 12;
} else if (_c == QMetaObject::WriteProperty) {
void *_v = _a[0];
switch (_id) {
case 0: setShape(*reinterpret_cast< Shape*>(_v)); break;
case 1: setCurrentIndex(*reinterpret_cast< int*>(_v)); break;
case 3: setDrawBase(*reinterpret_cast< bool*>(_v)); break;
case 4: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
case 5: setElideMode(*reinterpret_cast< Qt::TextElideMode*>(_v)); break;
case 6: setUsesScrollButtons(*reinterpret_cast< bool*>(_v)); break;
case 7: setTabsClosable(*reinterpret_cast< bool*>(_v)); break;
case 8: setSelectionBehaviorOnRemove(*reinterpret_cast< SelectionBehavior*>(_v)); break;
case 9: setExpanding(*reinterpret_cast< bool*>(_v)); break;
case 10: setMovable(*reinterpret_cast< bool*>(_v)); break;
case 11: setDocumentMode(*reinterpret_cast< bool*>(_v)); break;
}
_id -= 12;
} else if (_c == QMetaObject::ResetProperty) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 12;
}
#endif // QT_NO_PROPERTIES
return _id;
}
示例13: text
QStyleOptionButton OrientationButton::getStyleOption() const
{
QStyleOptionButton opt;
opt.initFrom(this);
if (orientation_ == Qt::Vertical)
{
QSize size = opt.rect.size();
size.transpose();
opt.rect.setSize(size);
}
opt.features = QStyleOptionButton::None;
if (isFlat())
opt.features |= QStyleOptionButton::Flat;
if (menu())
opt.features |= QStyleOptionButton::HasMenu;
if (autoDefault() || isDefault())
opt.features |= QStyleOptionButton::AutoDefaultButton;
if (isDefault())
opt.features |= QStyleOptionButton::DefaultButton;
if (isDown() || (menu() && menu()->isVisible()))
opt.state |= QStyle::State_Sunken;
if (isChecked())
opt.state |= QStyle::State_On;
if (!isFlat() && !isDown())
opt.state |= QStyle::State_Raised;
opt.text = text();
opt.icon = icon();
opt.iconSize = iconSize();
return opt;
}
示例14: GcodeEdit
void MainWindow::creatbuttons()
{
textTop=new GcodeEdit(0);
textBottom=new QPlainTextEdit(0);
load=new QPushButton(QString::fromLocal8Bit("载入"),0);
//count=new QPushButton(QObject::tr("count"),0);
count=new QPushButton(QString::fromLocal8Bit("计数"),0);
simulation=new QPushButton(QString::fromLocal8Bit("仿真"),0);
send=new QPushButton(QString::fromLocal8Bit("发送"),0);
finish=new QPushButton(QString::fromLocal8Bit("结束"),0);
compiler=new QPushButton(QString::fromLocal8Bit("编译"),0);
QSize iconSize(4,4);
zoomInIcon = new QToolButton;
zoomInIcon->setAutoRepeat(true);
zoomInIcon->setAutoRepeatInterval(33);
zoomInIcon->setAutoRepeatDelay(0);
//zoomInIcon->setIcon(QPixmap("images//zoomin.png"));
//zoomInIcon->setIconSize(QPixmap( "images//zoomin.png").size());
zoomOutIcon = new QToolButton;
zoomOutIcon->setAutoRepeat(true);
zoomOutIcon->setAutoRepeatInterval(33);
zoomOutIcon->setAutoRepeatDelay(0);
// zoomOutIcon->setIcon(QPixmap(":/File/zoomout.png"));
//zoomOutIcon->setIconSize(QPixmap("/File/zoomin.png").size());
zoomSlider = new QSlider;
zoomSlider->setMinimum(0);
zoomSlider->setMaximum(500);
zoomSlider->setValue(250);
zoomSlider->setTickPosition(QSlider::TicksRight);
// Zoom slider layout
QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
zoomSliderLayout->addWidget(zoomInIcon);
zoomSliderLayout->addWidget(zoomSlider);
zoomSliderLayout->addWidget(zoomOutIcon);
zoomwidget=new QWidget();
zoomwidget->setLayout(zoomSliderLayout);
//zoom in out
selectGroup = new QGroupBox(0);
// selectGroup->setTitle(tr("select"));
selectGroup->setTitle(QString::fromLocal8Bit("选择"));
zhengjiaoType = new QRadioButton(selectGroup);
zuijinType = new QRadioButton(selectGroup);
zidingyiType= new QRadioButton(selectGroup);
zhengjiaoType->setText(QString::fromLocal8Bit("正交"));
zuijinType->setText(QString::fromLocal8Bit("最近点选择"));
zidingyiType->setText(QString::fromLocal8Bit("自定义"));
selectGroup->adjustSize();
zhengjiaoType->setChecked(true);
QVBoxLayout *vbox=new QVBoxLayout;
vbox->addWidget(zhengjiaoType);
vbox->addWidget(zuijinType);
vbox->addWidget(zidingyiType);
selectGroup->setLayout(vbox);
}
示例15: QSize
QSize Tab::sizeHint() const
{
if (icon().isNull()) {
return FlatButton::sizeHint();
} else {
return QSize(40, iconSize().height() + 46);
}
}