小编Nym*_*ria的帖子

QCommandLineOption无法获得选项

我QCommandLineOption 用来解析我的commande行选项.

这是我的Arguments班级:

#include "arguments.h"
#include <QDebug>

/**
 * @brief Constructor, need to know QApplication pointer
 * @param app
 */
Arguments::Arguments(QApplication *app)
{
    parser.setApplicationDescription("Convert html doc to pdf");
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addPositionalArgument("source", QApplication::translate("main", "Source file to copy."));
    parser.addPositionalArgument("destination", QApplication::translate("main", "Destination file (ie /home/morgan/test.pdf)"));

    setOption();

    // Process the actual command line arguments given by the user
    parser.process(*app);
    args = parser.positionalArguments();
}

/**
 * @brief Arguments::getSource
 * @return QString the full path to file to be converted
 */
QString Arguments::getSource() …
Run Code Online (Sandbox Code Playgroud)

c++ qt

7
推荐指数
2
解决办法
4731
查看次数

如何在另一个之前执行线程?

我有一个小问题.

我有两个主题:

  • HelloThread - 这打印"你好"五次.
  • GoodbyeThread - 这五次打印"再见".

我想先跑,HelloThread然后GoodbyeThread跑完了.
我已经用信号量解决了这个问题(但信号量并不是真正的java方式,它更多的是C方式).

HelloThread.java

    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package modifiedthreadhellogoodbye;

    import static java.lang.Thread.sleep;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import java.util.concurrent.Semaphore;

    class HelloThread implements Runnable {

        private final Object lock;
        //private final Semaphore lock;

        public HelloThread(Semaphore lock) {
            this.lock = lock;
        }

        public …
Run Code Online (Sandbox Code Playgroud)

java multithreading

2
推荐指数
1
解决办法
261
查看次数

标签 统计

c++ ×1

java ×1

multithreading ×1

qt ×1