本文整理汇总了C++中QToolButton::font方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::font方法的具体用法?C++ QToolButton::font怎么用?C++ QToolButton::font使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::font方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foreach
foreach (QAction* action, actions) {
QToolButton* button = new QToolButton;
QFont font = button->font();
font.setPixelSize(14);
button->setFont(font);
button->setText(action->text());
d->m_flow_layout->addWidget(button);
QObject::connect(button, SIGNAL(clicked()), action, SLOT(trigger()));
}
示例2: QWidget
KexiDBDateTimeEdit::KexiDBDateTimeEdit(const QDateTime &datetime, QWidget *parent)
: QWidget(parent), KexiFormDataItemInterface()
{
m_invalidState = false;
m_cleared = false;
m_readOnly = false;
m_dateEdit = new Q3DateEdit(datetime.date(), this);
m_dateEdit->setAutoAdvance(true);
m_dateEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
// m_dateEdit->setFixedWidth( QFontMetrics(m_dateEdit->font()).width("8888-88-88___") );
connect(m_dateEdit, SIGNAL(valueChanged(QDate)), this, SLOT(slotValueChanged()));
connect(m_dateEdit, SIGNAL(valueChanged(QDate)), this, SIGNAL(dateTimeChanged()));
QToolButton* btn = new QToolButton(this);
btn->setText("...");
btn->setFixedWidth(QFontMetrics(btn->font()).width(" ... "));
btn->setPopupDelay(1); //1 ms
m_timeEdit = new Q3TimeEdit(datetime.time(), this);
m_timeEdit->setAutoAdvance(true);
m_timeEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
connect(m_timeEdit, SIGNAL(valueChanged(QTime)), this, SLOT(slotValueChanged()));
connect(m_timeEdit, SIGNAL(valueChanged(QTime)), this, SIGNAL(dateTimeChanged()));
#ifdef QDateTimeEditor_HACK
m_dte_date = KexiUtils::findFirstChild<QDateTimeEditor>(m_dateEdit, "QDateTimeEditor");
m_dte_time = KexiUtils::findFirstChild<QDateTimeEditor>(m_timeEdit, "QDateTimeEditor");
#else
m_dte_date = 0;
#endif
m_datePickerPopupMenu = new QMenu(0, "date_popup");
connect(m_datePickerPopupMenu, SIGNAL(aboutToShow()), this, SLOT(slotShowDatePicker()));
m_datePicker = new KDatePicker(m_datePickerPopupMenu, QDate::currentDate(), 0);
KDateTable *dt = KexiUtils::findFirstChild<KDateTable>(m_datePicker, "KDateTable");
if (dt)
connect(dt, SIGNAL(tableClicked()), this, SLOT(acceptDate()));
m_datePicker->setCloseButton(true);
m_datePicker->installEventFilter(this);
m_datePickerPopupMenu->insertItem(m_datePicker);
btn->setPopup(m_datePickerPopupMenu);
QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(m_dateEdit, 0);
layout->addWidget(btn, 0);
layout->addWidget(m_timeEdit, 0);
//layout->addStretch(1);
setFocusProxy(m_dateEdit);
}
示例3: RecreateButtons
//.........这里部分代码省略.........
//button->setTextPosition( QToolButton::BelowIcon );
// mmueller
button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
}
//button->setToggleButton( true );
// mmueller
button->setCheckable ( true );
if(currentToolID == m_ToolManager->GetActiveToolID())
button->setChecked(true);
QString label;
if (m_GenerateAccelerators)
{
label += "&";
}
label += tool->GetName();
QString tooltip = tool->GetName();
MITK_DEBUG << tool->GetName() << ", " << label.toLocal8Bit().constData() << ", '" << tooltip.toLocal8Bit().constData();
if ( m_ShowNames )
{
/*
button->setUsesTextLabel(true);
button->setTextLabel( label ); // a label
QToolTip::add( button, tooltip );
*/
// mmueller Qt
button->setText( label ); // a label
button->setToolTip( tooltip );
// mmueller
QFont currentFont = button->font();
currentFont.setBold(false);
button->setFont( currentFont );
}
us::ModuleResource iconResource = tool->GetIconResource();
if (!iconResource.IsValid())
{
button->setIcon(QIcon(QPixmap(tool->GetXPM())));
}
else
{
us::ModuleResourceStream resourceStream(iconResource, std::ios::binary);
resourceStream.seekg(0, std::ios::end);
std::ios::pos_type length = resourceStream.tellg();
resourceStream.seekg(0, std::ios::beg);
char* data = new char[length];
resourceStream.read(data, length);
QPixmap pixmap;
pixmap.loadFromData(QByteArray::fromRawData(data, length));
QIcon* icon = new QIcon(pixmap);
delete[] data;
button->setIcon(*icon);
if (m_ShowNames)
{
if (m_LayoutColumns == 1)
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
else
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);