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();

  • 相关阅读:
    markdown的使用说明
    iOS开发关于真机—App发布证书和调试证书配置
    iOS开发UI篇—屏幕适配autoResizing autoLayout和sizeClass图文详解
    iOS开发UI篇—模仿ipad版QQ空间登录界面
    iOS开发UI篇—iPad开发中得modal介绍
    iOS开发UI篇—popoverController使用注意
    iOS开发UI篇—popoverController简单介绍
    C语言:二十四 防止头文件被重复包含#ifndef #define #endif
    C语言:二十五 函数中的static例子
    C语言:C运算符优先级
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2764044.html
Copyright © 2011-2022 走看看