本文整理汇总了C++中QAbstractButton::setFixedSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::setFixedSize方法的具体用法?C++ QAbstractButton::setFixedSize怎么用?C++ QAbstractButton::setFixedSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::setFixedSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QToolButton
QAbstractButton *FormMultiWidget::makeButton(const QIcon &icon, const char *slot)
{
QAbstractButton *btn = new QToolButton(this);
btn->setIcon(icon);
btn->setFixedSize(icon.availableSizes().first() /* + something */);
btn->setFocusPolicy(Qt::NoFocus);
connect(btn, SIGNAL(clicked()), slot);
return btn;
}
示例2: insertCloseButton
void ComboTabBar::insertCloseButton(int index)
{
index -= pinnedTabsCount();
if (index < 0) {
return;
}
QAbstractButton* closeButton = new CloseButton(this);
closeButton->setFixedSize(closeButtonSize());
closeButton->setToolTip(m_closeButtonsToolTip);
connect(closeButton, SIGNAL(clicked()), this, SLOT(closeTabFromButton()));
m_mainTabBar->setTabButton(index, closeButtonPosition(), closeButton);
}
示例3: createWidgets
void MusicPlayer::createWidgets()
{
playButton = new QToolButton(this);
playButton->setEnabled(false);
playButton->setToolTip(tr("Play"));
playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
connect(playButton, SIGNAL(clicked()), this, SLOT(togglePlayback()));
QAbstractButton *openButton = new QToolButton(this);
openButton->setText(tr("..."));
openButton->setToolTip(tr("Open a file..."));
openButton->setFixedSize(playButton->sizeHint());
connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));
volumeButton = new VolumeButton(this);
volumeButton->setToolTip(tr("Adjust volume"));
volumeButton->setVolume(mediaPlayer.volume());
connect(volumeButton, SIGNAL(volumeChanged(int)), &mediaPlayer, SLOT(setVolume(int)));
positionSlider = new QSlider(Qt::Horizontal, this);
positionSlider->setEnabled(false);
positionSlider->setToolTip(tr("Seek"));
connect(positionSlider, SIGNAL(valueChanged(int)), this, SLOT(setPosition(int)));
infoLabel = new QLabel(this);
positionLabel = new QLabel(tr("00:00"), this);
positionLabel->setMinimumWidth(positionLabel->sizeHint().width());
QBoxLayout *controlLayout = new QHBoxLayout;
controlLayout->setMargin(0);
controlLayout->addWidget(openButton);
controlLayout->addWidget(playButton);
controlLayout->addWidget(positionSlider);
controlLayout->addWidget(positionLabel);
controlLayout->addWidget(volumeButton);
QBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(infoLabel);
mainLayout->addLayout(controlLayout);
}