本文整理汇总了C++中ktexteditor::attribute::Ptr::fontStrikeOut方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::fontStrikeOut方法的具体用法?C++ Ptr::fontStrikeOut怎么用?C++ Ptr::fontStrikeOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ktexteditor::attribute::Ptr
的用法示例。
在下文中一共展示了Ptr::fontStrikeOut方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
QVariant KateStyleTreeWidgetItem::data( int column, int role ) const
{
if (column == Context) {
switch (role) {
case Qt::ForegroundRole:
if (style()->hasProperty(QTextFormat::ForegroundBrush))
return style()->foreground().color();
break;
case Qt::BackgroundRole:
if (style()->hasProperty(QTextFormat::BackgroundBrush))
return style()->background().color();
break;
case Qt::FontRole:
return style()->font();
break;
}
}
if (role == Qt::CheckStateRole) {
switch (column) {
case Bold:
return toCheckState(style()->fontBold());
case Italic:
return toCheckState(style()->fontItalic());
case Underline:
return toCheckState(style()->fontUnderline());
case StrikeOut:
return toCheckState(style()->fontStrikeOut());
case UseDefaultStyle:
/* can't compare all attributes, currentStyle has always more than defaultStyle (e.g. the item's name),
* so we just compare the important ones:*/
return toCheckState(
currentStyle->foreground() == defaultStyle->foreground()
&& currentStyle->background() == defaultStyle->background()
&& currentStyle->selectedForeground() == defaultStyle->selectedForeground()
&& currentStyle->selectedBackground() == defaultStyle->selectedBackground()
&& currentStyle->fontBold() == defaultStyle->fontBold()
&& currentStyle->fontItalic() == defaultStyle->fontItalic()
&& currentStyle->fontUnderline() == defaultStyle->fontUnderline()
&& currentStyle->fontStrikeOut() == defaultStyle->fontStrikeOut());
}
}
if (role == Qt::DisplayRole) {
switch (column) {
case Foreground:
return style()->foreground();
case SelectedForeground:
return style()->selectedForeground();
case Background:
return style()->background();
case SelectedBackground:
return style()->selectedBackground();
}
}
return QTreeWidgetItem::data(column, role);
}
示例2: setDefaults
void KateHlManager::setDefaults(const QString &schema, KateAttributeList &list,KConfig *cfg)
{
cfg=cfg?cfg:KateHlManager::self()->self()->getKConfig();
KConfigGroup config(cfg,
"Default Item Styles - Schema " + schema);
for (uint z = 0; z < defaultStyles(); z++)
{
QStringList settings;
KTextEditor::Attribute::Ptr p = list.at(z);
settings<<(p->hasProperty(QTextFormat::ForegroundBrush)?QString::number(p->foreground().color().rgb(),16):"");
settings<<(p->hasProperty(KTextEditor::Attribute::SelectedForeground)?QString::number(p->selectedForeground().color().rgb(),16):"");
settings<<(p->hasProperty(QTextFormat::FontWeight)?(p->fontBold()?"1":"0"):"");
settings<<(p->hasProperty(QTextFormat::FontItalic)?(p->fontItalic()?"1":"0"):"");
settings<<(p->hasProperty(QTextFormat::FontStrikeOut)?(p->fontStrikeOut()?"1":"0"):"");
settings<<(p->hasProperty(QTextFormat::FontUnderline)?(p->fontUnderline()?"1":"0"):"");
settings<<(p->hasProperty(QTextFormat::BackgroundBrush)?QString::number(p->background().color().rgb(),16):"-");
settings<<(p->hasProperty(KTextEditor::Attribute::SelectedBackground)?QString::number(p->selectedBackground().color().rgb(),16):"-");
settings<<(p->hasProperty(QTextFormat::FontFamily)?(p->fontFamily()):QString());
settings<<"---";
config.writeEntry(defaultStyleName(z),settings);
}
emit changed();
}
示例3: changeProperty
void KateStyleTreeWidgetItem::changeProperty( int p )
{
if ( p == Bold )
currentStyle->setFontBold( ! currentStyle->fontBold() );
else if ( p == Italic )
currentStyle->setFontItalic( ! currentStyle->fontItalic() );
else if ( p == Underline )
currentStyle->setFontUnderline( ! currentStyle->fontUnderline() );
else if ( p == StrikeOut )
currentStyle->setFontStrikeOut( ! currentStyle->fontStrikeOut() );
else if ( p == UseDefaultStyle )
toggleDefStyle();
else
setColor( p );
updateStyle ();
treeWidget()->emitChanged();
}
示例4: updateStyle
void KateStyleTreeWidgetItem::updateStyle()
{
// nothing there, not update it, will crash
if (!actualStyle)
return;
if ( currentStyle->hasProperty(QTextFormat::FontWeight) )
{
if ( currentStyle->fontWeight() != actualStyle->fontWeight())
actualStyle->setFontWeight( currentStyle->fontWeight() );
}
else actualStyle->clearProperty( QTextFormat::FontWeight );
if ( currentStyle->hasProperty(QTextFormat::FontItalic) )
{
if ( currentStyle->fontItalic() != actualStyle->fontItalic())
actualStyle->setFontItalic( currentStyle->fontItalic() );
}
else actualStyle->clearProperty( QTextFormat::FontItalic );
if ( currentStyle->hasProperty(QTextFormat::FontStrikeOut) )
{
if ( currentStyle->fontStrikeOut() != actualStyle->fontStrikeOut())
actualStyle->setFontStrikeOut( currentStyle->fontStrikeOut() );
}
else actualStyle->clearProperty( QTextFormat::FontStrikeOut );
if ( currentStyle->hasProperty(QTextFormat::FontUnderline) )
{
if ( currentStyle->fontUnderline() != actualStyle->fontUnderline())
actualStyle->setFontUnderline( currentStyle->fontUnderline() );
}
else actualStyle->clearProperty( QTextFormat::FontUnderline );
if ( currentStyle->hasProperty(KTextEditor::Attribute::Outline) )
{
if ( currentStyle->outline() != actualStyle->outline())
actualStyle->setOutline( currentStyle->outline() );
}
else actualStyle->clearProperty( KTextEditor::Attribute::Outline );
if ( currentStyle->hasProperty(QTextFormat::ForegroundBrush) )
{
if ( currentStyle->foreground() != actualStyle->foreground())
actualStyle->setForeground( currentStyle->foreground() );
}
else actualStyle->clearProperty( QTextFormat::ForegroundBrush );
if ( currentStyle->hasProperty(KTextEditor::Attribute::SelectedForeground) )
{
if ( currentStyle->selectedForeground() != actualStyle->selectedForeground())
actualStyle->setSelectedForeground( currentStyle->selectedForeground() );
}
else actualStyle->clearProperty( KTextEditor::Attribute::SelectedForeground );
if ( currentStyle->hasProperty(QTextFormat::BackgroundBrush) )
{
if ( currentStyle->background() != actualStyle->background())
actualStyle->setBackground( currentStyle->background() );
}
else actualStyle->clearProperty( QTextFormat::BackgroundBrush );
if ( currentStyle->hasProperty(KTextEditor::Attribute::SelectedBackground) )
{
if ( currentStyle->selectedBackground() != actualStyle->selectedBackground())
actualStyle->setSelectedBackground( currentStyle->selectedBackground() );
}
else actualStyle->clearProperty( KTextEditor::Attribute::SelectedBackground );
}
示例5: contextMenuEvent
void KateStyleTreeWidget::contextMenuEvent( QContextMenuEvent * event )
{
KateStyleTreeWidgetItem *i = dynamic_cast<KateStyleTreeWidgetItem*>(itemAt(event->pos()));
if (!i) return;
KMenu m( this );
KTextEditor::Attribute::Ptr currentStyle = i->style();
// the title is used, because the menu obscures the context name when
// displayed on behalf of spacePressed().
QPainter p;
p.setPen(Qt::black);
QIcon cl = brushIcon( i->style()->foreground().color() );
QIcon scl = brushIcon( i->style()->selectedForeground().color() );
QIcon bgcl = brushIcon( i->style()->hasProperty(QTextFormat::BackgroundBrush) ? i->style()->background().color() : viewport()->palette().base().color() );
QIcon sbgcl = brushIcon( i->style()->hasProperty(KTextEditor::Attribute::SelectedBackground) ? i->style()->selectedBackground().color() : viewport()->palette().base().color() );
m.addTitle( i->contextName() );
QAction* a = m.addAction( i18n("&Bold"), this, SLOT(changeProperty()) );
a->setCheckable(true);
a->setChecked( currentStyle->fontBold() );
a->setData(KateStyleTreeWidgetItem::Bold);
a = m.addAction( i18n("&Italic"), this, SLOT(changeProperty()) );
a->setCheckable(true);
a->setChecked( currentStyle->fontItalic() );
a->setData(KateStyleTreeWidgetItem::Italic);
a = m.addAction( i18n("&Underline"), this, SLOT(changeProperty()) );
a->setCheckable(true);
a->setChecked( currentStyle->fontUnderline() );
a->setData(KateStyleTreeWidgetItem::Underline);
a = m.addAction( i18n("S&trikeout"), this, SLOT(changeProperty()) );
a->setCheckable(true);
a->setChecked( currentStyle->fontStrikeOut() );
a->setData(KateStyleTreeWidgetItem::StrikeOut);
m.addSeparator();
a = m.addAction( cl, i18n("Normal &Color..."), this, SLOT(changeProperty()) );
a->setData(KateStyleTreeWidgetItem::Foreground);
a = m.addAction( scl, i18n("&Selected Color..."), this, SLOT(changeProperty()) );
a->setData(KateStyleTreeWidgetItem::SelectedForeground);
a = m.addAction( bgcl, i18n("&Background Color..."), this, SLOT(changeProperty()) );
a->setData(KateStyleTreeWidgetItem::Background);
a = m.addAction( sbgcl, i18n("S&elected Background Color..."), this, SLOT(changeProperty()) );
a->setData(KateStyleTreeWidgetItem::SelectedBackground);
// Unset [some] colors. I could show one only if that button was clicked, but that
// would disable setting this with the keyboard (how many aren't doing just
// that every day? ;)
// ANY ideas for doing this in a nicer way will be warmly wellcomed.
KTextEditor::Attribute::Ptr style = i->style();
if ( style->hasProperty( QTextFormat::BackgroundBrush) || style->hasProperty( KTextEditor::Attribute::SelectedBackground ) )
{
m.addSeparator();
if ( style->hasProperty( QTextFormat::BackgroundBrush) ) {
a = m.addAction( i18n("Unset Background Color"), this, SLOT(unsetColor()) );
a->setData(100);
}
if ( style->hasProperty( KTextEditor::Attribute::SelectedBackground ) ) {
a = m.addAction( i18n("Unset Selected Background Color"), this, SLOT(unsetColor()) );
a->setData(101);
}
}
if ( ! i->isDefault() && ! i->defStyle() ) {
m.addSeparator();
a = m.addAction( i18n("Use &Default Style"), this, SLOT(changeProperty()) );
a->setCheckable(true);
a->setChecked( i->defStyle() );
a->setData(KateStyleTreeWidgetItem::UseDefaultStyle);
}
m.exec( event->globalPos() );
}