小编Mok*_*kaT的帖子

离子2 DatePicker

我是离子新手,我正在玩离子2 beta.我正在尝试使用cordova插件实现本机日期选择器,如文档中所示.

我完全复制/粘贴了这个例子,我"ReferenceError: DatePicker is not defined上了Nexus 5 Emulator和Archos安卓手机.

openDatePicker() {
    var options = {
      date: new Date(),
      mode: 'date'
    };

    function onSuccess(date) {
        alert('Selected date: ' + date);
    }

    function onError(error) { // Android only
        alert('Error: ' + error);
    }

    DatePicker.show(options, onSuccess, onError);
  }
Run Code Online (Sandbox Code Playgroud)

我已经搜索了很多但没有发现这个,也许我在Ionic 2上使用cordova插件做错了?

cordova ionic2

6
推荐指数
1
解决办法
7490
查看次数

使用Cobertura输出Gcov的颜色代码

我在Jenkins上设置了gcov代码覆盖工具.

这工作正常,但我在处理输出颜色代码时遇到了麻烦.每条线的'命中数'是核心,但是当其他线为红色时,某些线是绿色的,我不知道为什么.

示例:

在此输入图像描述

请注意,setYear方法全部为绿色,并且调用了13次(ctor + setDateAAMMJJ中的12次,如屏幕截图所示)

continuous-integration cobertura gcov jenkins gcovr

5
推荐指数
1
解决办法
1700
查看次数

通过调用C ++函数设置加载程序组件

我只是想知道这样的事情是否可能:

Loader {
    id: loader
    objectName: "loader"
    anchors.centerIn: parent

    sourceComponent: cppWrapper.getCurrentDisplay();
 }
Run Code Online (Sandbox Code Playgroud)

在C ++中:

QDeclarativeComponent currentDisplay;
Run Code Online (Sandbox Code Playgroud)

Q_INVOKABLE QDeclarativeComponent getCurrentDisplay() const
{ return currentDisplay; }
Run Code Online (Sandbox Code Playgroud)

我在编译它时遇到了麻烦(在moc文件编译中失败),但是如果可能的话,对我来说这可能是真正的捷径

c++ qt qml

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

在例外消息中使用constexpr

我试图在异常消息中使用constexpr,但这不起作用:后续代码在g ++上编译得很好(使用c ++ 11或c ++ 14).

#include <exception>

constexpr auto TEST = "test";

class test_throw : public std::exception {
public:
    virtual const char* what() const throw() {
        return (std::string("THROW ")+TEST).c_str();
    }
};

int main()
{
    throw test_throw{};
} 
Run Code Online (Sandbox Code Playgroud)

我想知道为什么我的异常输出一个空消息,好吧这似乎是一个坏技巧,但我不明白消息是如何为空.

有没有办法实现这一点而不用宏替换constexpr?

c++ exception constexpr c++11 c++14

0
推荐指数
1
解决办法
123
查看次数