本文整理汇总了C++中setFormat函数的典型用法代码示例。如果您正苦于以下问题:C++ setFormat函数的具体用法?C++ setFormat怎么用?C++ setFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setFormat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QGLWidget
YabauseGL::YabauseGL( QWidget* p )
: QGLWidget(p)
{
setFocusPolicy( Qt::StrongFocus );
QGLFormat fmt;
fmt.setProfile(QGLFormat::CompatibilityProfile);
setFormat(fmt);
if ( p ) {
p->setFocusPolicy( Qt::StrongFocus );
setFocusProxy( p );
}
viewport_width_ = 0;
viewport_height_ = 0;
viewport_origin_x_ = 0;
viewport_origin_y_ = 0;
}
示例2: m_document
OccView::OccView(Document* document):
m_document(document),
m_mode(Selection)
{
QSurfaceFormat format;
format.setDepthBufferSize(16);
format.setStencilBufferSize(1);
setFormat(format);
m_view = m_document->viewer()->CreateView();
m_widget = QWidget::createWindowContainer(this);
m_map.insert(m_widget, m_document);
initCursors();
initViewActions();
initRenderActions();
}
示例3: foreach
void Highlighter::highlightBlock(const QString &text)
{
QTextCharFormat errorFormat, format;
errorFormat.setBackground(Qt::red);
errorFormat.setForeground(Qt::white);
format.setForeground(Qt::black);
foreach(const HighlightingRule &rule, highlightingRules)
{
QRegExp expression(rule.pattern);
int index = expression.indexIn(text);
while(index >= 0)
{
int length = expression.matchedLength();
setFormat(index, length, rule.format);
index = expression.indexIn(text, index + length);
}
}
示例4: stopRecording
void Engine::reset()
{
stopRecording();
stopPlayback();
setState(QAudio::AudioInput, QAudio::StoppedState);
setFormat(QAudioFormat());
m_generateTone = false;
delete m_file;
m_file = 0;
delete m_analysisFile;
m_analysisFile = 0;
m_buffer.clear();
m_bufferPosition = 0;
m_bufferLength = 0;
m_dataLength = 0;
emit dataLengthChanged(0);
resetAudioDevices();
}
示例5: highlightBlockUml
/**
* @brief UML syntax highlighting.
* @param text
*/
void highlightBlockUml(const QString &text) {
if(highlightRestOfLine(text, REGEX_MLC_ON, format_comment) == true) {
multiLineComment=true;
}
if(highlightRestOfLine(text, REGEX_MLC_OFF, format_comment) == true) {
multiLineComment=false;
}
if(multiLineComment == true) {
setFormat(0, text.length(), format_comment);
return;
}
//------------------------------------------------------------
highlightWords(text, REGEX_KEYWORD, format_keyword);
highlightWords(text, REGEX_KEYWORD2, format_keyword);
highlightWords(text, REGEX_NOTE1, format_keyword);
highlightWord( text, REGEX_NOTE2, format_keyword);
highlightWords(text, REGEX_HTML_TAG, format_html);
highlightWords(text, REGEX_MASK, format_mask );
highlightWords(text, REGEX_COLOR, format_color );
highlightWord(text, REGEX_SEPARATOR, format_separator);
// highlightWords(text, REGEX_ARROWS1, format_arrow);
// highlightWords(text, REGEX_ARROWS2, format_arrow);
// highlightArrorws(text);
//------------------------------------------------------------
highlightWord(text, REGEX_SKIN, format_skin);
highlightWord(text, REGEX_OPTION, format_option);
highlightWord(text, REGEX_DECORATION, format_decoration);
highlightRestOfLine(text, REGEX_COMMENT, format_comment);
}
示例6: expression
void SpellHighlighter::highlightBlock(const QString& text)
{
// Underline
QTextCharFormat tcf;
tcf.setUnderlineColor(QBrush(QColor(255,0,0)));
tcf.setUnderlineStyle(QTextCharFormat::SpellCheckUnderline);
// Match words (minimally)
QRegExp expression("\\b\\w+\\b");
// Iterate through all words
int index = text.indexOf(expression);
while (index >= 0) {
int length = expression.matchedLength();
if (!SpellChecker::instance()->isCorrect(expression.cap()))
setFormat(index, length, tcf);
index = text.indexOf(expression, index + length);
}
}
示例7: setFormat
void SyntaxHighlighter::highlightBlockInSymbol(ScLexer & lexer)
{
int originalOffset = lexer.offset();
int tokenLength;
Token::Type tokenType = lexer.nextToken(tokenLength);
int range = lexer.offset() - originalOffset;
setFormat(originalOffset, range, mGlobals->format(SymbolFormat));
if (tokenType == Token::Unknown)
return;
Q_ASSERT(tokenType == Token::SymbolMark);
Token token(tokenType, lexer.offset() - 1, 1);
token.character = '\'';
TextBlockData *blockData = static_cast<TextBlockData*>(currentBlockUserData());
Q_ASSERT(blockData);
blockData->tokens.push_back( token );
}
示例8: elements
/*!
\overload
\param elem Source element to scan
\param ignoreNewIds whether unknown format identifiers should be ignored
The given dom element must contain a proper version attribute and format
data as child elements (<format> tags)
\note Previous content is not discarded
*/
void QFormatScheme::load(const QDomElement& elem, bool ignoreNewIds)
{
if (!elem.hasAttributes() && !elem.hasChildNodes()) return;
if ( elem.attribute("version") < QFORMAT_VERSION )
{
qWarning("Format encoding version mismatch : [found]%s != [expected]%s",
qPrintable(elem.attribute("version")),
QFORMAT_VERSION);
return;
}
QDomElement e, c;
QDomNodeList l, f = elem.elementsByTagName("format");
for ( int i = 0; i < f.count(); i++ )
{
e = f.at(i).toElement();
if ( ignoreNewIds && !m_formatKeys.contains(e.attribute("id")) )
continue;
l = e.childNodes();
QFormat fmt;
for ( int i = 0; i < l.count(); i++ )
{
c = l.at(i).toElement();
if ( c.isNull() )
continue;
QString field = c.tagName(),
value = c.firstChild().toText().data();
setFormatOption(fmt,field,value);
}
fmt.setPriority(fmt.priority); //update priority if other values changed
setFormat(e.attribute("id"), fmt);
}
}
示例9: QWindow
Window::Window(QScreen *screen)
: QWindow(screen)
{
setSurfaceType(QSurface::OpenGLSurface);
resize(1024, 768);
QSurfaceFormat format;
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL)
{
//format.setVersion(4,3);
format.setProfile(QSurfaceFormat::CoreProfile);
}
format.setDepthBufferSize( 24 );
format.setSamples( 4 );
setFormat(format);
create();
}
示例10: QGLWidget
LedsSimulator::LedsSimulator(QWidget *parent /*= 0*/, int cubeX, int cubeY, int cubeZ, int spacing /*= 1*/)
: QGLWidget(parent), m_spacing(spacing), m_monoChromeLeds(false)
{
setFormat(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer));
rotationX = 0.0;
rotationY = 0.0;
rotationZ = 0.0;
m_cubeMatrix[0] = cubeX;
m_cubeMatrix[1] = cubeY;
m_cubeMatrix[2] = cubeZ;
m_spacing+=2;
m_backColor = Qt::darkGray;
m_offColor = QColor(220,220,220,40);
setCubeValues();
}
示例11: setOptions
static void setOptions(HWND hwndDlg)
{
UCHAR title[256] ;
sprintf(title, "Session Options for <%s>", SessServerName) ;
WinSetWindowText(hwndDlg, title) ;
setFormat(hwndDlg) ;
setEncode(hwndDlg) ;
setButton(hwndDlg, IDD_OPT_SHARED, SessOptShared) ;
setButton(hwndDlg, IDD_OPT_VONLY, SessOptViewonly) ;
setButton(hwndDlg, IDD_OPT_DEICON, SessOptDeiconify) ;
if (! initialSetup) {
WinEnableWindow(WinWindowFromID(hwndDlg, IDD_OPT_FORMAT), FALSE) ;
WinEnableWindow(WinWindowFromID(hwndDlg, IDD_OPT_SHARED), FALSE) ;
}
}
示例12: QGLWidget
VCanvas::VCanvas(QWidget *parent)
: QGLWidget(parent)
{
setFormat(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer));
rotationX = 30.0; defaultRotationX = 30.0;
rotationY = 45.0; defaultRotationY = 45.0;
rotationZ = 0.0; defaultRotationZ = 0.0;
scaling = 1;
defaultScaling = 1;
drawingData = 0;
translX = 0.0; translY = 0.0; translZ = 0.0;
areParticlesNumbersVisible = true;
areAxesVisible = true;
}
示例13: qMax
void DiskSpaceBar::refresh()
{
if (!isVisible())
return;
uint total, free;
if (!getDiskSpace(m_path, total, free))
return;
uint usedmb = total-free;
m_diskSpace = qMax(m_diskSpace, usedmb);
qreal gbyte = usedmb/1024.0;
uint percnt = usedmb*100/total;
QString gbt = PLCHD.arg(gbyte,7,FMT_F,2,FILLSPC);
QString pct = QString::number(percnt).rightJustified(3,FILLSPC);
setValue(usedmb);
setFormat(qtBuilderDiskSpaceTmpl.arg(m_name, gbt, pct));
}
示例14: setFormat
void OgreTexture::createManual(int _width, int _height, TextureUsage _usage, PixelFormat _format)
{
setFormat(_format);
setUsage(_usage);
mTexture = Ogre::TextureManager::getSingleton().createManual(
mName,
mGroup,
Ogre::TEX_TYPE_2D,
_width,
_height,
0,
mPixelFormat,
mUsage,
this);
mTexture->load();
}
示例15: size_t
bool StImagePlane::initSideBySide(const StImagePlane& theImageL,
const StImagePlane& theImageR,
const int theSeparationDx,
const int theSeparationDy,
const int theValue) {
if(theImageL.isNull() || theImageR.isNull()) {
// just ignore
return true;
}
if(theImageL.getSizeX() != theImageR.getSizeX() ||
theImageL.getSizeY() != theImageR.getSizeY()) {
// currently unsupported operation
return false;
}
size_t dxAbsPx = size_t(abs(theSeparationDx));
size_t dxLeftRPx = (theSeparationDx > 0) ? dxAbsPx : 0;
size_t dxLeftLPx = (theSeparationDx < 0) ? 2 * dxAbsPx : 0;
size_t dyAbsPx = size_t(abs(theSeparationDy));
size_t dyTopLPx = (theSeparationDy > 0) ? dyAbsPx : 0;
size_t dyTopRPx = (theSeparationDy < 0) ? dyAbsPx : 0;
size_t outSizeX = (theImageL.getSizeX() + dxAbsPx) * 2;
size_t outSizeY = theImageL.getSizeY() + dyAbsPx * 2;
setFormat(theImageL.getFormat());
if(!initZero(theImageL.getFormat(), outSizeX, outSizeY, outSizeX * theImageL.getSizePixelBytes(), theValue)) {
return false;
}
// save cross-eyed
for(size_t row = 0; row < theImageR.getSizeY(); ++row) {
stMemCpy(changeData(dyTopRPx + row, dxLeftRPx),
theImageR.getData(row, 0),
theImageR.getSizeRowBytes());
}
for(size_t row = 0; row < theImageR.getSizeY(); ++row) {
stMemCpy(changeData(dyTopLPx + row, theImageR.getSizeX() + dxLeftLPx + dxLeftRPx),
theImageL.getData(row, 0),
theImageL.getSizeRowBytes());
}
return true;
}