当前位置: 首页>>代码示例>>C++>>正文


C++ qFatal函数代码示例

本文整理汇总了C++中qFatal函数的典型用法代码示例。如果您正苦于以下问题:C++ qFatal函数的具体用法?C++ qFatal怎么用?C++ qFatal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qFatal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: true

/*!
forks the current Process
you can specify weather it will write a pidfile to /var/run/mydaemon.pid or not
if you specify true (the default) QxtDaemon will also try to lock the pidfile. If it can't get a lock it will assume another daemon of the same name is already running and exit
be aware that after calling this function all file descriptors are invalid. QFile will not detect the change, you have to explicitly close all files before forking.
return true on success
*/
bool QxtDaemon::daemonize(bool pidfile)
{
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
    if (!logfile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
        qFatal("cannot open logfile %s", qPrintable(logfile->fileName()));
    logfile->close();



    if (pidfile)
    {
        QFile f("/var/run/" + m_name + ".pid");
        if (!f.open(QIODevice::WriteOnly | QIODevice::Text))
            qFatal("cannot open pidfile \"/var/run/%s.pid\"", qPrintable(m_name));
        if (lockf(f.handle(), F_TEST, 0) < 0)
            qFatal("can't get a lock on \"/var/run/%s.pid\". another instance is propably already running.", qPrintable(m_name));
        f.close();
    }

    if (!logfile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
        qFatal("cannot open logfile %s", qPrintable(logfile->fileName()));
    logfile->close();

    int i;
    if (getppid() == 1) return true; /* already a daemon */
    i = fork();


    /* double fork.*/
    if (i < 0) return false;  /*fork error    */
    if (i > 0) exit(0);     /*parent exits  */
    if (i < 0) return false;  /*fork error    */
    if (i > 0) exit(0);     /*parent exits  */

    /* child (daemon) continues */
    setsid(); /* obtain a new process group */

    for (i = getdtablesize();i >= 0;--i) close(i); /* close all descriptors */


#ifdef Q_OS_LINUX
    ::umask(027); /* some programmers don't understand security, so we set a sane default here */
#endif
    ::signal(SIGCHLD, SIG_IGN); /* ignore child */
    ::signal(SIGTSTP, SIG_IGN); /* ignore tty signals */
    ::signal(SIGTTOU, SIG_IGN);
    ::signal(SIGTTIN, SIG_IGN);
    ::signal(SIGHUP,  QxtDaemon::signalHandler); /* catch hangup signal */
    ::signal(SIGTERM, QxtDaemon::signalHandler); /* catch kill signal */

    if (pidfile)
    {
        int lfp =::open(qPrintable("/var/run/" + m_name + ".pid"), O_RDWR | O_CREAT, 0640);
        if (lfp < 0)
            qFatal("cannot open pidfile \"/var/run/%s.pid\"", qPrintable(m_name));
        if (lockf(lfp, F_TLOCK, 0) < 0)
            qFatal("can't get a lock on \"/var/run/%s.pid\". another instance is propably already running.", qPrintable(m_name));

        QByteArray d = QByteArray::number(pid());
        Q_UNUSED(::write(lfp, d.constData(), d.size()));
    }


    assert(logfile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append));
    qInstallMsgHandler(QxtDaemon::messageHandler);

    return true;
#else
    return false;
#endif
}
开发者ID:MorS25,项目名称:OpenPilot,代码行数:78,代码来源:qxtdaemon.cpp

示例2: qFatal

void QAdoptedThread::run()
{
    // this function should never be called
    qFatal("QAdoptedThread::run(): Internal error, this implementation should never be called.");
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:5,代码来源:qthread.cpp

示例3: qDebug

void XmlRpcServer::registerSlot( QObject *receiver, const char *slot, QByteArray path )
{
    #ifdef DEBUG_XMLRPC
    qDebug() << this << "registerSlot():" << receiver << slot;
    #endif

    /* skip code first symbol 1 from SLOT macro (from qobject.cpp) */
    ++slot;

    /* find QMetaMethod.. */
    const QMetaObject   *mo= receiver->metaObject();

    /* we need buf in memory for const char (from qobject.cpp) */
    QByteArray          method= QMetaObject::normalizedSignature( slot );
    const char          *normalized= method.constData();
    int                 slotId= mo->indexOfSlot( normalized );
    if ( slotId == -1 )
        {
            qCritical() << this << "registerSlot():" << receiver << normalized << "can't find slot";
            qFatal( "programming error" );
        }

    QMetaMethod m= receiver->metaObject()->method( slotId );
    bool        isDefferedResult= !qstrcmp( m.typeName(), "DeferredResult*" );
    if ( qstrcmp( m.typeName(), "QVariant") && !isDefferedResult )
        {
            qCritical() << this << "registerSlot():" << receiver << normalized
                        << "rpc return type should be QVariant or DeferredResult*, but"
                        << m.typeName();
            qFatal( "programming error" );
        }

    foreach( QByteArray c, m.parameterTypes() ) if ( c != "QVariant" )
        {
            qCritical() << this << "registerSlot():" << receiver << normalized
                        << "all parameters should be QVariant";
            qFatal( "programming error" );
        }

    /* ok, now lets make just function name from our SLOT */
    Q_ASSERT( method.indexOf( '(') > 0 );
    method.truncate( method.indexOf( '(') );
    if ( path[0] != '/' )
        path.prepend( '/' );
    if ( path[path.size() - 1] != '/' )
        path.append( '/' );
    method.prepend( path );

    /* check if allready exists */
    if ( callbacks.contains( method) )
        {
            qCritical() << this << "registerSlot():" << receiver << method
                        << "allready registered, receiver" << callbacks[method];
            qFatal( "programming error" );
        }

    callbacks[method]= IsMethodDeffered( receiver, isDefferedResult );

    Methods &methods= objectMethods[receiver];
    if ( methods.isEmpty() )
        {
            #ifdef DEBUG_XMLRPC
            qDebug() << this << "registerSlot(): connecting SIGNAL(destroyed()) of" << receiver;
            #endif
            connect( receiver, SIGNAL( destroyed ( QObject * )), this, SLOT( slotReceiverDestroed ( QObject * )) );
        }
开发者ID:shaosHumbleAccount,项目名称:qtxmlrpc,代码行数:66,代码来源:xmlrpcserver.cpp

示例4: QObject

QDeclarativeAnchors::QDeclarativeAnchors(QObject *parent)
  : QObject(*new QDeclarativeAnchorsPrivate(0), parent)
{
    qFatal("QDeclarativeAnchors::QDeclarativeAnchors(QObject*) called");
}
开发者ID:wpbest,项目名称:copperspice,代码行数:5,代码来源:qdeclarativeanchors.cpp

示例5: initialize

    void initialize() override
	{
		OpenGLWindow::initialize();

		//load shaders
		{
			QOpenGLShader vs(QOpenGLShader::Vertex);
				vs.compileSourceFile("TessellationTerrain/main.vs.glsl");
				mProgram.addShader(&vs);

			QOpenGLShader tcs(QOpenGLShader::TessellationControl);
				tcs.compileSourceFile("TessellationTerrain/main.tcs.glsl");
				mProgram.addShader(&tcs);

			QOpenGLShader tes(QOpenGLShader::TessellationEvaluation);
				tes.compileSourceFile("TessellationTerrain/main.tes.glsl");
				mProgram.addShader(&tes);

			QOpenGLShader fs(QOpenGLShader::Fragment);
				fs.compileSourceFile("TessellationTerrain/main.fs.glsl");
				mProgram.addShader(&fs);

			if (!mProgram.link())
				qFatal("Error linking shaders");
		}

		//grab uniform locations
		{
			mUniforms.mvMatrix = mProgram.uniformLocation("mvMatrix");
			mUniforms.mvpMatrix = mProgram.uniformLocation("mvpMatrix");
			mUniforms.projMatrix = mProgram.uniformLocation("projMatrix");
			mUniforms.dmapDepth = mProgram.uniformLocation("dmapDepth");
		}

		mVao.bind();
		glPatchParameteri(GL_PATCH_VERTICES, 4);
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

		//build displacment map
		{
			QVector<GLubyte> displacmentMap;
			displacmentMap.reserve(mSize*mSize);

			std::srand(35456);
		
			for (int i=0; i<mSize*mSize; i++)
				displacmentMap.append(randInt(0, 255));

			glGenTextures(1, &tex);
			glBindTexture(GL_TEXTURE_2D, tex);
			glTexStorage2D(GL_TEXTURE_2D, 1, GL_R8, mSize, mSize);
			glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, mSize, mSize, GL_R, GL_UNSIGNED_BYTE, &displacmentMap[0]);
		}

		//load terrain texture
		{
			glActiveTexture(GL_TEXTURE1);
			mTerrainTexture = QSharedPointer<QOpenGLTexture>(new QOpenGLTexture(QImage("./Common/dirt.png").mirrored()));
			mTerrainTexture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
			mTerrainTexture->setMagnificationFilter(QOpenGLTexture::Linear);
		}
	}
开发者ID:DanWatkins,项目名称:OpenGLStudy,代码行数:62,代码来源:TessellationTerrain.cpp

示例6: Q_onAssert

//****************************************************************************
void Q_onAssert(char_t const * const module, int loc) {
    QS_ASSERTION(module, loc, 10000U); // send assertion info to the QS trace
    qFatal("Assertion failed in module %s, location %d", module, loc);
}
开发者ID:alisonjoe,项目名称:qpcpp,代码行数:5,代码来源:bsp.cpp

示例7: qFatal

QString QFont::lastResortFont() const
{
    qFatal("QFont::lastResortFont: Cannot find any reasonable font");
    // Shut compiler up
    return QString();
}
开发者ID:2011fuzhou,项目名称:vlc-2.1.0.subproject-2010,代码行数:6,代码来源:qfont_qws.cpp

示例8: qDebug

syncManagerType::syncManagerType(QDomElement element, bool verbose)
{
    QString attributeStr;
    verb = verbose;

    // Parse value for SM type
    if (element.text().compare("MBoxOut") == 0)
    {
        if (verb)
            qDebug()<<"--SM type: MBoxOut";
        smType = mailboxOut;
    }
    else if (element.text().compare("MBoxIn") == 0)
    {
        if (verb)
            qDebug()<<"--SM type: MBoxIn";
        smType = mailboxIn;
    }
    else if (element.text().compare("Outputs") == 0)
    {
        if (verb)
            qDebug()<<"--SM type: Outputs";
        smType = processDataOut;
    }
    else if (element.text().compare("Inputs") == 0)
    {
        if (verb)
            qDebug()<<"--SM type: Inputs";
        smType = processDataIn;
    }
    else
    {
        if (verb)
            qDebug()<<"--SM type: Unused";
        smType = unused;
        phyStartAddr = 0;
        length = 0;
        controlRegister = 0;
        enable = false;
        virtualSM = false;
        opOnly = false;
        return;
    }

    attributeStr.clear();
    attributeStr = element.attribute("StartAddress");
    if (!attributeStr.isEmpty())
    {
        if (verb)
            qDebug()<<"--Found start address with value:"<<attributeStr;
        // since it would appear the default hex encoding is #x0000 then we need to catch this our selves
        if ((attributeStr.at(0) == '#') && (attributeStr.at(1) == 'x'))
            phyStartAddr = attributeStr.remove(0,2).toInt(0,16);
        else
            phyStartAddr = attributeStr.toInt(0,0);
    }
    else
        qFatal("No start address found for sync manager");

    attributeStr.clear();
    attributeStr = element.attribute("ControlByte");
    if (!attributeStr.isEmpty())
    {
        if (verb)
            qDebug()<<"--Found ControlByte with value:"<<attributeStr;
        // since it would appear the default hex encoding is #x0000 then we need to catch this our selves
        if ((attributeStr.at(0) == '#') && (attributeStr.at(1) == 'x'))
            controlRegister = attributeStr.remove(0,2).toInt(0,16);
        else
            controlRegister = attributeStr.toInt(0,0);
    }
    else
        controlRegister = 0;

    attributeStr.clear();
    attributeStr = element.attribute("DefaultSize");
    if (!attributeStr.isEmpty())
    {
        if (verb)
            qDebug()<<"--Found DefaultSize with value:"<<attributeStr;
        // since it would appear the default hex encoding is #x0000 then we need to catch this our selves
        if ((attributeStr.at(0) == '#') && (attributeStr.at(1) == 'x'))
            length = attributeStr.remove(0,2).toInt(0,16);
        else
            length = attributeStr.toInt(0,0);
    }
    else
        length = 0;

    attributeStr.clear();
    attributeStr = element.attribute("Enable");
    if (!attributeStr.isEmpty())
    {
        if (verb)
            qDebug()<<"--Found Enable attribute with value:"<<attributeStr;
        if ((attributeStr.at(0) == '#') && (attributeStr.at(1) == 'x'))
            enable = attributeStr.remove(0,2).toInt(0,16) != 0;
        else
            enable = attributeStr.toInt(0,0) != 0;
    }
//.........这里部分代码省略.........
开发者ID:alireza1405,项目名称:medulla,代码行数:101,代码来源:syncmanagertype.cpp

示例9: qFatal

void Platform::Assert(const char *c, const char *file, int line)
{
    qFatal("Assertion [%s] failed at %s %d\n", c, file, line);
}
开发者ID:jzsun,项目名称:raptor,代码行数:4,代码来源:PlatQt.cpp

示例10: main

Q_DECL_EXPORT
#endif
int main(int argc, char *argv[])
{
#if defined(Q_WS_X11)
#if QT_VERSION >= 0x040800
    QApplication::setAttribute(Qt::AA_X11InitThreads, true);
#else
    XInitThreads();
    QApplication::setAttribute(static_cast<Qt::ApplicationAttribute>(10), true);
#endif
#endif

    QApplication *application;
    QDeclarativeView *view;
#ifdef HARMATTAN_BOOSTER
    application = MDeclarativeCache::qApplication(argc, argv);
    view = MDeclarativeCache::qDeclarativeView();
#else
    qWarning() << Q_FUNC_INFO << "Warning! Running without booster. This may be a bit slower.";
    QApplication stackApp(argc, argv);
    QmlApplicationViewer stackView;
    application = &stackApp;
    view = &stackView;
    stackView.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
#endif
    application->setQuitOnLastWindowClosed(true);

    // FIXME uncommenting this will make UI not loaded
    // QMozContext::GetInstance();

    QString path;
    QString urlstring;
    QString qmlstring;
#ifdef __arm__
    bool isFullscreen = true;
#else
    bool isFullscreen = false;
#endif
#if !defined(Q_WS_MAEMO_5)
    bool glwidget = true;
#else
    bool glwidget = false;
#endif
    QStringList arguments = application->arguments();
    for (int i = 0; i < arguments.count(); ++i) {
        QString parameter = arguments.at(i);
        if (parameter == "-path") {
            if (i + 1 >= arguments.count())
                qFatal("-path requires an argument");
            path = arguments.at(i + 1);
            i++;
        } else if (parameter == "-url") {
            if (i + 1 >= arguments.count())
                qFatal("-url requires an argument");
            urlstring = arguments.at(i + 1);
            i++;
        } else if (parameter == "-qml") {
            if (i + 1 >= arguments.count())
                qFatal("-qml requires an argument");
            qmlstring = arguments.at(i + 1);
            i++;
        } else if (parameter == "-fullscreen") {
            isFullscreen = true;
        } else if (parameter == "-no-glwidget") {
            glwidget = false;
        } else if (parameter == "-glwidget") {
            glwidget = true;
        } else if (parameter == "-help") {
            qDebug() << "EMail application";
            qDebug() << "-fullscreen   - show QML fullscreen";
            qDebug() << "-path         - path to cd to before launching -url";
            qDebug() << "-qml          - file to launch (default: main.qml inside -path)";
            qDebug() << "-url          - url to load";
            qDebug() << "-no-glwidget  - Don't use QGLWidget viewport";
            exit(0);
        } 
    }

    if (!path.isEmpty())
        QDir::setCurrent(path);

    qmlRegisterType<QMozContext>("QtMozilla", 1, 0, "QMozContext");
    qmlRegisterType<QGraphicsMozView>("QtMozilla", 1, 0, "QGraphicsMozView");
    qmlRegisterType<QDeclarativeMozView>("QtMozilla", 1, 0, "QDeclarativeMozView");

    QUrl qml;
    if (qmlstring.isEmpty())
#if defined(__arm__) && !defined(Q_WS_MAEMO_5)
        qml = QUrl("qrc:/qml/main_meego.qml");
#else
        qml = QUrl("qrc:/qml/main.qml");
#endif
    else
开发者ID:romaxa,项目名称:qmlmozbrowser,代码行数:94,代码来源:main.cpp

示例11: switch

QVariant Dot3Protocol::fieldData(int index, FieldAttrib attrib,
        int streamIndex) const
{
    switch (index)
    {
        case dot3_length:
            switch(attrib)
            {
                case FieldName:            
                    return QString("Length");
                case FieldValue:
                {
                    quint16 len = data.is_override_length() ?
                        data.length() : protocolFramePayloadSize(streamIndex);
                    return len;
                }
                case FieldTextValue:
                {
                    quint16 len = data.is_override_length() ?
                        data.length() : protocolFramePayloadSize(streamIndex);

                    return QString("%1").arg(len);
                }
                case FieldFrameValue:
                {
                    quint16 len = data.is_override_length() ?
                        data.length() : protocolFramePayloadSize(streamIndex);
                    QByteArray fv;

                    fv.resize(2);
                    qToBigEndian(len, (uchar*) fv.data());
                    return fv;
                }
                case FieldBitSize:
                    return 16;
                default:
                    break;
            }
            break;

        // Meta fields
        case dot3_is_override_length:
        {
            switch(attrib)
            {
                case FieldValue:
                    return data.is_override_length();
                default:
                    break;
            }
            break;
        }

        default:
            qFatal("%s: unimplemented case %d in switch", __PRETTY_FUNCTION__,
                index);
            break;
    }

    return AbstractProtocol::fieldData(index, attrib, streamIndex);
}
开发者ID:aromakh,项目名称:ostinato,代码行数:61,代码来源:dot3.cpp

示例12: while

Scanner::Token Scanner::nextToken() {
    Token tok = NoToken;

    // remove whitespace
    while (m_pos < m_length && m_chars[m_pos] == ' ') {
        ++m_pos;
    }

    m_token_start = m_pos;

    while (m_pos < m_length) {

        const QChar &c = m_chars[m_pos];

        if (tok == NoToken) {
            switch (c.toLatin1()) {
                case '*': tok = StarToken; break;
                case '&': tok = AmpersandToken; break;
                case '<': tok = LessThanToken; break;
                case '>': tok = GreaterThanToken; break;
                case ',': tok = CommaToken; break;
                case '(': tok = OpenParenToken; break;
                case ')': tok = CloseParenToken; break;
                case '[': tok = SquareBegin; break;
                case ']' : tok = SquareEnd; break;
                case ':':
                    tok = ColonToken;
                    Q_ASSERT(m_pos + 1 < m_length);
                    ++m_pos;
                    break;
                default:
                    if (c.isLetterOrNumber() || c == '_')
                        tok = Identifier;
                    else
                        qFatal("Unrecognized character in lexer: %c", c.toLatin1());
                    break;
            }
        }

        if (tok <= GreaterThanToken) {
            ++m_pos;
            break;
        }

        if (tok == Identifier) {
            if (c.isLetterOrNumber() || c == '_')
                ++m_pos;
            else
                break;
        }
    }

    if (tok == Identifier && m_pos - m_token_start == 5) {
        if (m_chars[m_token_start] == 'c'
                && m_chars[m_token_start + 1] == 'o'
                && m_chars[m_token_start + 2] == 'n'
                && m_chars[m_token_start + 3] == 's'
                && m_chars[m_token_start + 4] == 't')
            tok = ConstToken;
    }

    return tok;

}
开发者ID:qtjambi,项目名称:qtjambi-community-maven,代码行数:64,代码来源:typeparser.cpp

示例13: qFatal

	QObject* Plugin::component(ComponentType componentType, QObject*)
	{
		qFatal("Plugin '%s' was asked to create a component of type %d", qPrintable(uniqueId()), componentType);
		return 0; // -Wall -Werror
	}
开发者ID:fredemmott,项目名称:jerboa,代码行数:5,代码来源:JerboaPlugin.cpp

示例14: qWarning


//.........这里部分代码省略.........
#ifdef __OPTIMIZE__
    case DBUS_TYPE_BYTE:
    case DBUS_TYPE_BOOLEAN:
    case DBUS_TYPE_INT16:
    case DBUS_TYPE_UINT16:
    case DBUS_TYPE_INT32:
    case DBUS_TYPE_UINT32:
    case DBUS_TYPE_INT64:
    case DBUS_TYPE_UINT64:
    case DBUS_TYPE_DOUBLE:
        qIterAppend(&iterator, ba, *signature, arg.constData());
        return true;

    case DBUS_TYPE_STRING:
    case DBUS_TYPE_OBJECT_PATH:
    case DBUS_TYPE_SIGNATURE: {
        const QByteArray data =
            reinterpret_cast<const QString *>(arg.constData())->toUtf8();
        const char *rawData = data.constData();
        qIterAppend(&iterator, ba, *signature, &rawData);
        return true;
    }
#else
    case DBUS_TYPE_BYTE:
        append( qvariant_cast<uchar>(arg) );
        return true;
    case DBUS_TYPE_BOOLEAN:
        append( arg.toBool() );
        return true;
    case DBUS_TYPE_INT16:
        append( qvariant_cast<short>(arg) );
        return true;
    case DBUS_TYPE_UINT16:
        append( qvariant_cast<ushort>(arg) );
        return true;
    case DBUS_TYPE_INT32:
        append( static_cast<dbus_int32_t>(arg.toInt()) );
        return true;
    case DBUS_TYPE_UINT32:
        append( static_cast<dbus_uint32_t>(arg.toUInt()) );
        return true;
    case DBUS_TYPE_INT64:
        append( arg.toLongLong() );
        return true;
    case DBUS_TYPE_UINT64:
        append( arg.toULongLong() );
        return true;
    case DBUS_TYPE_DOUBLE:
        append( arg.toDouble() );
        return true;
    case DBUS_TYPE_STRING:
        append( arg.toString() );
        return true;
    case DBUS_TYPE_OBJECT_PATH:
        append( qvariant_cast<QDBusObjectPath>(arg) );
        return true;
    case DBUS_TYPE_SIGNATURE:
        append( qvariant_cast<QDBusSignature>(arg) );
        return true;
#endif

    // compound types:
    case DBUS_TYPE_VARIANT:
        // nested QVariant
        return append( qvariant_cast<QDBusVariant>(arg) );

    case DBUS_TYPE_ARRAY:
        // could be many things
        // find out what kind of array it is
        switch (arg.type()) {
        case QVariant::StringList:
            append( arg.toStringList() );
            return true;

        case QVariant::ByteArray:
            append( arg.toByteArray() );
            return true;

        default:
            ;                   // fall through
        }
        // fall through

    case DBUS_TYPE_STRUCT:
    case DBUS_STRUCT_BEGIN_CHAR:
        return appendRegisteredType( arg );

    case DBUS_TYPE_DICT_ENTRY:
    case DBUS_DICT_ENTRY_BEGIN_CHAR:
        qFatal("QDBusMarshaller::appendVariantInternal got a DICT_ENTRY!");
        return false;

    default:
        qWarning("QDBusMarshaller::appendVariantInternal: Found unknown D-BUS type '%s'",
                 signature);
        return false;
    }

    return true;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:101,代码来源:qdbusmarshaller.cpp

示例15: qFatal

void MScore::init()
      {
      if (!QMetaType::registerConverter<Spatium, double>(&Spatium::toDouble))
            qFatal("registerConverter Spatium::toDouble failed");
      if (!QMetaType::registerConverter<double, Spatium>(&doubleToSpatium))
            qFatal("registerConverter douobleToSpatium failed");
      if (!QMetaType::registerConverter<int, TextStyleType>(&intToTextStyleType))
            qFatal("registerConverter intToTextStyleType failed");

#ifdef SCRIPT_INTERFACE
      qRegisterMetaType<Element::Type>     ("ElementType");
      qRegisterMetaType<Note::ValueType>   ("ValueType");

      qRegisterMetaType<Direction::E>("Direction");

      qRegisterMetaType<MScore::DirectionH>("DirectionH");
      qRegisterMetaType<Element::Placement>("Placement");
      qRegisterMetaType<Spanner::Anchor>   ("Anchor");
      qRegisterMetaType<NoteHead::Group>   ("NoteHeadGroup");
      qRegisterMetaType<NoteHead::Type>("NoteHeadType");
      qRegisterMetaType<Segment::Type>("SegmentType");
      qRegisterMetaType<FiguredBassItem::Modifier>("Modifier");
      qRegisterMetaType<FiguredBassItem::Parenthesis>("Parenthesis");
      qRegisterMetaType<FiguredBassItem::ContLine>("ContLine");
      qRegisterMetaType<Volta::Type>("VoltaType");
      qRegisterMetaType<Ottava::Type>("OttavaType");
      qRegisterMetaType<Trill::Type>("TrillType");
      qRegisterMetaType<Dynamic::Range>("DynamicRange");
      qRegisterMetaType<Jump::Type>("JumpType");
      qRegisterMetaType<Marker::Type>("MarkerType");
      qRegisterMetaType<Beam::Mode>("BeamMode");
      qRegisterMetaType<HairpinType>("HairpinType");
      qRegisterMetaType<Lyrics::Syllabic>("Syllabic");
      qRegisterMetaType<LayoutBreak::Type>("LayoutBreakType");
      qRegisterMetaType<Glissando::Type>("GlissandoType");

      //classed enumerations
      qRegisterMetaType<MSQE_TextStyleType::E>("TextStyleType");
      qRegisterMetaType<MSQE_BarLineType::E>("BarLineType");
#endif
      qRegisterMetaType<Fraction>("Fraction");

//      DPMM = DPI / INCH;       // dots/mm

#ifdef Q_OS_WIN
      QDir dir(QCoreApplication::applicationDirPath() + QString("/../" INSTALL_NAME));
      _globalShare = dir.absolutePath() + "/";
#elif defined(Q_OS_IOS)
      {
      extern QString resourcePath();
      _globalShare = resourcePath();
      }

#elif defined(Q_OS_MAC)
      QDir dir(QCoreApplication::applicationDirPath() + QString("/../Resources"));
      _globalShare = dir.absolutePath() + "/";
#else
      // Try relative path (needed for portable AppImage and non-standard installations)
      QDir dir(QCoreApplication::applicationDirPath() + QString("/../share/" INSTALL_NAME));
      if (dir.exists())
            _globalShare = dir.absolutePath() + "/";
      else // Fall back to default location (e.g. if binary has moved relative to share)
            _globalShare = QString( INSTPREFIX "/share/" INSTALL_NAME);
#endif

      selectColor[0].setNamedColor("#1259d0");   //blue
      selectColor[1].setNamedColor("#009234");   //green
      selectColor[2].setNamedColor("#c04400");   //orange
      selectColor[3].setNamedColor("#70167a");   //purple

      defaultColor        = Qt::black;
      dropColor           = QColor("#1778db");
      defaultPlayDuration = 300;      // ms
      warnPitchRange      = true;
      playRepeats         = true;
      panPlayback         = true;

      lastError           = "";

      layoutBreakColor    = QColor("#5999db");
      frameMarginColor    = QColor("#5999db");
      bgColor.setNamedColor("#dddddd");

      _defaultStyle         = new MStyle();
      Ms::initStyle(_defaultStyle);
      _defaultStyleForParts = 0;
      _baseStyle            = new MStyle(*_defaultStyle);

      //
      //  load internal fonts
      //
      //
      // do not load application specific fonts
      // for MAC, they are in Resources/fonts
      //
#if !defined(Q_OS_MAC) && !defined(Q_OS_IOS)
      static const char* fonts[] = {
            ":/fonts/musejazz/MuseJazzText.ttf",
            ":/fonts/FreeSans.ttf",
            ":/fonts/FreeSerif.ttf",
//.........这里部分代码省略.........
开发者ID:ajyoon,项目名称:MuseScore,代码行数:101,代码来源:mscore.cpp


注:本文中的qFatal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。