我有一个循环:
for (int i = 0; i < panel1->Controls->Count; ++i) {
Control^ ctl = panel1->Controls[i];
ctl->Location.Y = i*10;
}
Run Code Online (Sandbox Code Playgroud)
如果我在panel1中有200或300个控件可以吗?或者如果我添加这个会更好:
if (ctl->Location.Y != i*10) ctl->Location.Y = i*10;
Run Code Online (Sandbox Code Playgroud)
我只是不知道.NET的控件是否会重新绘制(需要时间)或者他们会自动检查是否需要重绘(仍然是相同的位置)
在我的 GoLang GraphQL 查询中,我有以下方法(获取用户 ID 并返回配置文件数据):
"userProfile": &graphql.Field{
Type: UserProfileType,
Args: graphql.FieldConfigArgument{
"uid": &graphql.ArgumentConfig{
Type: graphql.Int,
},
},
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
uid := p.Args["uid"].(int)
u, err := db.GetUserProfile(p.Context.Value(handler.CtxId("currentUser")).(int), uid)
return u, err
},
},
Run Code Online (Sandbox Code Playgroud)
当用户 id 无效时db.GetUserProfile返回 nil 指针u和 nil error err,但 GraphQL 响应如下:
{
"data": { "userProfile": null },
"errors": [
{
"message": "runtime error: invalid memory address or nil pointer dereference",
"locations": []
}
]
}
Run Code Online (Sandbox Code Playgroud)
虽然当我像这样修改 GraphQL 代码时(显式 nil …
现在我有我的app文件的结构:
-myApp.exe
-Qt5Core.dll
-Qt5Gui.dll
-Qt5Widgets.dll
-platforms
|-qwindows.dll
Run Code Online (Sandbox Code Playgroud)
是否可以将所有dll放入一个文件夹:
-myApp.exe
-libs
|-Qt5Core.dll
|-Qt5Gui.dll
|-Qt5Widgets.dll
|-platforms
||-qwindows.dll
Run Code Online (Sandbox Code Playgroud)
我知道我可以静态构建Qt并运行没有任何dll的应用程序,但我想保留它们,只需放入一个文件夹
我在互联网上找到了这个代码,并想知道它是如何工作的?
int m[10]; //array with 10 elements
for (int i=0; i<10; ++i)
m[i] = i; //simple initializing
int* a = &m[0]; //a - pointer at the first array's element
3[a] = 20; //???
for (int i=0; i<10; ++i)
cout << m[i] << endl;//out
Run Code Online (Sandbox Code Playgroud)
你可以猜到输出是:
0
1
2
20
4
5
6
7
8
9
Run Code Online (Sandbox Code Playgroud) 为什么这段代码编译(在Playground中):
func text (f: String -> Void) {
f("text")
}
func foo(s: String) {
countElements(s)
}
text() {
s in
foo(s)
}
Run Code Online (Sandbox Code Playgroud)
而这个不是:
func text (f: String -> Void) {
f("text")
}
func foo(s: String) {
countElements(s)
}
text() {
s in
countElements(s)
}
Run Code Online (Sandbox Code Playgroud)
有错误消息:
Cannot convert the expression's type '(($T3) -> ($T3) -> $T2) -> (($T3) -> $T2) -> $T2' to type '_BuiltinIntegerLiteralConvertible'
Run Code Online (Sandbox Code Playgroud)
我可以说有返回类型的东西,有点Swift认为我想返回int但我只想打印它