本文整理汇总了C++中QToolButton::setFixedSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::setFixedSize方法的具体用法?C++ QToolButton::setFixedSize怎么用?C++ QToolButton::setFixedSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::setFixedSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: d
// ------------------
// HintProposalWidget
// ------------------
FunctionHintProposalWidget::FunctionHintProposalWidget()
: d(new FunctionHintProposalWidgetPrivate)
{
QToolButton *downArrow = new QToolButton;
downArrow->setArrowType(Qt::DownArrow);
downArrow->setFixedSize(16, 16);
downArrow->setAutoRaise(true);
QToolButton *upArrow = new QToolButton;
upArrow->setArrowType(Qt::UpArrow);
upArrow->setFixedSize(16, 16);
upArrow->setAutoRaise(true);
QHBoxLayout *pagerLayout = new QHBoxLayout(d->m_pager);
pagerLayout->setMargin(0);
pagerLayout->setSpacing(0);
pagerLayout->addWidget(upArrow);
pagerLayout->addWidget(d->m_numberLabel);
pagerLayout->addWidget(downArrow);
QHBoxLayout *popupLayout = new QHBoxLayout(d->m_popupFrame);
popupLayout->setMargin(0);
popupLayout->setSpacing(0);
popupLayout->addWidget(d->m_pager);
popupLayout->addWidget(d->m_hintLabel);
connect(upArrow, SIGNAL(clicked()), SLOT(previousPage()));
connect(downArrow, SIGNAL(clicked()), SLOT(nextPage()));
qApp->installEventFilter(this);
setFocusPolicy(Qt::NoFocus);
}
示例2: InitTitleBar
void FramelessDlg::InitTitleBar()
{
QVBoxLayout* layout = qobject_cast<QVBoxLayout*>(this->layout());
m_closeBtn = new QToolButton(this);
QToolButton* minBtn = new QToolButton(this);
QToolButton* menuBtn = new QToolButton(this);
m_subTitle = new QLabel(this);
m_subTitle->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
m_closeBtn->setObjectName("closeBtn");
minBtn->setObjectName("minBtn");
menuBtn->setObjectName("menuBtn");
m_subTitle->setObjectName("subTitle");
menuBtn->setPopupMode(QToolButton::InstantPopup);
m_menu = new QMenu(this);
menuBtn->setMenu(m_menu);
m_closeBtn->setFixedSize(27, 22);
minBtn->setFixedSize(27, 22);
menuBtn->setFixedSize(27, 22);
m_subTitle->setFixedSize(400, 25);
connect(m_closeBtn, SIGNAL(clicked()), this, SLOT(reject()));
connect(m_closeBtn, SIGNAL(clicked()), this, SLOT(close()));
connect(minBtn, SIGNAL(clicked()), this, SLOT(showMinimized()));
QFrame* tb = new QFrame(this);
tb->setObjectName("titleBar");
QHBoxLayout* tbLayout = new QHBoxLayout;
m_title = new QLabel(this);
m_title->setObjectName("label_title");
m_title->setFixedSize(300, 25);
tbLayout->addWidget(m_title);
tbLayout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Expanding, QSizePolicy::Fixed));
if ( m_flag & SUB_TITLE )
tbLayout->addWidget(m_subTitle);
if ( m_flag & MENU_BUTTON )
tbLayout->addWidget(menuBtn);
if ( m_flag & MIN_BUTTON )
tbLayout->addWidget(minBtn);
if ( m_flag & CLOSE_BUTTON )
tbLayout->addWidget(m_closeBtn);
tb->setLayout(tbLayout);
layout->addWidget(tb);
}
示例3: createExtensionsTab
void KgGeneral::createExtensionsTab()
{
// ------------------------- atomic extensions ----------------------------------
QWidget *tab = createTab(i18n("Atomic extensions"));
QGridLayout *tabLayout = new QGridLayout(tab);
tabLayout->setSpacing(6);
tabLayout->setContentsMargins(11, 11, 11, 11);
QWidget * vboxWidget2 = new QWidget(tab);
tabLayout->addWidget(vboxWidget2);
QVBoxLayout * vbox2 = new QVBoxLayout(vboxWidget2);
QWidget * hboxWidget3 = new QWidget(vboxWidget2);
vbox2->addWidget(hboxWidget3);
QHBoxLayout * hbox3 = new QHBoxLayout(hboxWidget3);
QLabel * atomLabel = new QLabel(i18n("Atomic extensions:"), hboxWidget3);
hbox3->addWidget(atomLabel);
int size = QFontMetrics(atomLabel->font()).height();
QToolButton *addButton = new QToolButton(hboxWidget3);
hbox3->addWidget(addButton);
QPixmap icon = krLoader->loadIcon("list-add", KIconLoader::Desktop, size);
addButton->setFixedSize(icon.width() + 4, icon.height() + 4);
addButton->setIcon(QIcon(icon));
connect(addButton, SIGNAL(clicked()), this, SLOT(slotAddExtension()));
QToolButton *removeButton = new QToolButton(hboxWidget3);
hbox3->addWidget(removeButton);
icon = krLoader->loadIcon("list-remove", KIconLoader::Desktop, size);
removeButton->setFixedSize(icon.width() + 4, icon.height() + 4);
removeButton->setIcon(QIcon(icon));
connect(removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveExtension()));
QStringList defaultAtomicExtensions;
defaultAtomicExtensions += ".tar.gz";
defaultAtomicExtensions += ".tar.bz2";
defaultAtomicExtensions += ".tar.lzma";
defaultAtomicExtensions += ".tar.xz";
defaultAtomicExtensions += ".moc.cpp";
listBox = createListBox("Look&Feel", "Atomic Extensions",
defaultAtomicExtensions, vboxWidget2, true, PAGE_EXTENSIONS);
vbox2->addWidget(listBox);
}
示例4: QWidget
VESPERSBeamSelectorView::VESPERSBeamSelectorView(QWidget *parent)
: QWidget(parent)
{
currentBeam_ = 0;
beams_ = new QButtonGroup;
QToolButton *temp = new QToolButton;
temp->setText("Pink");
temp->setFixedSize(35, 22);
temp->setCheckable(true);
beams_->addButton(temp, 0);
temp = new QToolButton;
temp->setText("10%");
temp->setFixedSize(35, 22);
temp->setCheckable(true);
beams_->addButton(temp, 1);
temp = new QToolButton;
temp->setText("1.6%");
temp->setFixedSize(35, 22);
temp->setCheckable(true);
beams_->addButton(temp, 2);
temp = new QToolButton;
temp->setText("Si");
temp->setFixedSize(35, 22);
temp->setCheckable(true);
beams_->addButton(temp, 3);
connect(beams_, SIGNAL(buttonClicked(int)), this, SLOT(changeBeam(int)));
connect(VESPERSBeamline::vespers(), SIGNAL(currentBeamChanged(VESPERS::Beam)), this, SLOT(onCurrentBeamChanged(VESPERS::Beam)));
progressBar_ = new QProgressBar;
progressBar_->hide();
progressBar_->setRange(0, 100);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addWidget(beams_->button(0));
buttonsLayout->addWidget(beams_->button(1));
buttonsLayout->addWidget(beams_->button(2));
buttonsLayout->addWidget(beams_->button(3));
QVBoxLayout *beamSelectorLayout = new QVBoxLayout;
beamSelectorLayout->addLayout(buttonsLayout);
beamSelectorLayout->addWidget(progressBar_);
setLayout(beamSelectorLayout);
}
示例5: clearIcon
dtkSearchField::dtkSearchField(QWidget *parent) : QWidget(parent)
{
QLineEdit *lineEdit = new QLineEdit(this);
connect(lineEdit, SIGNAL(textChanged(QString)),
this, SIGNAL(textChanged(QString)));
connect(lineEdit, SIGNAL(editingFinished()),
this, SIGNAL(editingFinished()));
connect(lineEdit, SIGNAL(textChanged(QString)),
this, SLOT(setText(QString)));
QToolButton *clearButton = new QToolButton(this);
QPixmap clearIcon(QString(":/Qocoa/qsearchfield_nonmac.png"));
clearButton->setIcon(QIcon(clearIcon));
clearButton->setIconSize(clearIcon.size());
clearButton->setFixedSize(clearIcon.size());
clearButton->setStyleSheet("border: none;");
clearButton->hide();
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
d = new dtkSearchFieldPrivate(this, lineEdit, clearButton);
lineEdit->setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(d->clearButtonPaddedWidth()));
const int width = qMax(lineEdit->minimumSizeHint().width(), d->clearButtonPaddedWidth());
const int height = qMax(lineEdit->minimumSizeHint().height(), d->clearButtonPaddedHeight());
lineEdit->setMinimumSize(width, height);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->addWidget(lineEdit);
}
示例6: AppendDecisionBtn
void FreyaMessageDialog::AppendDecisionBtn(const QString &name, const FreyaBaseData &freyaData)
{
QToolButton *decisionBtn = new QToolButton(this);
decisionBtn->setObjectName("MsgDecBtn");
decisionBtn->setText(name);
decisionBtn->setFixedSize(80, 26);
m_BtnHLay->addWidget(decisionBtn);
connect(decisionBtn, SIGNAL(clicked()), this, SLOT(OnDecisionBtnClicked()));
m_DecisionBtnMap.insert(decisionBtn, freyaData);
}
示例7: icon
PreviewDialog::PreviewDialog(QWidget *parent) : DragWidget(parent)
{
m_borderImage = false;
setAutoFillBackground(true);
m_label = new PreviewLabel(this);
m_slider = new QSlider(this);
m_zoomLabel = new QLabel(this);
setZoom(1);
QVBoxLayout *layout = new QVBoxLayout(this);
QHBoxLayout *horizontalLayout = new QHBoxLayout();
QHBoxLayout *horizontalLayout2 = new QHBoxLayout();
layout->setMargin(0);
layout->setContentsMargins(2, 2, 2, 16);
layout->setSpacing(4);
QToolButton *toolButton = new QToolButton(this);
QIcon icon(style()->standardIcon(QStyle::SP_DockWidgetCloseButton));
toolButton->setIcon(icon);
toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
toolButton->setFixedSize(icon.availableSizes().value(0) + QSize(4, 4));
connect(toolButton, SIGNAL(clicked()), this, SLOT(onTogglePane()));
QScrollArea *scrollArea = new QScrollArea(this);
WheelFilter *wheelFilter = new WheelFilter(scrollArea);
scrollArea->setWidget(m_label);
scrollArea->setFrameStyle(QFrame::NoFrame);
m_slider->setOrientation(Qt::Horizontal);
m_slider->setRange(1, 6);
m_slider->setFixedWidth(80);
m_zoomLabel->setFixedWidth(50);
horizontalLayout->addWidget(toolButton);
horizontalLayout->addSpacing(6);
horizontalLayout->addWidget(m_slider);
horizontalLayout->addSpacing(6);
horizontalLayout->addWidget(m_zoomLabel);
horizontalLayout->addStretch(1);
layout->addLayout(horizontalLayout);
horizontalLayout2->addSpacing(24);
horizontalLayout2->addWidget(scrollArea);
layout->addLayout(horizontalLayout2);
wheelFilter->setTarget(this);
connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(onSliderMoved(int)));
foreach (QWidget *childWidget, findChildren<QWidget*>()) {
childWidget->installEventFilter(wheelFilter);
}
示例8: QToolButton
QT_BEGIN_NAMESPACE
static QToolButton *createToolButton(QWidget *parent, Qt::ArrowType at, const QString &name) {
QToolButton *rc = new QToolButton();
rc->setAttribute(Qt::WA_NoChildEventsForParent, true);
rc->setParent(parent);
rc->setObjectName(name);
rc->setArrowType(at);
rc->setAutoRaise(true);
rc->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
rc->setFixedSize(QSize(15, 15));
return rc;
}
示例9: addLocation
void GlobStore::addLocation()
{
QAction* storeAction = new QAction(tr("&Store"), this);
QToolButton *storeButton = new QToolButton;
storeButton->setDefaultAction(storeAction);
storeButton->setFixedSize(15, 25);
storeAction->setIcon(QPixmap(filesave_xpm));
connect(storeAction, SIGNAL(triggered()), storeSignalMapper, SLOT(map()));
storeSignalMapper->setMapping(storeAction, widgetList.count());
QAction* restoreAction = new QAction(tr("&Restore"), this);
QToolButton *restoreButton = new QToolButton;
restoreButton->setDefaultAction(restoreAction);
restoreButton->setFixedSize(45, 25);
restoreAction->setText(QString::number(widgetList.count() + 1));
restoreButton->setStyleSheet("font: 18pt");
restoreAction->setDisabled(true);
restoreAction->setObjectName("-1");
restoreAction->setProperty("index", widgetList.count() + 1);
connect(restoreAction, SIGNAL(triggered()), this, SLOT(mapRestoreSignal()));
QWidget* globWidget = new QWidget;
QHBoxLayout* globLayout = new QHBoxLayout;
globLayout->setSpacing(0);
globLayout->setMargin(0);
globLayout->addWidget(storeButton);
globLayout->addWidget(restoreButton);
globWidget->setLayout(globLayout);
indivButtonLayout->itemAt(0)->layout()->itemAt(0)->layout()->addWidget(globWidget);
if (widgetList.count()) {
widgetList.last()->layout()->itemAt(1)->widget()->setEnabled(true);
}
widgetList.append(globWidget);
modified = true;
}
示例10: showEvent
void FreyaMessageDialog::showEvent(QShowEvent *e)
{
if(m_BtnHLay->count() == 0)
{
QToolButton *tempOKBtn = new QToolButton(this);
tempOKBtn->setObjectName("MessageOKBtn");
tempOKBtn->setFixedSize(80, 26);
tempOKBtn->setText(tr("OK"));
m_BtnHLay->addWidget(tempOKBtn);
connect(tempOKBtn, SIGNAL(clicked()), this, SLOT(accept()));
}
resize(qMax(m_BtnHLay->minimumSize().width(), m_ContentLab->width()) + 20,
m_ContentLab->height() + 60);
FreyaBackWindow::showEvent(e);
}
示例11: setupUi
void SugarDialog::setupUi()
{
m_signalMapper = new QSignalMapper(this);
connect(m_signalMapper, SIGNAL(mapped(int)), SLOT(setValue(int)));
QToolButton* withoutSugarButton = new QToolButton;
withoutSugarButton->setFixedSize(100, 100);
withoutSugarButton->setText(tr("Without Sugar"));
connect(withoutSugarButton, SIGNAL(clicked()), m_signalMapper, SLOT(map()));
QToolButton* lessSugarButton = new QToolButton;
lessSugarButton->setFixedSize(100, 100);
lessSugarButton->setText(tr("Little Sugar"));
connect(lessSugarButton, SIGNAL(clicked()), m_signalMapper, SLOT(map()));
QToolButton* normalSugarButton = new QToolButton;
normalSugarButton->setFixedSize(100, 100);
normalSugarButton->setText(tr("Normal Sugar"));
connect(normalSugarButton, SIGNAL(clicked()), m_signalMapper, SLOT(map()));
QToolButton* moreSugarButton = new QToolButton;
moreSugarButton->setFixedSize(100, 100);
moreSugarButton->setText(tr("Much Sugar"));
connect(moreSugarButton, SIGNAL(clicked()), m_signalMapper, SLOT(map()));
m_signalMapper->setMapping(withoutSugarButton, Model::Sugar::WithoutSugar);
m_signalMapper->setMapping(lessSugarButton, Model::Sugar::LessSugar);
m_signalMapper->setMapping(normalSugarButton, Model::Sugar::NormalSugar);
m_signalMapper->setMapping(moreSugarButton, Model::Sugar::MoreSugar);
QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(withoutSugarButton);
layout->addWidget(lessSugarButton);
layout->addWidget(normalSugarButton);
layout->addWidget(moreSugarButton);
}
示例12: showNextThumbnails
void Widget::showNextThumbnails()
{
int viewersize = viewer.size();
if (thumbnailIndex >= viewersize) {
thumbnailIndex = 0;
} else {
if ((thumbnailIndex + 5) >= viewersize)
thumbnailIndex = 0;
else
thumbnailIndex += 5;
}
currentImages = viewer.getImageList(thumbnailIndex, 5);
QPixmap pixmap;
QToolButton *button;
const Image *image;
QLayoutItem *child;
while ((child = ui->frameThumnailArea->layout()->takeAt(0)) != 0) {
delete child->widget();
}
for (int j = 0; j < currentImages.size(); ++j) {
image = currentImages.at(j);
pixmap = image->getThumbnailPixmap();
button = new QToolButton;
button->setFixedSize(pixmap.size());
button->setAccessibleName(QString::number(j));
button->setAccessibleDescription(image->getPathString());
button->setIcon(pixmap);
button->setIconSize(pixmap.size());
button->setAutoRaise(true);
connect(button, SIGNAL(clicked()),&signalMapper, SLOT(map()));
signalMapper.setMapping(static_cast<QObject *>(button), static_cast<QObject *>(button));
ui->frameThumnailArea->layout()->addWidget(button);
}
currentIndex = 0;
image = currentImages.at(currentIndex);
QString path = image->getPathString();
pixmap = QPixmap(path).scaled(400, 300, Qt::KeepAspectRatio);
currentImage->setPixmap(pixmap);
}
示例13: url
QToolButton * FilterItemWidget::createDeleteButton()
{
QToolButton * deleteBtn = new QToolButton;
deleteBtn->setFixedSize(16,16);
deleteBtn->setStyleSheet("QToolButton { "
"border: none; "
"padding: 0px; "
"background: url(:/icons/close) center center no-repeat;"
"}"
"QToolButton:hover {"
"background: url(:/icons/close_hover) center center no-repeat;"
"}"
"QToolButton:pressed {"
"background: url(:/icons/close_pressed) center center no-repeat;"
"}");
deleteBtn->setToolButtonStyle(Qt::ToolButtonIconOnly);
deleteBtn->setToolTip(tr("Remove criterion"));
return deleteBtn;
}
示例14: newToolButton
QToolButton* MenuToolWidget::newToolButton(const QPixmap& icon, QString strToolTip)
{
QToolButton* toolButton = new QToolButton(this);
toolButton->setAutoRaise(true);
toolButton->setIconSize( QSize(55,55) );
toolButton->setFixedSize(55, 55);
toolButton->setIcon(icon);
toolButton->setStyleSheet("background:transparent;");
// toolButton->setMask(icon.createHeuristicMask());
toolButton->setToolTip(strToolTip);
// toolButton->setStyleSheet("QToolButton{min-height:20;border-style:solid;border-top-left-radius:2px;"
// "border-top-right-radius:2px;""border:2px groove gray;border-radius:10px;padding:2px 4px;"
// "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241), "
// "stop: 0.2 rgb(233,242,247),stop: 0.7 rgb(176,208,225),"
// "stop: 0.8 rgb(176,208,225),"
// "stop: 1 rgb(192,216,232));}");
return toolButton;
}
示例15: DockWindow
SelectionView::SelectionView(Gui::Document* pcDocument, QWidget *parent)
: DockWindow(pcDocument,parent)
{
setWindowTitle( tr( "Property View" ) );
QVBoxLayout* pLayout = new QVBoxLayout( this );
pLayout->setSpacing( 0 );
pLayout->setMargin ( 0 );
QLineEdit* searchBox = new QLineEdit(this);
#if QT_VERSION >= 0x040700
searchBox->setPlaceholderText( tr( "Search" ) );
#endif
searchBox->setToolTip( tr( "Searches object labels" ) );
pLayout->addWidget( searchBox );
QHBoxLayout* llayout = new QHBoxLayout(searchBox);
QToolButton* clearButton = new QToolButton(searchBox);
clearButton->setFixedSize(18, 21);
clearButton->setCursor(Qt::ArrowCursor);
clearButton->setStyleSheet(QString::fromAscii("QToolButton {margin-bottom:6px}"));
clearButton->setIcon(BitmapFactory().pixmap(":/icons/edit-cleartext.svg"));
clearButton->setToolTip( tr( "Clears the search field" ) );
llayout->addWidget(clearButton,0,Qt::AlignRight);
selectionView = new QListWidget(this);
selectionView->setContextMenuPolicy(Qt::CustomContextMenu);
pLayout->addWidget( selectionView );
resize( 200, 200 );
QObject::connect(clearButton, SIGNAL(clicked()), searchBox, SLOT(clear()));
QObject::connect(searchBox, SIGNAL(textChanged(QString)), this, SLOT(search(QString)));
QObject::connect(selectionView, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(select(QListWidgetItem*)));
QObject::connect(selectionView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onItemContextMenu(QPoint)));
Gui::Selection().Attach(this);
}