本文整理汇总了C++中QToolButton::setMaximumHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::setMaximumHeight方法的具体用法?C++ QToolButton::setMaximumHeight怎么用?C++ QToolButton::setMaximumHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::setMaximumHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exec
int DriverColorsDialog::exec()
{
SeasonData &sd = SeasonData::getInstance();
colors = ColorsManager::getInstance().getDriverColors();
int i = 0;
for (; i < sd.getTeams().size(); ++i)
{
QList<LTDriver> drivers = sd.getMainDrivers(sd.getTeams()[i]);
if (drivers.size() != 2)
continue;
if ((ui->verticalLayout->count()-2) <= i)
{
QHBoxLayout *layout = new QHBoxLayout();
QLabel *label = new QLabel(this);
label->setText(QString("%1 %2").arg(drivers[0].no).arg(drivers[0].name));
label->updateGeometry();
QToolButton *button = new QToolButton(this);
button->setMaximumHeight(16);
button->setMaximumWidth(16);
setButtonColor(button, /*sd.getCarColor(sd.getTeams()[i].driver1No)*/colors[i*2]);
layout->addWidget(button);
connect(button, SIGNAL(clicked()), this, SLOT(onColorButtonClicked()));
button = new QToolButton(this);
button->setText("Reset");
button->setMaximumHeight(20);
layout->addWidget(button);
connect(button, SIGNAL(clicked()), this, SLOT(onResetButtonClicked()));
layout->addWidget(label);
//colors.append(sd.getCarColor(sd.getTeams()[i].driver1No));
// layout = new QHBoxLayout(this);
label = new QLabel(this);
label->setText(QString("%1 %2").arg(drivers[1].no).arg(drivers[1].name));
label->updateGeometry();
button = new QToolButton(this);
button->setMaximumHeight(16);
button->setMaximumWidth(16);
setButtonColor(button, /*sd.getCarColor(sd.getTeams()[i].driver2No)*/colors[i*2+1]);
layout->addWidget(button);
connect(button, SIGNAL(clicked()), this, SLOT(onColorButtonClicked()));
button = new QToolButton(this);
button->setText("Reset");
button->setMaximumHeight(20);
layout->addWidget(button);
connect(button, SIGNAL(clicked()), this, SLOT(onResetButtonClicked()));
layout->addWidget(label);
//colors.append(sd.getCarColor(sd.getTeams()[i].driver2No));
ui->verticalLayout->insertLayout(ui->verticalLayout->count() - 2, layout);
}
else
{
QHBoxLayout *layout = static_cast<QHBoxLayout*>(ui->verticalLayout->itemAt(i)->layout());
QLabel *label = static_cast<QLabel*>(layout->itemAt(2)->widget());
QToolButton *button = static_cast<QToolButton*>(layout->itemAt(0)->widget());
label->setText(QString("%1 %2").arg(drivers[0].no).arg(drivers[0].name));
setButtonColor(button, ColorsManager::getInstance().getCarColor(drivers[0].no));
label->setVisible(true);
button->setVisible(true);
button = static_cast<QToolButton*>(layout->itemAt(1)->widget());
button->setVisible(true);
label = static_cast<QLabel*>(layout->itemAt(5)->widget());
button = static_cast<QToolButton*>(layout->itemAt(3)->widget());
label->setText(QString("%1 %2").arg(drivers[1].no).arg(drivers[1].name));
setButtonColor(button, ColorsManager::getInstance().getCarColor(drivers[1].no));
label->setVisible(true);
button->setVisible(true);
button = static_cast<QToolButton*>(layout->itemAt(4)->widget());
button->setVisible(true);
}
}
for (; i < ui->verticalLayout->count()-2; ++i)
{
QHBoxLayout *layout = static_cast<QHBoxLayout*>(ui->verticalLayout->itemAt(i)->layout());
QLabel *label = static_cast<QLabel*>(layout->itemAt(2)->widget());
QToolButton *button = static_cast<QToolButton*>(layout->itemAt(0)->widget());
label->setVisible(false);
button->setVisible(false);
button = static_cast<QToolButton*>(layout->itemAt(1)->widget());
button->setVisible(false);
label = static_cast<QLabel*>(layout->itemAt(5)->widget());
button = static_cast<QToolButton*>(layout->itemAt(3)->widget());
label->setVisible(false);
//.........这里部分代码省略.........
示例2: QWidget
//.........这里部分代码省略.........
// horizontal line
QFrame* line = new QFrame();
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Raised);
layout->addWidget(line);
}
// everything else is added to the following widget which just has a different background color
QVBoxLayout* bodyLayout = new QVBoxLayout;
{
QWidget* body = new QWidget();
body->setLayout(bodyLayout);
layout->addWidget(body);
body->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
}
// document list actions
{
QHBoxLayout* actionsLayout = new QHBoxLayout;
QLabel* label = new QLabel(i18n("Documents:"));
label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
actionsLayout->addWidget(label);
actionsLayout->addStretch();
m_mergeButton = new QPushButton;
m_mergeButton->setIcon(KIcon("list-add"));
m_mergeButton->setText(i18n("Add All"));
m_mergeButton->setToolTip(i18n("Add all documents that are part of this working set to the currently active working set."));
m_mergeButton->setFlat(true);
connect(m_mergeButton, SIGNAL(clicked(bool)), m_setButton, SLOT(mergeSet()));
actionsLayout->addWidget(m_mergeButton);
m_subtractButton = new QPushButton;
m_subtractButton->setIcon(KIcon("list-remove"));
m_subtractButton->setText(i18n("Subtract All"));
m_subtractButton->setToolTip(i18n("Remove all documents that are part of this working set from the currently active working set."));
m_subtractButton->setFlat(true);
connect(m_subtractButton, SIGNAL(clicked(bool)), m_setButton, SLOT(subtractSet()));
actionsLayout->addWidget(m_subtractButton);
bodyLayout->addLayout(actionsLayout);
}
QSet<QString> hadFiles;
QVBoxLayout* filesLayout = new QVBoxLayout;
filesLayout->setMargin(0);
foreach(const QString& file, m_set->fileList()) {
if(hadFiles.contains(file))
continue;
hadFiles.insert(file);
FileWidget* widget = new FileWidget;
widget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
QHBoxLayout* fileLayout = new QHBoxLayout(widget);
QToolButton* plusButton = new QToolButton;
plusButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);
fileLayout->addWidget(plusButton);
WorkingSetFileLabel* fileLabel = new WorkingSetFileLabel;
fileLabel->setTextFormat(Qt::RichText);
// We add spaces behind and after, to make it look nicer
fileLabel->setText(" " + Core::self()->projectController()->prettyFileName(KUrl(file)) + " ");
fileLabel->setToolTip(i18nc("@info:tooltip", "Click to open and activate this document."));
fileLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
fileLayout->addWidget(fileLabel);
fileLayout->setMargin(0);
plusButton->setMaximumHeight(fileLabel->sizeHint().height() + 4);
plusButton->setMaximumWidth(plusButton->maximumHeight());
plusButton->setObjectName(file);
fileLabel->setObjectName(file);
fileLabel->setCursor(QCursor(Qt::PointingHandCursor));
widget->m_button = plusButton;
widget->m_label = fileLabel;
filesLayout->addWidget(widget);
m_fileWidgets.insert(file, widget);
m_orderedFileWidgets.push_back(widget);
connect(plusButton, SIGNAL(clicked(bool)), this, SLOT(buttonClicked(bool)));
connect(fileLabel, SIGNAL(clicked()), this, SLOT(labelClicked()));
}
bodyLayout->addLayout(filesLayout);
updateFileButtons();
connect(set, SIGNAL(setChangedSignificantly()), SLOT(updateFileButtons()));
connect(mainwindow->area(), SIGNAL(changedWorkingSet(Sublime::Area*,QString,QString)), SLOT(updateFileButtons()), Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "updateFileButtons");
}