我正在创建一个软件,父母必须可以访问childrenWidget(或孩子们的孩子的孩子......),以及从孩子到parentWidget(或父母的父母的父母......).
例如 :
QWidget_Principal --> WidgetApplications --> WidgetMenuBar --> PushButtonFullScreen.
Run Code Online (Sandbox Code Playgroud)
问题在于我能做到这一点的方式正在做
this->parentWidget()->parentWidget()->parentWidget()->showFullScreen();
Run Code Online (Sandbox Code Playgroud)
这有一个简单的方法吗?
提前谢谢,对不起我非常糟糕的英语.
路易斯达科斯塔
我正在尝试创建一个简单的网页,其目标是向服务器发送和加密消息(将创建包含该内容的文件),然后创建一个链接,并且接收所提供链接的用户将能够看到加密value(因为它提供了文件名和密钥).
使用CryptoJS AES对消息进行加密,结果是Base64编码后进行解码,只有加密消息的Base64和加密消息才会被发送到服务器,这是使用Javascript完成的.
我的问题是.我有一条消息,让我说使用Base64编码的"Hello World",它给了我这个:
1ffffffff5a8ae57
Run Code Online (Sandbox Code Playgroud)
如果我将此值发送给变量,然后只使用该变量,则显示结果:
// Works !
var test = CryptoJS.enc.Base64.parse("Hello World");
alert(CryptoJS.enc.Base64.stringify(test));
Run Code Online (Sandbox Code Playgroud)
这是正常的.但是如果我尝试直接写文本(或者只是做一个toString(),它就不起作用......这也是正常的,因为'test'变量不是一个简单的String变量):
// Doesn't work !
var test = CryptoJS.enc.Base64.parse("Hello World").toString();
alert(CryptoJS.enc.Base64.stringify(test));
Run Code Online (Sandbox Code Playgroud)
但我需要使用一个String,因为它基于PHP $ _GET值,然后再使用Javascript进行解码.所以我的问题是,我怎么能这样做才能编码一个字符串,然后将结果解码为一个字符串?
这是我的engine.js文件:
// Encrypt the message using a generated key
function encrypt(message, key) {
return CryptoJS.AES.encrypt(message, key);
}
// Encode String to Base64
function encodeBase64(value) {
return CryptoJS.enc.Base64.parse(value.toString());
}
// Decode String from Base64 Enconding
function decodeBase64(encodedValue) {
return CryptoJS.enc.Base64.stringify(encodedValue);
}
// Decrypt the message using the generated key
function decrypt(encrypted, …Run Code Online (Sandbox Code Playgroud) 我正在尝试在JavaFX中制作一个简单的游戏(这是一项学校工作),我试图用电路板清除面板,然后重新绘制它.我已经尝试了很多方法,这是我发现的唯一一个删除了所有板块(可视化)而没有创建一个可视错误,显示已经删除但仍然显示的块.
所以我声明gridPane如下:
private GridPane gridPecas;
@Override
public void start(Stage primaryStage)
{
gridPecas = new GridPane();
gridPecas.setGridLinesVisible(true);
paintBoard();
// rest of the code to create and paint the Stage
}
private void paintBoard()
{
gridPecas.getChildren().clear();
// Code to fill the board with ImageView and Images of the pieces
}
Run Code Online (Sandbox Code Playgroud)
这个方法的问题在于,当"gridPecas.getChildren().clear();"时 被称为我只是松散网格线GridPanel.
我怎么解决这个问题?
我正在Angular 4.x中编写一个软件,对于该服务处理的每个api请求,都需要知道来自另一个服务(一个ID)的信息。
我的问题是关于角度模式和良好做法。对于我的具体情况,最好的方法是:
1-每次需要使用ID信息进行API请求时,使用服务A调用服务B。像这样:
服务A
@Injectable()
export class AService {
// ID
public myId: string;
[...]
}
Run Code Online (Sandbox Code Playgroud)
服务B
@Injectable()
export class BService {
constructor(
private restangular: Restangular,
private aservice: AService,
) { }
public get(callback: (_: string[]) => void) {
// Sends the request
return this.restangular
.all('myrequest')
.customGET('', {
myId: this.aservice.myid,
})
[...]
}
[...]
}
Run Code Online (Sandbox Code Playgroud)
要么
2-切勿从另一个服务调用服务,并且始终使用组件先调用AService,然后使用BService上的值(这样,每次进行API调用时,都将复制相同的代码(或至少每次调用一次)使用该api调用的组件)。
服务A
@Injectable()
export class AService {
// ID
public myId: string;
[...]
}
Run Code Online (Sandbox Code Playgroud)
服务B
@Injectable()
export class BService {
constructor(
private restangular: …Run Code Online (Sandbox Code Playgroud) 我有个问题.我想制作一个摇摆形式,当点击一个按钮时,他将一个面板(带有他的内容)向左滑动,所以右边的面板取代了它的平滑效果.
我试过一段时间来检查面板的大小,然后最小化它并显示下一个这样的:
while (jpanelprincipal1.getWidth() < 439 || jpanelprincipal1.getHeight() > 250)
{
int panel1width = jpanelprincipal1.getWidth();
int panel2height = jpanelprincipal1.getHeight();
jpanelprincipal1.setSize(panel1width -- , panel2height --);
jpanelprincipal2.setSize(440,250);
}
Run Code Online (Sandbox Code Playgroud)
我在C#中使用了这个技巧但是使用了Application.DoEvent(); (显然它在java上不可用).
无论如何我可以制作2个或更多面板的幻灯片效果吗?
顺便说一句:抱歉我的英语很糟糕!
在此先感谢Luis Da Costa