示例#1
0
void StyledLabel::setResizeMode(ResizeMode mode)
{
    if (_resizeMode == mode)
        return;

    _resizeMode = mode;
    if (mode == DynamicResize)
        setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    else
        setWrapMode(QTextOption::NoWrap);
}
示例#2
0
    std::shared_ptr<gameplay::Material> createMaterial(const std::shared_ptr<gameplay::Texture>& texture, BlendingMode bmode, const std::shared_ptr<gameplay::ShaderProgram>& shader)
    {
        auto result = std::make_shared<gameplay::Material>(shader);
        // Set some defaults
        auto sampler = std::make_shared<gameplay::Texture::Sampler>(texture);
        sampler->setWrapMode(gameplay::Texture::CLAMP, gameplay::Texture::CLAMP);
        result->getParameter("u_diffuseTexture")->set(sampler);
        result->getParameter("u_worldViewProjectionMatrix")->bindWorldViewProjectionMatrix();
        result->initStateBlockDefaults();

        result->getParameter("u_brightness")->bind(&engine::items::ItemNode::lightBrightnessBinder);
        result->getParameter("u_ambient")->bind(&engine::items::ItemNode::lightAmbientBinder);
        result->getParameter("u_lightPosition")->bind(&engine::items::ItemNode::lightPositionBinder);

        switch( bmode )
        {
            case BlendingMode::Solid:
            case BlendingMode::AlphaTransparency:
            case BlendingMode::VertexColorTransparency: // Classic PC alpha
            case BlendingMode::InvertSrc: // Inversion by src (PS darkness) - SAME AS IN TR3-TR5
            case BlendingMode::InvertDst: // Inversion by dest
            case BlendingMode::Screen: // Screen (smoke, etc.)
            case BlendingMode::AnimatedTexture:
                break;

            default: // opaque animated textures case
                BOOST_ASSERT(false); // FIXME [irrlicht]
        }

        return result;
    }
示例#3
0
FontStyle::FontStyle()
{
    const ArgList& args = TypeRegistry::get()->getTypeDef("fontstyle").getDefaultArgs();
    args.setMembers(this);
    setAlignment(args.getArgVal<UTF8String>("alignment"));
    setWrapMode(args.getArgVal<UTF8String>("wrapmode"));
}
示例#4
0
void OpenGLTextureBase::create(OGL::Filter filter, OGL::WrapMode wrap) {
	glGenTextures(1, &m_id);
	OpenGLTextureBaseBinder binder(m_target, OGL::bindingTarget(m_target));
	binder.bind(this);
	setFilter(filter);
	setWrapMode(wrap);
}
示例#5
0
// Parse emacs modeline
FXbool Modeline::parseEmacsModeline(const FXchar* s){
  FXString key;
  FXString val;
  while(*s!='\0'){
    while(*s==';' || *s=='\t' || *s==' ') s++;
    if(*s=='\0' || (*s=='-' && *(s+1)=='*' && *(s+2)=='-')) break;
    key=FXString::null;
    val=FXString::null;
    while(*s!='\0' && *s!=':' && *s!=';' && *s!='\t' && *s!=' '){
      key+=*s++;
      }
    while(*s=='\t' || *s==' ') s++;
    if(*s=='\0') break;
    if(*s!=':') continue;
    s++;
    while(*s=='\t' || *s==' ') s++;
    if(*s=='\0') break;
    while(*s!='\0' && *s!=';' &&  *s!='\t' && *s!=' '){
      val+=*s++;
      }
    if(comparecase(key,"Mode")==0){
      setLanguage(val);
      }
    else if(key=="tab-width"){
      setTabWidth(val.toInt());
      }
    else if(key=="indent-tabs-mode"){
      setTabMode(val=="nil");
      }
    else if(key=="autowrap"){
      setWrapMode(val!="nil");
      }
    }
  return true;
  }
示例#6
0
 bool Texture1D::loadFromMemory(UI32 width,
                                I32 internalFormat,
                                UI32 pixelFormat,
                                UI32 pixelType,
                                I32 minFilter,
                                I32 magFilter,
                                I32 wrapMode,
                                const void* data,
                                bool mipmap)
 {
     m_width = width;
     
     // Create a texture
     render::lib::genTextures(1, &m_texture);
     if (m_texture)
     {
         setFiltering(minFilter, magFilter);
         setWrapMode(wrapMode);
         bind();
         render::lib::texImage1D(ODIN_TEXTURE_1D, 0, internalFormat, m_width, 0, pixelFormat, pixelType, data);
         unbind();
         if (mipmap) generateMipmaps();
         
         return true;
     }
     else return false;
 }
示例#7
0
Texture::Texture(unsigned int p_width, unsigned int p_height, Texture::InternalFormat::Enum p_format):
	m_texture(generateTextureId()),
	m_width(p_width),
	m_height(p_height)
{
	setFilterMode(FilterMode::Point);
	setWrapMode(WrapMode::ClampToEdge);	
	texImage2D(p_format, p_width, p_height, NULL);	
}
示例#8
0
FontStyle::FontStyle(const ArgList& args)
{
    args.setMembers(this);
    setAlignment(args.getArgVal<UTF8String>("alignment"));
    setWrapMode(args.getArgVal<UTF8String>("wrapmode"));
    if (args.getArgVal<FontStylePtr>("basestyle") != 0) {
        applyBaseStyle(*(args.getArgVal<FontStylePtr>("basestyle")), args);
    }
}
示例#9
0
	bool RenderTextureOpenGL::createTexture(const Vector2& size, RenderTextureFormat format)
	{
		GLenum target = getTarget();
		glBindTexture(target, getTextureId());
		glTexImage2D(target, 0, RENDER_TEXTURE_FORMAT_MAP[format], (GLsizei)size.x, (GLsizei)size.y, 0,
					 RENDER_TEXTURE_NRMFMT_MAP[format], GL_FLOAT, 0);
		glBindTexture(target, 0);

		setFilterMode(FM_POINT);
		setWrapMode(TWM_CLAMP);
		return true;
	}
示例#10
0
    std::shared_ptr<gameplay::Material> OBJWriter::readMaterial(const boost::filesystem::path& path, const std::shared_ptr<gameplay::ShaderProgram>& shaderProgram) const
    {
        auto texture = readTexture(path);
        auto sampler = std::make_shared<gameplay::Texture::Sampler>(texture);
        sampler->setWrapMode(gameplay::Texture::CLAMP, gameplay::Texture::CLAMP);

        auto material = std::make_shared<gameplay::Material>(shaderProgram);
        material->getParameter("u_diffuseTexture")->set(sampler);
        material->getParameter("u_worldViewProjectionMatrix")->bindWorldViewProjectionMatrix();
        material->initStateBlockDefaults();

        return material;
    }
示例#11
0
Texture::Texture(unsigned int p_width, unsigned int p_height, unsigned char p_byte):
	m_texture(generateTextureId()),
	m_width(p_width),
	m_height(p_height)
{
	unsigned char* data = new unsigned char[p_width * p_height* 4];
	std::fill(data, data + p_width * p_height * 4, p_byte);

	setFilterMode(FilterMode::Point);
	setWrapMode(WrapMode::ClampToEdge);
	texImage2D(InternalFormat::RGBA8, p_width, p_height, data);
	delete[] data;
}
示例#12
0
 bool Cubemap::loadFromMemory(UI32 width, UI32 height,
                              const void* dataPX,
                              const void* dataNX,
                              const void* dataPY,
                              const void* dataNY,
                              const void* dataPZ,
                              const void* dataNZ,
                              I32 internalFormat,
                              UI32 pixelFormat,
                              UI32 pixelType,
                              I32 minFilter,
                              I32 magFilter,
                              I32 wrapMode,
                              bool mipmap)
 
 {
     m_width = width;
     m_height = height;
     
     const void* data[6] =
     {
         dataPX,
         dataNX,
         dataPY,
         dataNY,
         dataPZ,
         dataNZ
     };
     
     render::lib::genTextures(1, &m_texture);
     if (m_texture)
     {
         setFiltering(minFilter, magFilter);
         setWrapMode(wrapMode);
         bind();
         for (UI32 i = 0; i < 6; ++i)
         {
             render::lib::texImage2D(ODIN_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internalFormat, m_width, m_height, 0, pixelFormat, pixelType, data[i]);
         }
         unbind();
         
         if (mipmap) generateMipmaps();
         
         return true;
     }
     else return false;
     
 }
示例#13
0
// Parse VIM modeline
FXbool Modeline::parseVimModeline(const FXchar* s){
  FXbool set=false;
  FXbool yes=true;
  FXString key;
  FXString val;
  while(*s!='\0' && !(*s==':' && set)){
    while(*s==':' || *s=='\t' || *s==' ') s++;
    if(*s=='\0') break;
    if(*s=='s' && *(s+1)=='e' && *(s+1)==' '){ s+=3; set=true; }
    else if(*s=='s' && *(s+1)=='e' && *(s+2)=='t' && *(s+3)==' '){ s+=4; set=true; }
    yes=true;
    if(*s=='n' && *(s+1)=='o'){ s+=2; yes=false; }
    key=FXString::null;
    val=FXString::null;
    while(*s!='\0' && *s!=':' && *s!='=' && *s!='\t' && *s!=' '){
      key+=*s++;
      }
    if(*s=='='){
      s++;
      while(*s!='\0' && *s!=':' && *s!='\t' && *s!=' '){
        val+=*s++;
        }
      }
    if(key=="ft" || key=="filetype"){
      setLanguage(val);
      }
    else if(key=="et" || key=="expandtab"){
      setTabMode(yes);
      }
    else if(key=="wrap"){
      setWrapMode(yes);
      }
    else if(key=="ai"){
      setAutoIndent(yes);
      }
    else if(key=="ts" || key=="tabstop"){
      setTabWidth(val.toInt());
      }
    else if(key=="textwidth"){
      setWrapWidth(val.toInt());
      }
    }
  return true;
  }
示例#14
0
// Parse Adie modelines
FXbool Modeline::parseAdieModeline(const FXchar* s){
  FXString key;
  FXString val;
  while(*s!='\0' && *s!=':'){
    key=FXString::null;
    val=FXString::null;
    while(*s=='\t' || *s==' ') s++;
    if(*s=='\0') break;
    while(*s!='\0' && *s!=':' && *s!='=' && *s!='\t' && *s!=' '){
      key+=*s++;
      }
    while(*s=='\t' || *s==' ') s++;
    if(*s=='\0') break;
    if(*s!='=') continue;
    s++;
    while(*s=='\t' || *s==' ') s++;
    if(*s=='\0') break;
    while(*s!='\0' && *s!=':' && *s!='\t' && *s!=' '){
      val+=*s++;
      }
    if(key=="la"){
      setLanguage(val);
      }
    else if(key=="ts"){
      setTabWidth(val.toInt());
      }
    else if(key=="ww"){
      setWrapWidth(val.toInt());
      }
    else if(key=="et"){
      setTabMode(val!="0");
      }
    else if(key=="wr"){
      setWrapMode(val!="0");
      }
    else if(key=="ai"){
      setAutoIndent(val!="0");
      }
    }
  return true;
  }
    RoboScintilla::RoboScintilla(QWidget *parent) : QsciScintilla(parent),
        _ignoreEnterKey(false),
        _ignoreTabKey(false),
        _lineNumberDigitWidth(0),
        _lineNumberMarginWidth(0)
    {
        setAutoIndent(true);
        setIndentationsUseTabs(false);
        setIndentationWidth(indentationWidth);
        setUtf8(true);
        setMarginWidth(1, 0);
        setCaretForegroundColor(caretForegroundColor);
        setMatchedBraceForegroundColor(matchedBraceForegroundColor); //1AB0A6
        setMatchedBraceBackgroundColor(marginsBackgroundColor);
        setContentsMargins(0, 0, 0, 0);
        setViewportMargins(3, 3, 3, 3);
        QFont ourFont = GuiRegistry::instance().font();
        setMarginsFont(ourFont);
        setMarginLineNumbers(0, true);
        setMarginsBackgroundColor(QColor(53, 56, 58));
        setMarginsForegroundColor(QColor(173, 176, 178));

        SendScintilla(QsciScintilla::SCI_STYLESETFONT, 1, ourFont.family().data());
        SendScintilla(QsciScintilla::SCI_SETHSCROLLBAR, 0);

        setWrapMode((QsciScintilla::WrapMode)QsciScintilla::SC_WRAP_NONE);
        setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 
        setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); 

        // Cache width of one digit
#ifdef Q_OS_WIN
        _lineNumberDigitWidth = rowNumberWidth;
#else
        _lineNumberDigitWidth = textWidth(STYLE_LINENUMBER, "0");
#endif
        updateLineNumbersMarginWidth();

        setLineNumbers(AppRegistry::instance().settingsManager()->lineNumbers());
        setUtf8(true);
        VERIFY(connect(this, SIGNAL(linesChanged()), this, SLOT(updateLineNumbersMarginWidth())));
    }
示例#16
0
void FontStyle::setDefaultedArgs(const ArgList& args)
{
    // Warning: The ArgList here contains args that are for a different class originally,
    // so the member offsets are wrong.
    setDefaultedArg(m_sName, "font", args);
    setDefaultedArg(m_sVariant, "variant", args);
    setDefaultedArg(m_Color, "color", args);
    setDefaultedArg(m_AAGamma, "aagamma", args);
    setDefaultedArg(m_Size, "fontsize", args);
    setDefaultedArg(m_Indent, "indent", args);
    setDefaultedArg(m_LineSpacing, "linespacing", args);
    UTF8String s = getAlignment();
    setDefaultedArg(s, "alignment", args);
    setAlignment(s);
    s = getWrapMode();
    setDefaultedArg(s, "wrapmode", args);
    setWrapMode(s);
    setDefaultedArg(m_bJustify, "justify", args);
    setDefaultedArg(m_LetterSpacing, "letterspacing", args);
    setDefaultedArg(m_bHint, "hint", args);
}
示例#17
0
FastoScintilla::FastoScintilla(QWidget* parent)
    : QsciScintilla(parent), lineNumberMarginWidth_(0), showAutoCompletion_(false) {
  setAutoIndent(true);
  setIndentationsUseTabs(false);
  setIndentationWidth(indentationWidth);
  setUtf8(true);
  setMarginWidth(1, 0);

  setCaretForegroundColor(caretForegroundColor);

  setMatchedBraceForegroundColor(matchedBraceForegroundColor);
  setMatchedBraceBackgroundColor(matchedBraceBackgroundColor);

  setSelectionBackgroundColor(selectionBackgroundColor);
  setSelectionForegroundColor(selectionForegroundColor);

  setContentsMargins(0, 0, 0, 0);
  setViewportMargins(3, 3, 3, 3);
  setMarginLineNumbers(0, true);

  // Margins colors
  // line numbers margin
  setMarginsBackgroundColor(marginsBackgroundColor);
  setMarginsForegroundColor(marginsForegroundColor);

  SendScintilla(QsciScintilla::SCI_SETHSCROLLBAR, 0);

  setWrapMode(QsciScintilla::WrapNone);
  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

  VERIFY(connect(this, &FastoScintilla::linesChanged, this,
                 &FastoScintilla::updateLineNumbersMarginWidth));

  setAutoCompletionThreshold(1);
  setAutoCompletionCaseSensitivity(false);
  setAutoCompletionSource(QsciScintilla::AcsNone);
}
示例#18
0
int QDeclarativeText::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDeclarativeImplicitSizeItem::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 17)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 17;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = text(); break;
        case 1: *reinterpret_cast< QFont*>(_v) = font(); break;
        case 2: *reinterpret_cast< QColor*>(_v) = color(); break;
        case 3: *reinterpret_cast< TextStyle*>(_v) = style(); break;
        case 4: *reinterpret_cast< QColor*>(_v) = styleColor(); break;
        case 5: *reinterpret_cast< HAlignment*>(_v) = hAlign(); break;
        case 6: *reinterpret_cast< VAlignment*>(_v) = vAlign(); break;
        case 7: *reinterpret_cast< WrapMode*>(_v) = wrapMode(); break;
        case 8: *reinterpret_cast< int*>(_v) = lineCount(); break;
        case 9: *reinterpret_cast< bool*>(_v) = truncated(); break;
        case 10: *reinterpret_cast< int*>(_v) = maximumLineCount(); break;
        case 11: *reinterpret_cast< TextFormat*>(_v) = textFormat(); break;
        case 12: *reinterpret_cast< TextElideMode*>(_v) = elideMode(); break;
        case 13: *reinterpret_cast< qreal*>(_v) = paintedWidth(); break;
        case 14: *reinterpret_cast< qreal*>(_v) = paintedHeight(); break;
        case 15: *reinterpret_cast< qreal*>(_v) = lineHeight(); break;
        case 16: *reinterpret_cast< LineHeightMode*>(_v) = lineHeightMode(); break;
        }
        _id -= 17;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setText(*reinterpret_cast< QString*>(_v)); break;
        case 1: setFont(*reinterpret_cast< QFont*>(_v)); break;
        case 2: setColor(*reinterpret_cast< QColor*>(_v)); break;
        case 3: setStyle(*reinterpret_cast< TextStyle*>(_v)); break;
        case 4: setStyleColor(*reinterpret_cast< QColor*>(_v)); break;
        case 5: setHAlign(*reinterpret_cast< HAlignment*>(_v)); break;
        case 6: setVAlign(*reinterpret_cast< VAlignment*>(_v)); break;
        case 7: setWrapMode(*reinterpret_cast< WrapMode*>(_v)); break;
        case 10: setMaximumLineCount(*reinterpret_cast< int*>(_v)); break;
        case 11: setTextFormat(*reinterpret_cast< TextFormat*>(_v)); break;
        case 12: setElideMode(*reinterpret_cast< TextElideMode*>(_v)); break;
        case 15: setLineHeight(*reinterpret_cast< qreal*>(_v)); break;
        case 16: setLineHeightMode(*reinterpret_cast< LineHeightMode*>(_v)); break;
        }
        _id -= 17;
    } else if (_c == QMetaObject::ResetProperty) {
        switch (_id) {
        case 5: resetHAlign(); break;
        case 10: resetMaximumLineCount(); break;
        }
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 17;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
示例#19
0
QsciEditor::QsciEditor( QWidget *parent ) : QsciScintilla( parent ) {

	setFocus();

	/* Set tab width, and fonts */
	setTabWidth( 4 );
	setFont( QFont( "Envy Code R", 9 ) );
	setTabIndents( true );
	setIndentationsUseTabs( true );

	/* Set folding style */
	setFolding( QsciScintilla::BoxedTreeFoldStyle );

	/* Remove Horizontal Scrollbar, put a Vertical one */
	setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );

	/* Whitespace, indentation markings, and eol */
	setIndentationGuides( false );
	setWhitespaceVisibility( WsInvisible );
	setEolMode( EolUnix );

	/* Create Margins */
	setMarginWidth( 0, QString( " %1 " ).arg( lines() ) );
	setMarginWidth( 1, " " );
	setMarginWidth( 2, 10 );
	setMarginsFont( QFont( "Envy Code R", 9 ) );
	setWrapMode( QsciScintilla::WrapWord );

	/* Current Line Visibility */
	ensureCursorVisible();
	setCaretLineVisible( true );
	setCaretLineBackgroundColor( QColor( "#555555" ) );
	setCaretForegroundColor( QColor( "#FAFFAF" ) );
	setCaretWidth( 2 );

	/* Selection Color */
	// setSelectionBackgroundColor( "#333964" );
	// setSelectionForegroundColor( "*" );

	/* Margin and folding margins background colors */
	setMarginsBackgroundColor( QColor( "#A0A0A0" ) );
	setFoldMarginColors( QColor( "#666666" ), Qt::black );

	/* Set the width of the line */
	setLineWidth( 144 );
	ensureLineVisible( true );

	/* Set the paper and pen color - Editor BG and FG color */
	setPaper( Qt::black );
	setColor( Qt::white );

	/* Brace coloring */
	setBraceMatching( QsciScintilla::SloppyBraceMatch );
	setUnmatchedBraceForegroundColor( Qt::red );
	setUnmatchedBraceBackgroundColor( Qt::black );
	setMatchedBraceForegroundColor( Qt::darkGreen );
	setMatchedBraceBackgroundColor( Qt::black );

	/* Multi-selection and typing */
	SendScintilla( SCI_SETADDITIONALSELECTIONTYPING, true );
	SendScintilla( SCI_SETMULTIPLESELECTION, true );
	SendScintilla( SCI_SETMULTIPASTE, true );

	/* Scroll beyond the last line */
	SendScintilla( SCI_SETENDATLASTLINE, false );

	/* Set the editor state as not modified */
	setModified( false );

	/* Auto Save Timer: 60 sec */
	autoSaveTimer = new QBasicTimer();

	/* Enable and Show Custom context Menu */
	setContextMenuPolicy( Qt::CustomContextMenu );

	/* Connections */
	setupActions();

	/* Default Lexer */
	setLexer( new QLexerDefault() );

    QsciScintilla::FoldStyle state = static_cast<QsciScintilla::FoldStyle>( ( !folding() ) * 5 );
    if ( !state )
        foldAll( false );
    setFolding( state );
};
示例#20
0
int QDeclarativeTextEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDeclarativeImplicitSizePaintedItem::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 47)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 47;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = text(); break;
        case 1: *reinterpret_cast< QColor*>(_v) = color(); break;
        case 2: *reinterpret_cast< QColor*>(_v) = selectionColor(); break;
        case 3: *reinterpret_cast< QColor*>(_v) = selectedTextColor(); break;
        case 4: *reinterpret_cast< QFont*>(_v) = font(); break;
        case 5: *reinterpret_cast< HAlignment*>(_v) = hAlign(); break;
        case 6: *reinterpret_cast< VAlignment*>(_v) = vAlign(); break;
        case 7: *reinterpret_cast< WrapMode*>(_v) = wrapMode(); break;
        case 8: *reinterpret_cast< int*>(_v) = lineCount(); break;
        case 9: *reinterpret_cast< qreal*>(_v) = paintedWidth(); break;
        case 10: *reinterpret_cast< qreal*>(_v) = paintedHeight(); break;
        case 11: *reinterpret_cast< TextFormat*>(_v) = textFormat(); break;
        case 12: *reinterpret_cast< bool*>(_v) = isReadOnly(); break;
        case 13: *reinterpret_cast< bool*>(_v) = isCursorVisible(); break;
        case 14: *reinterpret_cast< int*>(_v) = cursorPosition(); break;
        case 15: *reinterpret_cast< QRect*>(_v) = cursorRectangle(); break;
        case 16: *reinterpret_cast< QDeclarativeComponent**>(_v) = cursorDelegate(); break;
        case 17: *reinterpret_cast< int*>(_v) = selectionStart(); break;
        case 18: *reinterpret_cast< int*>(_v) = selectionEnd(); break;
        case 19: *reinterpret_cast< QString*>(_v) = selectedText(); break;
        case 20: *reinterpret_cast< bool*>(_v) = focusOnPress(); break;
        case 21: *reinterpret_cast< bool*>(_v) = persistentSelection(); break;
        case 22: *reinterpret_cast< qreal*>(_v) = textMargin(); break;
        case 23: *reinterpret_cast< Qt::InputMethodHints*>(_v) = inputMethodHints(); break;
        case 24: *reinterpret_cast< bool*>(_v) = selectByMouse(); break;
        case 25: *reinterpret_cast< SelectionMode*>(_v) = mouseSelectionMode(); break;
        case 26: *reinterpret_cast< bool*>(_v) = canPaste(); break;
        case 27: *reinterpret_cast< bool*>(_v) = isInputMethodComposing(); break;
        }
        _id -= 28;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setText(*reinterpret_cast< QString*>(_v)); break;
        case 1: setColor(*reinterpret_cast< QColor*>(_v)); break;
        case 2: setSelectionColor(*reinterpret_cast< QColor*>(_v)); break;
        case 3: setSelectedTextColor(*reinterpret_cast< QColor*>(_v)); break;
        case 4: setFont(*reinterpret_cast< QFont*>(_v)); break;
        case 5: setHAlign(*reinterpret_cast< HAlignment*>(_v)); break;
        case 6: setVAlign(*reinterpret_cast< VAlignment*>(_v)); break;
        case 7: setWrapMode(*reinterpret_cast< WrapMode*>(_v)); break;
        case 11: setTextFormat(*reinterpret_cast< TextFormat*>(_v)); break;
        case 12: setReadOnly(*reinterpret_cast< bool*>(_v)); break;
        case 13: setCursorVisible(*reinterpret_cast< bool*>(_v)); break;
        case 14: setCursorPosition(*reinterpret_cast< int*>(_v)); break;
        case 16: setCursorDelegate(*reinterpret_cast< QDeclarativeComponent**>(_v)); break;
        case 20: setFocusOnPress(*reinterpret_cast< bool*>(_v)); break;
        case 21: setPersistentSelection(*reinterpret_cast< bool*>(_v)); break;
        case 22: setTextMargin(*reinterpret_cast< qreal*>(_v)); break;
        case 23: setInputMethodHints(*reinterpret_cast< Qt::InputMethodHints*>(_v)); break;
        case 24: setSelectByMouse(*reinterpret_cast< bool*>(_v)); break;
        case 25: setMouseSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break;
        }
        _id -= 28;
    } else if (_c == QMetaObject::ResetProperty) {
        switch (_id) {
        case 5: resetHAlign(); break;
        }
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 28;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
示例#21
0
void StyledLabel::leaveEvent(QEvent *)
{
    endHoverMode();
    if (resizeMode() == ResizeOnHover)
        setWrapMode(QTextOption::NoWrap);
}
示例#22
0
void StyledLabel::enterEvent(QEvent *)
{
    if (resizeMode() == ResizeOnHover)
        setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
}