• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QLatin1Literal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: resolveFileName

QT_BEGIN_NAMESPACE

static QString resolveFileName(QString fileName, QUrl *url, qreal targetDevicePixelRatio)
{
    // We might use the fileName for loading if url loading fails
    // try to make sure it is a valid file path.
    // Also, QFile{Info}::exists works only on filepaths (not urls)

    if (url->isValid()) {
      if (url->scheme() == QLatin1Literal("qrc")) {
        fileName = fileName.right(fileName.length() - 3);
      }
      else if (url->scheme() == QLatin1Literal("file")) {
        fileName = url->toLocalFile();
      }
    }

    if (targetDevicePixelRatio <= 1.0)
        return fileName;

    // try to find a 2x version

    const int dotIndex = fileName.lastIndexOf(QLatin1Char('.'));
    if (dotIndex != -1) {
        QString at2xfileName = fileName;
        at2xfileName.insert(dotIndex, QStringLiteral("@2x"));
        if (QFile::exists(at2xfileName))  {
            fileName = at2xfileName;
            *url = QUrl(fileName);
        }
    }

    return fileName;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:34,代码来源:qtextimagehandler.cpp


示例2: message_handler

void
message_handler(QtMsgType type, const QMessageLogContext & context, const QString & message)
{
  QString formated_message;
  QString (*formater)(const QString & message_type, const QMessageLogContext & context, const QString & message);
  // formater = format_log;
#ifdef ANDROID
  formater = format_log;
#else
  formater = format_log_with_ansi;
#endif

  switch (type) {
  case QtDebugMsg:
    formated_message = formater(QLatin1Literal("Debug"), context, message);
    break;
  case QtInfoMsg:
    formated_message = formater(QLatin1Literal("Info"), context, message);
    break;
  case QtWarningMsg:
    formated_message = formater(QLatin1Literal("Warning"), context, message);
    break;
  case QtCriticalMsg:
    formated_message = formater(QLatin1Literal("Critical"), context, message);
    break;
  case QtFatalMsg:
    formated_message = formater(QLatin1Literal("Fatal"), context, message);
  }

  // stderr
  fprintf(stdout, formated_message.toStdString().c_str()); //  # QByteArray local_message = message.toLocal8Bit();

  if (type == QtFatalMsg)
    abort();
}
开发者ID:FabriceSalvaire,项目名称:qtcarto,代码行数:35,代码来源:logger.cpp


示例3: updateSvgIds

void GameScene::updateSvgIds()
{
    //Needed so new boundingRects() are read for all SVG elements after a theme change
    // Sanity check, see if game elements already exist
    if (!m_kapmanItem) {
        return;
    }

    // Set the element Id to the right value
    m_mazeItem->setElementId(QLatin1Literal("maze"));

    // Create the KapmanItem
    m_kapmanItem->setElementId(QLatin1Literal("kapman_0"));
    // Corrects the position of the KapmanItem
    m_kapmanItem->update(m_game->getKapman()->getX(), m_game->getKapman()->getY());

    for (int i = 0; i < m_ghostItems.size(); ++i) {
        GhostItem *ghost = m_ghostItems[i];
        ghost->setElementId(m_game->getGhosts()[i]->getImageId());
        ghost->update(m_game->getGhosts()[i]->getX(), m_game->getGhosts()[i]->getY());
    }
    for (int i = 0; i < m_game->getMaze()->getNbRows(); ++i) {
        for (int j = 0; j < m_game->getMaze()->getNbColumns(); ++j) {
            if (m_elementItems[i][j] != NULL) {
                ElementItem *element = m_elementItems[i][j];
                element->setElementId(m_game->getMaze()->getCell(i, j).getElement()->getImageId());
                element->update(m_game->getMaze()->getCell(i, j).getElement()->getX(), m_game->getMaze()->getCell(i, j).getElement()->getY());
            }
        }
    }
}
开发者ID:KDE,项目名称:kapman,代码行数:31,代码来源:gamescene.cpp


示例4: res

QVariantMap PersonInfoData::data() const
{
	QResource res(QLatin1Literal(":/devels/") % ocsUsername % QLatin1Literal(".json"));
	if (!res.isValid())
		res.setFileName(QLatin1Literal(":/contributers/") % ocsUsername % QLatin1Literal(".json"));
	return qutim_resource_open(res);
}
开发者ID:CyberSys,项目名称:qutim,代码行数:7,代码来源:personinfo.cpp


示例5: QLatin1Literal

void KSecretServiceTest::testItems()
{
    auto NEW_ITEM_NAME = QLatin1Literal("Test Item1");
    auto NEW_ITEM_VALUE = QLatin1Literal("highly secret value");
    QDateTime testTime = QDateTime::currentDateTime();

    KSecrets::Secret secret;
    secret.setValue(NEW_ITEM_VALUE);
    auto createRes = collection->createItem(NEW_ITEM_NAME, secret).result();
    QVERIFY(createRes);

    auto foundItems = collection->searchItems(NEW_ITEM_NAME).result();
    QVERIFY(foundItems.length() == 1);

    auto theItem = foundItems.first();
    QCOMPARE(theItem->label().result(), NEW_ITEM_NAME);
    QVERIFY(theItem->createdTime().result() > testTime);
    QVERIFY(theItem->modifiedTime().result() > testTime);

    QDateTime oldModifiedTime = theItem->modifiedTime().result();
    QVERIFY(theItem->setLabel(NEW_ITEM_NAME).result());
    QVERIFY(theItem->modifiedTime().result()
        == oldModifiedTime); // name was the same so item should have stayed
                             // the same

    auto NEW_ITEM_SECOND_NAME = QLatin1Literal("Test Item2");
    QVERIFY(theItem->setLabel(NEW_ITEM_SECOND_NAME).result());
    QCOMPARE(theItem->label().result(), NEW_ITEM_SECOND_NAME);
    QVERIFY(theItem->modifiedTime().result() > oldModifiedTime);

    auto theSecret = theItem->getSecret().result();
    QCOMPARE(theSecret->value().toString(), NEW_ITEM_VALUE);
}
开发者ID:KDE,项目名称:ksecrets,代码行数:33,代码来源:ksecretsservice-test.cpp


示例6: switch

void GhostItem::updateState()
{
    // Stop timers
    if (m_startBlinkingTimer->isActive()) {
        m_startBlinkingTimer->stop();
    }
    if (m_blinkTimer->isActive()) {
        m_blinkTimer->stop();
    }
    switch (((Ghost *)getModel())->getState()) {
    case Ghost::PREY:
        updateBlinkTimersDuration();
        setElementId(QLatin1Literal("scaredghost"));
        m_startBlinkingTimer->start();
        // The ghosts are now weaker than the kapman, so they are under him
        setZValue(1);
        break;
    case Ghost::HUNTER:
        setElementId(((Ghost *)getModel())->getImageId());
        // The ghosts are stronger than the kapman, they are above him
        setZValue(3);
        break;
    case Ghost::EATEN:
        setElementId(QLatin1Literal("ghosteye"));
        // The ghosts are now weaker than the kapman, so they are under him
        setZValue(1);
        break;
    }
}
开发者ID:KDE,项目名称:kapman,代码行数:29,代码来源:ghostitem.cpp


示例7: test_byteArray_equals_latin1Literal

	void test_byteArray_equals_latin1Literal()
	{
		Pillow::ByteArray ba; ba = QByteArray("Some-string");
		QVERIFY(ba == QLatin1Literal("Some-string"));
		QVERIFY(!(ba == QLatin1Literal("Some-other-string")));
		QVERIFY(ba != QLatin1Literal("Some-other-string"));
		QVERIFY(!(ba != QLatin1Literal("Some-string")));
	}
开发者ID:xiaowentao99,项目名称:pillow,代码行数:8,代码来源:ByteArrayHelpersTest.cpp


示例8: QNetworkAccessManager

void RssFeedNode::render(Grantlee::OutputStream* stream, Grantlee::Context* c)
{
  QNetworkAccessManager *mgr = new QNetworkAccessManager(this);
  QUrl url(Grantlee::getSafeString(m_url.resolve(c)));
  QNetworkReply *reply = mgr->get(QNetworkRequest(url));
  QEventLoop eLoop;
  connect( mgr, SIGNAL( finished( QNetworkReply * ) ), &eLoop, SLOT( quit() ) );
  eLoop.exec( QEventLoop::ExcludeUserInputEvents );

  c->push();
  foreach(Grantlee::Node *n, m_childNodes) {
    if (!n->inherits(XmlNamespaceNode::staticMetaObject.className()))
      continue;
    Grantlee::OutputStream _dummy;
    n->render(&_dummy, c);
  }

  QXmlQuery query;
  QByteArray ba = reply->readAll();

  QBuffer buffer;
  buffer.setData(ba);
  buffer.open(QIODevice::ReadOnly);
  query.bindVariable("inputDocument", &buffer);
  QString ns;
  QHash<QString, QVariant> h = c->lookup("_ns").toHash();
  QHash<QString, QVariant>::const_iterator it = h.constBegin();
  const QHash<QString, QVariant>::const_iterator end = h.constEnd();
  for ( ; it != end; ++it ) {
    if (it.key().isEmpty()) {
      ns += QLatin1Literal( "declare default element namespace " ) + QLatin1Literal( " \"" ) + it.value().toString() + QLatin1Literal( "\";\n" );
    } else {
      ns += QLatin1Literal( "declare namespace " ) + it.key() + QLatin1Literal( " = \"" ) + it.value().toString() + QLatin1Literal( "\";\n" );
    }
  }
  query.setQuery(ns + "doc($inputDocument)" + Grantlee::getSafeString(m_query.resolve(c)).get());

  QXmlResultItems result;
  query.evaluateTo(&result);

  QXmlItem item(result.next());
  int count = 0;
  while (!item.isNull()) {
      if (count++ > 20)
        break;
      query.setFocus(item);
      c->push();
      foreach(Grantlee::Node *n, m_childNodes) {
        if (n->inherits(XmlNamespaceNode::staticMetaObject.className()))
          continue;
        c->insert("_q", QVariant::fromValue(query));
        n->render(stream, c);
      }
      c->pop();
      item = result.next();
  }
  c->pop();
}
开发者ID:hicknhack-software,项目名称:Qt-Grantlee,代码行数:58,代码来源:rssfeed.cpp


示例9: QLatin1Literal

void SqlBulkInsert::flush()
{
  if (_pending.size() > 0)
  {
    double start = Tgs::Time::getTime();
    QString sql;
    // the value 22 was found experimentally
    sql.reserve(_pending.size() * _columns.size() * 22);
    sql.append(QLatin1Literal("INSERT INTO ") %
        _tableName %
        QLatin1Literal(" (") %
        _columns.join(",") %
        QLatin1Literal(") VALUES "));

    QLatin1String firstOpenParen("("), openParen(",("), closeParen(")"), comma(",");

    for (int i = 0; i < _pending.size(); i++)
    {
      if (i == 0)
      {
        sql.append(firstOpenParen);
      }
      else
      {
        sql.append(openParen);
      }

      for (int j = 0; j < _columns.size(); j++)
      {
        if (j == 0)
        {
          sql.append(_escape(_pending[i][j]));
        }
        else
        {
          sql.append(comma % _escape(_pending[i][j]));
        }
      }

      sql.append(closeParen);
    }

    //LOG_VAR(sql.size());
    QSqlQuery q(_db);
    if (q.exec(sql) == false)
    {
      throw HootException(QString("Error executing bulk insert: %1 (%2)").arg(q.lastError().text()).
                          arg(sql));
    }

    q.finish();

    _pending.clear();
    double elapsed = Tgs::Time::getTime() - start;
    _time += elapsed;
  }
}
开发者ID:BSteine,项目名称:hootenanny,代码行数:57,代码来源:SqlBulkInsert.cpp


示例10: setElementId

void GhostItem::blink()
{
    CharacterItem::blink();
    if (m_nbBlinks % 2 == 0) {
        setElementId(QLatin1Literal("scaredghost"));
    } else {
        setElementId(QLatin1Literal("whitescaredghost"));
    }
}
开发者ID:KDE,项目名称:kapman,代码行数:9,代码来源:ghostitem.cpp


示例11: init_qt_late

void init_qt_late()
{
	QApplication *application = qApp;
	// tell Qt to use system proxies
	// note: on Linux, "system" == "environment variables"
	QNetworkProxyFactory::setUseSystemConfiguration(true);

	// for Win32 and Qt5 we try to set the locale codec to UTF-8.
	// this makes QFile::encodeName() work.
#ifdef Q_OS_WIN
	QTextCodec::setCodecForLocale(QTextCodec::codecForMib(106));
#endif

	QCoreApplication::setOrganizationName("Subsurface");
	QCoreApplication::setOrganizationDomain("subsurface.hohndel.org");
	// enable user specific settings (based on command line argument)
	if (settings_suffix) {
		if (verbose)
			qDebug() << "using custom config for" << QString("Subsurface-%1").arg(settings_suffix);
		QCoreApplication::setApplicationName(QString("Subsurface-%1").arg(settings_suffix));
	} else {
		QCoreApplication::setApplicationName("Subsurface");
	}
	// find plugins installed in the application directory (without this SVGs don't work on Windows)
	SettingsObjectWrapper::instance()->load();

	QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());
	QLocale loc;
	QString uiLang = uiLanguage(&loc);
	QLocale::setDefault(loc);

	qtTranslator = new QTranslator;
	QString translationLocation;
#if defined(Q_OS_ANDROID)
	translationLocation = QLatin1Literal("assets:/translations");
#elif defined(Q_OS_IOS)
	translationLocation = QLatin1Literal(":/translations/");
#else
	translationLocation = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
#endif
	if (qtTranslator->load(loc, "qt", "_", translationLocation)) {
		application->installTranslator(qtTranslator);
	} else {
		if (uiLang != "en_US" && uiLang != "en-US")
			qDebug() << "can't find Qt localization for locale" << uiLang << "searching in" << translationLocation;
	}
	ssrfTranslator = new QTranslator;
	if (ssrfTranslator->load(loc, "subsurface", "_") ||
	    ssrfTranslator->load(loc, "subsurface", "_", translationLocation) ||
	    ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("translations")) ||
	    ssrfTranslator->load(loc, "subsurface", "_", getSubsurfaceDataPath("../translations"))) {
		application->installTranslator(ssrfTranslator);
	} else {
		qDebug() << "can't find Subsurface localization for locale" << uiLang;
	}
}
开发者ID:neolit123,项目名称:subsurface,代码行数:56,代码来源:qt-init.cpp


示例12: main

int main(int argc, char ** argv) {
    QCoreApplication app(argc, argv);
#if defined(Q_OS_UNIX)
    catchUnixSignals({SIGQUIT, SIGINT, SIGTERM, SIGHUP});
#endif

    app.setApplicationName("helloworld");
    app.setApplicationVersion("1.0.0");

    QCommandLineParser parser;
    parser.setApplicationDescription("a HelloWorld example for http client and server.");
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addPositionalArgument("mode",
            "working mode: server, client or weather. default: server");

//    parser.addOption({
//            {"l", "listen"},
//            "listening tcp port number in server mode (default 8080)",
//            "portNo", "8080"});
//    parser.addOption({
//            {"u", "url"},
//            "fetch url data in client mode",
//            "address", "http://www.google.com"});
//    parser.addOption({
//            {"g", "geolocation"},
//            "a city name [,country name] in weather mode, default: Tehran",
//            "city", "Tehran"});
    parser.process(app);


    QStringList posArgs = parser.positionalArguments();
    if ( posArgs.size() != 1 ) {
        parser.showHelp(0);

    } else {
        const auto& mode = posArgs.at(0);

        if ( mode == QLatin1Literal("server") )
            runServer(parser.value("listen"));

#if defined(QHTTP_HAS_CLIENT)
        else if ( mode == QLatin1Literal("client") )
            runClient(parser.value("url"));

        else if ( mode == QLatin1Literal("weather") )
            runWeatherClient(parser.value("geolocation"));
#else
        else if ( mode == QLatin1Literal("client")
                || mode == QLatin1Literal("weather") )
            qDebug("qhttp::client has not been enabled at build time");
#endif // QHTTP_HAS_CLIENT
    }

    return 0;
}
开发者ID:oliviermaridat,项目名称:qhttp,代码行数:56,代码来源:main.cpp


示例13: SLOT

void MainWindow::setupActions()
{
    KStandardGameAction::gameNew(m_main, SLOT(newGame()), actionCollection());
    KStandardGameAction::restart(m_main, SLOT(restart()), actionCollection());
    KStandardGameAction::highscores(m_main, SLOT(highscores()), actionCollection());
    
    KStandardGameAction::quit(this, SLOT(close()), actionCollection());
    
    QAction* action;
    action = new QAction(i18n("&Single Player"), this);
    action->setIcon(QIcon::fromTheme( QLatin1String( SimpleMenu::iconLocal)));
    actionCollection()->addAction(QLatin1Literal("game_local"), action);
    connect(action, &QAction::triggered, m_main, &PlayField::localGame);
    action = new QAction(i18n("&Host Game..."), this);
    action->setIcon(QIcon::fromTheme( QLatin1String( SimpleMenu::iconServer)));
    actionCollection()->addAction(QLatin1Literal("game_create_server"), action);
    connect(action, &QAction::triggered, m_main, &PlayField::createServer);
    action = new QAction(i18n("&Connect to Game..."), this);
    action->setIcon(QIcon::fromTheme( QLatin1String( SimpleMenu::iconClient))),
    actionCollection()->addAction(QLatin1Literal("game_create_client"), action);
    connect(action, &QAction::triggered, m_main, &PlayField::createClient);
    // settings
    action = new QAction(i18n("Change &Nickname..."), this);
    actionCollection()->addAction(QLatin1Literal("options_nickname"), action);
    connect(action, &QAction::triggered, m_main, &PlayField::changeNick);
    action = new KToggleAction(i18n("&Play Sounds"), this);
    action->setChecked(Settings::enableSounds());
    actionCollection()->addAction(QLatin1Literal("options_sounds"), action);
    connect(action, &QAction::triggered, m_main, &PlayField::toggleSounds);
    // This action will be disabled when a game is being run
    action = new KToggleAction(i18n("&Adjacent Ships"), this);
    action->setChecked(Settings::adjacentShips());
    actionCollection()->addAction(QLatin1Literal("options_adjacent"), action);
    connect(action, &QAction::triggered, m_main, &PlayField::toggleAdjacent);
    // This action will be disabled when a game is being run
    action = new KToggleAction(i18n("&Multiple Ships"), this);
    action->setChecked(Settings::severalShips());
    actionCollection()->addAction(QLatin1Literal("options_multiple_ships"), action);
    connect(action, &QAction::triggered, m_main, &PlayField::toggleMultiple);
    // config end of game message
    action = new KToggleAction(i18n("Show End-of-Game Message"), this);
    action->setChecked(true);
    actionCollection()->addAction(QLatin1Literal("options_show_endgame_message"), action);
    connect(action, &QAction::triggered, m_main, &PlayField::toggleEndOfGameMessage);
    // actions for grid
    action = new KToggleAction(i18n("Show &Left Grid"), this);
    action->setChecked(true);
    actionCollection()->addAction(QLatin1Literal("options_showleftgrid"), action);
    connect(action, &QAction::triggered, m_main, &PlayField::toggleLeftGrid);
    action = new KToggleAction(i18n("Show &Right Grid"), this);
    action->setChecked(true);
    actionCollection()->addAction(QLatin1Literal("options_showrightgrid"), action);
    connect(action, &QAction::triggered, m_main, &PlayField::toggleRightGrid);
    
    setupGUI();
}
开发者ID:KDE,项目名称:knavalbattle,代码行数:56,代码来源:mainwindow.cpp


示例14: QMainWindow

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow())
{
    ui->setupUi(this);

    PositioningMenuBar *menuBar = new PositioningMenuBar(ui->menuBar);

    QMenu *menuOptions = menuBar->addMenu(QLatin1Literal("&Options"));
    menuOptions->addAction(QLatin1Literal("About Qt"));
}
开发者ID:Iownnoname,项目名称:qt,代码行数:11,代码来源:mainwindow.cpp


示例15: config_get_ptr

void ShaderParamsDialog::onShaderLoadPresetClicked()
{
   QString path;
   QString filter;
   QByteArray pathArray;
   struct video_shader *menu_shader = NULL;
   struct video_shader *video_shader = NULL;
   const char *pathData = NULL;
   settings_t *settings = config_get_ptr();
   enum rarch_shader_type type = RARCH_SHADER_NONE;
   bool is_preset = false;

   if (!settings)
      return;

   getShaders(&menu_shader, &video_shader);

   if (!menu_shader)
      return;

   filter = "Shader Preset (";

   /* NOTE: Maybe we should have a way to get a list of all shader types instead of hard-coding this? */
   if (video_shader_is_supported(RARCH_SHADER_CG) &&
         video_shader_get_type_from_ext(file_path_str(FILE_PATH_CGP_EXTENSION), &is_preset)
         != RARCH_SHADER_NONE)
      filter += QLatin1Literal("*") + file_path_str(FILE_PATH_CGP_EXTENSION);

   if (video_shader_is_supported(RARCH_SHADER_GLSL) &&
         video_shader_get_type_from_ext(file_path_str(FILE_PATH_GLSLP_EXTENSION), &is_preset)
         != RARCH_SHADER_NONE)
      filter += QLatin1Literal(" *") + file_path_str(FILE_PATH_GLSLP_EXTENSION);

   if (video_shader_is_supported(RARCH_SHADER_SLANG) &&
         video_shader_get_type_from_ext(file_path_str(FILE_PATH_SLANGP_EXTENSION), &is_preset)
         != RARCH_SHADER_NONE)
      filter += QLatin1Literal(" *") + file_path_str(FILE_PATH_SLANGP_EXTENSION);

   filter += ")";

   path = QFileDialog::getOpenFileName(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET), settings->paths.directory_video_shader, filter);

   if (path.isEmpty())
      return;

   pathArray = path.toUtf8();
   pathData = pathArray.constData();

   type = video_shader_parse_type(pathData, RARCH_SHADER_NONE);

   menu_shader_manager_set_preset(menu_shader, type, pathData);
}
开发者ID:DSkywalk,项目名称:RetroArch,代码行数:52,代码来源:shaderparamsdialog.cpp


示例16: plainTextToHTML

// Qt::convertFromPlainText doesn't do precisely what we want
static QString
plainTextToHTML(const QString & plain, bool multiLine, bool forceNoQuote = false)
{
    int col = 0;
    bool quote = false;
    QString rich;
    for (int i = 0; i < plain.length(); ++i) {
        if (plain[i] == QLatin1Char('\n')){
            if (multiLine) {
                rich += QLatin1String("<br>\n");
            } else {
                rich += QLatin1String("\\n");
            }
            col = 0;
            quote = true;
        } else {
            if (plain[i] == QLatin1Char('\t')){
                if (multiLine) {
                    rich += QChar(0x00a0U);
                    ++col;
                    while (col % 8) {
                        rich += QChar(0x00a0U);
                        ++col;
                    }
                } else {
                    rich += QLatin1String("\\t");
                }
                quote = true;
            } else if (plain[i].isSpace()) {
                rich += QChar(0x00a0U);
                quote = true;
            } else if (plain[i] == QLatin1Char('<')) {
                rich += QLatin1String("&lt;");
            } else if (plain[i] == QLatin1Char('>')) {
                rich += QLatin1String("&gt;");
            } else if (plain[i] == QLatin1Char('&')) {
                rich += QLatin1String("&amp;");
            } else {
                rich += plain[i];
            }
            ++col;
        }
    }

    if (quote && !forceNoQuote) {
        return QLatin1Literal("\"") + rich + QLatin1Literal("\"");
    }

    return rich;
}
开发者ID:dromanov,项目名称:apitrace,代码行数:51,代码来源:apitracecall.cpp


示例17: QcWmtsPlugin

QcGermanyPlugin::QcGermanyPlugin()
  : QcWmtsPlugin(PLUGIN_NAME, PLUGIN_TITLE,
                 new QcMercatorTileMatrixSet(NUMBER_OF_LEVELS, TILE_SIZE))
{

  int map_id = -1;
  add_layer(new QcGermanyLayer(this,
                               ++map_id, // 1
                               1,
                               QLatin1Literal("Map"),
                               QLatin1Literal("webatlasde"),
                               QLatin1Literal("png")
                               ));
}
开发者ID:FabriceSalvaire,项目名称:qtcarto,代码行数:14,代码来源:germany_plugin.cpp


示例18: arguments

QStaticText ApiTraceCall::staticText() const
{
    if (m_staticText && !m_staticText->text().isEmpty())
        return *m_staticText;

    QVariantList argValues = arguments();

    QString richText = QString::fromLatin1(
        "<span style=\"font-weight:bold\">%1</span>(").arg(m_name);
    for (int i = 0; i < m_argNames.count(); ++i) {
        richText += QLatin1String("<span style=\"color:#0000ff\">");
        QString argText = apiVariantToString(argValues[i]);

        //if arguments are really long (e.g. shader text), cut them
        // and elide it
        if (argText.length() > 40) {
            QString shortened = argText.mid(0, 40);
            shortened[argText.length() - 5] = '.';
            shortened[argText.length() - 4] = '.';
            shortened[argText.length() - 3] = '.';
            shortened[argText.length() - 2] = argText[argText.length() - 2];
            shortened[argText.length() - 1] = argText[argText.length() - 1];
            richText += shortened;
        } else {
            richText += argText;
        }
        richText += QLatin1String("</span>");
        if (i < m_argNames.count() - 1)
            richText += QLatin1String(", ");
    }
    richText += QLatin1String(")");
    if (m_returnValue.isValid()) {
        richText +=
            QLatin1Literal(" = ") %
            QLatin1Literal("<span style=\"color:#0000ff\">") %
            apiVariantToString(m_returnValue) %
            QLatin1Literal("</span>");
    }

    if (!m_staticText)
        m_staticText = new QStaticText(richText);
    else
        m_staticText->setText(richText);
    QTextOption opt;
    opt.setWrapMode(QTextOption::NoWrap);
    m_staticText->setTextOption(opt);
    m_staticText->prepare();

    return *m_staticText;
}
开发者ID:mariuz,项目名称:apitrace,代码行数:50,代码来源:apitracecall.cpp


示例19: FakeModem

void BearerPropertiesTest::initTestCase()
{
    fakeModem = new FakeModem();

    modem = new Modem();
    modem->setAccessTechnologies(16);
    modem->SetCurrentBands({0});
    modem->SetCurrentCapabilities(4);
    modem->SetCurrentModes({MM_MODEM_MODE_ANY, MM_MODEM_MODE_NONE});
    modem->setDevice(QLatin1String("/sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2"));
    modem->setDeviceIdentifier(QLatin1String("1c435eb6d74494b5f78d7221e2c5ae9ec526a981"));
    modem->setDrivers({QLatin1String("option1")});
    modem->setEquipmentIdentifier(QLatin1String("353475021085110"));
    modem->setManufacturer(QLatin1String("huawei"));
    modem->setMaxActiveBearers(1);
    modem->setMaxBearers(1);
    modem->setModel(QLatin1String("K2540"));
    //modem->setOwnNumbers();
    modem->setPlugin(QLatin1String("Huawei"));
    modem->setPorts({{QLatin1String("ttyUSB0"), MM_MODEM_PORT_TYPE_AT}, {QLatin1String("ttyUSB1"), MM_MODEM_PORT_TYPE_QCDM}, {QLatin1String("ttyUSB2"), MM_MODEM_PORT_TYPE_AT}});
    modem->SetPowerState(3);
    modem->setPrimaryPort(QLatin1String("ttyUSB2"));
    modem->setRevision(QLatin1String("11.001.05.00.11"));
    modem->setSignalQuality({93, true});
    modem->setSim(QDBusObjectPath("/org/kde/fakemodem/SIM/1"));
    modem->setState(8);
    modem->setStateFailedReason(0);
    modem->setSupportedBands({0});
    modem->setSupportedCapabilities({4});
    modem->setSupportedIpFamilies(3);
    ModemManager::SupportedModesType supportedModes;
    ModemManager::CurrentModesType supportedMode1 = {MM_MODEM_MODE_4G & MM_MODEM_MODE_3G & MM_MODEM_MODE_2G, MM_MODEM_MODE_NONE};
    ModemManager::CurrentModesType supportedMode2 = {MM_MODEM_MODE_4G & MM_MODEM_MODE_3G & MM_MODEM_MODE_2G, MM_MODEM_MODE_2G};
    ModemManager::CurrentModesType supportedMode3 = {MM_MODEM_MODE_4G & MM_MODEM_MODE_3G & MM_MODEM_MODE_2G, MM_MODEM_MODE_3G};
    supportedModes << supportedMode1 << supportedMode2 << supportedMode3;
    modem->setSupportedModes(supportedModes);
    modem->setUnlockRequired(1);
    modem->setUnlockRetries({{MM_MODEM_LOCK_SIM_PIN, 3}, {MM_MODEM_LOCK_SIM_PIN2, 3}, {MM_MODEM_LOCK_SIM_PUK, 10}, {MM_MODEM_LOCK_SIM_PUK2, 10}});

    QSignalSpy addModemSpy(ModemManager::notifier(), SIGNAL(modemAdded(QString)));
    fakeModem->addModem(modem);
    QVERIFY(addModemSpy.wait());

    bearer = new Bearer();
    // We need to set some default values
    bearer->setConnected(false);
    bearer->setInterface(QLatin1String("ttyUSB0"));
    bearer->setIp4Config({{QLatin1String("method"), MM_BEARER_IP_METHOD_PPP}});
    bearer->setIp6Config({{QLatin1String("method"), MM_BEARER_IP_METHOD_UNKNOWN}});
    bearer->setIpTimeout(20);
    bearer->setProperties({{QLatin1String("apn"),QLatin1String("internet")},{QLatin1Literal("ip-type"), 1}, {QLatin1String("number"), QLatin1String("*99#")}});
    bearer->setSuspended(false);
#if MM_CHECK_VERSION(1, 2, 0)
    ModemManager::Modem::Ptr modemInterface = ModemManager::modemDevices().first()->modemInterface();
    QCOMPARE(modemInterface->listBearers().count(), 0);
    QSignalSpy bearerAddedSpy(modemInterface.data(), SIGNAL(bearerAdded(QString)));
    fakeModem->addBearer(bearer);
    QVERIFY(bearerAddedSpy.wait());
#endif
}
开发者ID:KDE,项目名称:modemmanager-qt,代码行数:60,代码来源:bearerpropertiestest.cpp


示例20: slFreshupItem

void TemplKatalogListView::slFreshupItem( QTreeWidgetItem *item, FloskelTemplate *tmpl, bool remChildren )
{
  if( !(item && tmpl) ) return;

  Geld g     = tmpl->unitPrice();
  const QString ck = tmpl->calcKindString();
  const QString t  = Portal::textWrap(tmpl->getText(), 72, 4);

  item->setText( 0, t );
  if( t.endsWith(QLatin1Literal("..."))) {
      item->setToolTip(0, Portal::textWrap(tmpl->getText(), 72, 22));
  }
  QString h;
  h = QString( "%1 / %2" ).arg( g.toString( catalog()->locale() ) )
      .arg( tmpl->unit().einheitSingular() );
  item->setText( 1,  h );
  item->setText( 2, ck );
  // item->setText( 4, QString::number(tmpl->getTemplID()));

  if( remChildren ) {
    /* remove all children and insert them again afterwards.
        * That updates the view
      */
    for( int i = 0; i < item->childCount(); i++ ) {
      QTreeWidgetItem *it = item->child(i);
      if( it )  {
        item->removeChild( it );
        delete it;
      }
    }

    addCalcParts(tmpl); // Insert to update the view again.
  }
}
开发者ID:dragotin,项目名称:kraft,代码行数:34,代码来源:templkataloglistview.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QLatin1String函数代码示例发布时间:2022-05-30
下一篇:
C++ QL_REQUIRE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap