小编jdl*_*jdl的帖子

启动应用并保持横向模式

如何在横向模式下启动应用程序,并保持屏幕旋转方式?

cocoa-touch landscape objective-c uiinterfaceorientation ios

3
推荐指数
1
解决办法
861
查看次数

在对UIButton进行子类化时,UIControlState的名称是什么来获取值?

我是UIButton的子类.但我需要知道状态的按钮在绘制按钮的颜色向上或向下:

- (void)drawRect:(CGRect)rect{
     if (state==UIControlStateNormal) {
         //draw rect RED
     }
     if (state==UIControlEventTouchDown) 
         //draw rect BLUE
     }
}
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c

3
推荐指数
1
解决办法
2812
查看次数

sqlite3_open:"无法打开数据库文件"

执行rc = sqlite3_open("test.db",&db)时,我"无法打开数据库文件"; ??

sqlite3 *db; // sqlite3 db struct
char *zErrMsg = 0;
int rc;

// Open the test.db file
rc = sqlite3_open("test.db", &db); // <-- creates DB if not found ??

if( rc ){
    // failed
    fprintf(stderr, "ERROR: Can't open database: %s\n", sqlite3_errmsg(db));
} 
Run Code Online (Sandbox Code Playgroud)

c sqlite cocoa-touch

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

3
推荐指数
1
解决办法
328
查看次数

使用调试器的 Vscode 错误

尝试使用 VSCODE 调试 c++ 时,出现以下错误:

> Executing task: /usr/bin/g++ -g /home/sa/Genesis/Dev/TcpSocketClassTester/.vscode/launch.json -o /home/sa/Genesis/Dev/TcpSocketClassTester/.vscode/launch <

/usr/bin/ld:/home/sa/Genesis/Dev/TcpSocketClassTester/.vscode/launch.json: file format not recognized; treating as linker script
/usr/bin/ld:/home/sa/Genesis/Dev/TcpSocketClassTester/.vscode/launch.json:1: syntax error
collect2: error: ld returned 1 exit status
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.
Run Code Online (Sandbox Code Playgroud)

启动文件

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": …
Run Code Online (Sandbox Code Playgroud)

visual-studio-code

3
推荐指数
1
解决办法
4148
查看次数

c ++:我想要显示2,4,6,而不是我认为地址号码正在显示?

我想要显示2,4,6,而不是我认为地址号码正在显示?

我需要做些什么才能纠正?为什么?谢谢

(目的......演示改变数组空间的能力并仍保留数组的基础)

    int *line;

    line = new int;
    line[0] = 2;
    line = new int;
    line[1] = 4;
    line = new int;
    line[2] = 6;
    line = new int;
    printf("%d  %d  %d", line[0], line[1], line[2]);
Run Code Online (Sandbox Code Playgroud)

c++

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

用"new"创建2D数组?

我想创建一个如下所示的2D数组.

char **dog = new char[480][640];
Run Code Online (Sandbox Code Playgroud)

但它错误:

error C2440: 'initializing' : cannot convert from 'char (*)[640]' to 'char ** '
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Run Code Online (Sandbox Code Playgroud)

使用"新"我需要做什么?(不使用calloc,malloc或char dog[480][640];)

c++

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

QTimer不完整类型

我已经使用过QTimer了.但是现在它失败了,我无法理解为什么:

在此输入图像描述

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtGui/QPushButton>
#include <QtGui/QTextEdit>
#include <QtGui/QMessageBox>
#include <QtCore/QCoreApplication>

// Server
#include <sys/socket.h>
#include <netinet/in.h>

// Client
//#include <sys/socket.h>
//#include <netinet/in.h>
#include <netdb.h>


namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
    QPushButton *m_btn1;
    QPushButton *m_btn2;
    QTextEdit *m_txt1;
    QTextEdit *m_txt2;
    QTimer *timerDisplay;
    void UpdateDisplay();

private slots:
    void handleBtn1();
    void handleBtn2();
};

#endif // MAINWINDOW_H
Run Code Online (Sandbox Code Playgroud)
#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) …
Run Code Online (Sandbox Code Playgroud)

c++ qt

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

在条件中评估字符串

如何使用字符串来评估进入条件的数字?

string = "(t>=2 && t<5) || (t<1)";

int c = 0;
for(int t = 0; t < 10; t++){
    if(  {string} )
        c++;
}
Run Code Online (Sandbox Code Playgroud)

c++ qt

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

"对'QScriptEngine :: QScriptEngine()的未定义引用"

鉴于此代码,我得到:"未定义引用'QScriptEngine :: QScriptEngine()"

#include <QtScript/QScriptEngine>

...

QScriptEngine e;

/* Commented out to understand the instantiation error first
e.globalObject().setProperty("t", 123);

bool result = e.evaluate("(t>=2 && t<5) || (t<1)").toBool(); 
*/
Run Code Online (Sandbox Code Playgroud)

c++ qt

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