zoukankan      html  css  js  c++  java
  • qt 基础知识 GIS

    (1)  qt 加载dll
    QLibrary
    testlib("H:\\UltraVNCProjectRoot\\UltraVNCProjectRoot\\UltraVNC\\winvnc\\Debug\\winvnc.dll");
    if(testlib.load()){
    typedefbool(*lpfun)(char*hostchar,char*IDchar);
    lpfunp=(lpfun)testlib.resolve("test");
    if(p==NULL)return;
    charstrHost[]="10.21.140.39";chartestID[]="666";p(strHost,testID);return;
    }
    qstring 和LPCWSTR 转换

    QString teststring= QDir::currentPath();
    files=teststring.split("out",QString::KeepEmptyParts,Qt::CaseSensitive);
    QString filepath=files[0].append("/ThirdPartyLib/RemoteTools.dll");

    QString filepath=files[0].append("/ThirdPartyLib/VNC/RemoteTools.dll");

    hmodule=LoadLibrary((LPCWSTR)filepath.utf16());

    qt 隐藏button

     ui->pushButton->hide();//隐藏的情况下,没按就保持隐藏

    qt 给qpushbutton 设置样式表

    用qt designer 打开ui form 选中button 然后属性表设置stylesheet ,复制进去就行了

    QPushButton
    {
    font:bold 17px "微软雅黑";
    color: #FFFFFF;
    background-color: #46aef2;
    border: 0px solid rgba(255,255,255,255);


    }
    QPushButton:hover{background-color:#ffb82f;}
    QPushButton:disabled{background-color:#9c9c9c;color:#c2c2c2;}

     qt 获得某一代码目录下的 .CPP 和。h 的文件 的文件数目  qt里面的例子WordCount

      QStringList files = findFiles("http://www.cnblogs.com/", QStringList() << "*.cpp" << "*.h");

    QStringList findFiles(const QString &startDir, QStringList filters)
    {
        QStringList names;
        QDir dir(startDir);

        foreach (QString file, dir.entryList(filters, QDir::Files))
            names += startDir + "/" + file;

        foreach (QString subdir, dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot))
            names += findFiles(startDir + "/" + subdir, filters);
        return names;
    }

     qDebug() << files.count() << "files";

    qt获得某一文件下的文字数量

    typedef QMap<QString, int> WordCount;

    // countWords counts the words in a single file. This function is// called in parallel by several threads and must be thread// safe.
    WordCount countWords(const QString &file)
    {
        QFile f(file);
        f.open(QIODevice::ReadOnly);
        QTextStream textStream(&f);
        WordCount wordCount;

        while (textStream.atEnd() == false)
            foreach (QString word, textStream.readLine().split(" "))
                wordCount[word] += 1;

        return wordCount;
    }

    QString 转成char *

    QString requestID;

    char* ch;
    QByteArray ba = requestID.toLatin1();

    ch=ba.data();

  • 相关阅读:
    TensorFlow设置GPU占用量
    与服务器同步工程(expect脚本)
    C/C++中#pragma once的使用
    sublime text 3 快捷键大全
    Sublime Text 3 注册码
    如何用diff比较两个文件夹下的内容
    Error in building opencv with ffmpeg
    opencv: Rotate image by 90, 180 or 270 degrees
    初识HTTPS
    Unity3D之Mecanim动画系统学习笔记(十一):高级功能应用
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2764044.html
Copyright © 2011-2022 走看看