本文整理汇总了C++中ToolButton::iconSize方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolButton::iconSize方法的具体用法?C++ ToolButton::iconSize怎么用?C++ ToolButton::iconSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolButton
的用法示例。
在下文中一共展示了ToolButton::iconSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: col
TitleWidget::TitleWidget(QWidget *p)
: QWidget(p)
, controls(0)
{
QGridLayout *layout=new QGridLayout(this);
QVBoxLayout *textLayout=new QVBoxLayout(0);
image=new QLabel(this);
mainText=new SqueezedTextLabel(this);
subText=new SqueezedTextLabel(this);
QLabel *chevron=new QLabel(QChar(Qt::RightToLeft==layoutDirection() ? 0x203A : 0x2039), this);
QFont f=mainText->font();
subText->setFont(Utils::smallFont(f));
mainText->setFont(f);
if (f.pixelSize()>0) {
f.setPixelSize(f.pixelSize()*2);
} else {
f.setPointSizeF(f.pointSizeF()*2);
}
QPalette pal=mainText->palette();
QColor col(mainText->palette().windowText().color());
col.setAlphaF(0.5);
pal.setColor(QPalette::WindowText, col);
subText->setPalette(pal);
chevron->setFont(f);
int spacing=Utils::layoutSpacing(this);
mainText->ensurePolished();
subText->ensurePolished();
int size=mainText->sizeHint().height()+subText->sizeHint().height()+spacing;
if (size<72) {
size=Icon::stdSize(size);
}
int margin=Utils::scaleForDpi(2);
int pad=Utils::scaleForDpi(8);
size=qMax(qMax(size, QFontMetrics(mainText->font()).height()+QFontMetrics(subText->font()).height()+spacing), Utils::scaleForDpi(40))+pad;
image->setFixedSize(size, size);
setToolTip(i18n("Click to go back"));
spacing=qMin(4, spacing-1);
layout->addItem(new QSpacerItem(spacing, spacing), 0, 0, 2, 1);
layout->addWidget(chevron, 0, 1, 2, 1);
layout->addWidget(image, 0, 2, 2, 1);
textLayout->addWidget(mainText);
textLayout->addWidget(subText);
layout->addItem(textLayout, 0, 3, 2, 1);
mainText->installEventFilter(this);
subText->installEventFilter(this);
image->installEventFilter(this);
installEventFilter(this);
setAttribute(Qt::WA_Hover);
connect(Covers::self(), SIGNAL(cover(Song,QImage,QString)), this, SLOT(coverRetrieved(Song,QImage,QString)));
connect(Covers::self(), SIGNAL(coverUpdated(Song,QImage,QString)), this, SLOT(coverRetrieved(Song,QImage,QString)));
connect(Covers::self(), SIGNAL(artistImage(Song,QImage,QString)), this, SLOT(coverRetrieved(Song,QImage,QString)));
layout->setMargin(margin);
layout->setSpacing(spacing);
textLayout->setMargin(0);
textLayout->setSpacing(spacing);
mainText->setAlignment(Qt::AlignBottom);
subText->setAlignment(Qt::AlignTop);
image->setAlignment(Qt::AlignCenter);
chevron->setAlignment(Qt::AlignCenter);
chevron->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
if (-1==twHeight) {
ToolButton tb;
twHeight=qMax((tb.iconSize().height()*2)+pad, size)+(2*margin);
}
setFixedHeight(twHeight);
}