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


C++ QApplication::applicationVersion方法代码示例

本文整理汇总了C++中QApplication::applicationVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ QApplication::applicationVersion方法的具体用法?C++ QApplication::applicationVersion怎么用?C++ QApplication::applicationVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QApplication的用法示例。


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

示例1: showVersion

static void showVersion (const QApplication& app) {
    std::cout << QString("VdomBrowser version %1\n"
        "Copyright (c) 2009 by Yahoo! China EEEE Works, Alibaba Inc.\n"
        ).arg(app.applicationVersion()).toUtf8().data();
}
开发者ID:Kayven,项目名称:qcontent,代码行数:5,代码来源:main.cpp

示例2: ico

BaseWindow::BaseWindow(QWidget *parent)
    : QWidget(parent), ui(new Ui::BaseWindow)
{
    this->setAttribute(Qt::WA_QuitOnClose, false);
    serverCounter = 1;
    ui->setupUi(this);

    QApplication *app = (QApplication*)QApplication::instance();
    this->setWindowTitle(QString("%1 %2 (v%3)").arg(app->organizationName(), app->applicationName(), app->applicationVersion()));

    // Icon
    QIcon ico(":resources/RKnock.ico");
    this->setWindowIcon(ico);

    // Find the config file, does it exist?
#ifdef Q_WS_WIN
    QString fSection;
    QString mSection;
    QString lSection = "Settings.xml";

    if (QSysInfo::windowsVersion() < QSysInfo::WV_2000)
    {
        // All Versions before win2000
        fSection = QDir::currentPath(); // Where we are :)
        mSection = "";
    }
    else if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA)
    {
        fSection = QDir::homePath();
        mSection = QString("Application Data/%1/%2").arg(app->organizationName(), app->applicationName());
    }
    else
    {
        fSection = QDir::homePath();
        mSection = QString("AppData/Roaming/%1/%2").arg(app->organizationName(), app->applicationName());
    }

    if (mSection.size() == 0)
        this->cfgFileLocation = QString("%1/%2").arg(fSection, lSection);
    else
        this->cfgFileLocation = QString("%1/%2/%3").arg(fSection, mSection, lSection);

    //this->cfgFileLocation = QtDir::homePath().append("\\").append("
#else
    QString path = QString("%1/.%2/%3").arg(QDir::homePath(), app->organizationName(), app->applicationName());
    QString file = QString("%1/Settings.xml").arg(path);

    this->cfgFileLocation = file;
#endif

    if (QFile(this->cfgFileLocation).exists())
        this->loadSettings();

    this->tray = new QSystemTrayIcon(this);
    this->trayMenu = new QMenu(this);
    this->trayServersMenu = new QMenu("Servers", this->trayMenu);

    this->tray->setContextMenu(this->trayMenu);
    this->tray->setIcon(ico);
    this->tray->setVisible(true);

    QAction *subaction = 0;
    QMenu *submenu = 0;

    // Open Dialog
    subaction = this->trayMenu->addAction("Open Configuration Dialog...");
    connect(subaction, SIGNAL(triggered()), this, SLOT(show()));

    subaction = this->trayMenu->addAction("About RKnock...");
    connect(subaction, SIGNAL(triggered()), this, SLOT(showAbout()));

    this->trayMenu->addMenu(trayServersMenu);

    this->trayMenu->addSeparator();
    subaction = this->trayMenu->addAction("Exit...");
    connect(subaction, SIGNAL(triggered()), app, SLOT(quit()));

    connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(activateMenu(QSystemTrayIcon::ActivationReason)));

    this->rebuildActions();
}
开发者ID:Reanmachine,项目名称:RKnock,代码行数:81,代码来源:basewindow.cpp


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