我有这个示例代码:
QDialog *dialog = new QDialog(this);
QPoint dialogPos = dialog->mapToGlobal(dialog->pos());
QPoint thisPos = mapToGlobal(this->pos());
dialog->exec();
Run Code Online (Sandbox Code Playgroud)
但是Dialog并不以他的父母为中心.提前致谢.
更新:
我在MainWindow中从构造函数调用Dialog:
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
this->panelInferior = new WidgetTabsInferior;
this->acciones = new Acciones(this);
crearAcciones();
crearBarraMenu();
crearToolbar();
crearTabsEditor();
crearArbolDir();
crearDockWindows();
crearStatusBar();
setWindowIcon(QIcon(":imgs/logo.png"));
connect(this->pestanasEditor , SIGNAL(currentChanged(int)),this,SLOT(cambioTab(int)));
this->dialogo = new AcercaDe(this);
this->dialogo->move(x() + (width() - dialogo->width()) / 2,
y() + (height() - dialogo->height()) / 2);
this->dialogo->show();
this->dialogo->raise();
this->dialogo->activateWindow();
}
Run Code Online (Sandbox Code Playgroud)
但我得到的是:
我有这段代码,应该添加两个数字,一个浮点数(3.25)和一个整数(2)。
编辑:
extern _printf, _scanf
global _main
section .bss
num1: resb 4
section .data
format_num: db "%f", 10, 0
section .text
_main:
mov dword [num1], __float32__(3.25)
add num1, 2
sub esp, 8
fld dword [num1]
mov dword [num1], eax
fstp qword [esp]
push format_num
call _printf
add esp, 12
ret
Run Code Online (Sandbox Code Playgroud)
我得到的输出是:
test.asm:11:错误:操作码和操作数的组合无效
我期望的输出是:
5.250000
我正在使用 Qt,但我不知道如何将 QMainWindow 窗口居中。我写了这段代码,但它不起作用。提前致谢。
QRect screenGeometry = QApplication::desktop()->screenGeometry();
int x = (screenGeometry.width() - w->width()) / 2;
int y = (screenGeometry.height() - w->height()) / 2;
w->move(x, y); // w is a QMainWindow pointer
Run Code Online (Sandbox Code Playgroud)
我明白了:
我有一个错误,在关闭我的应用程序后,我收到一条错误消息,提示它已意外停止。我达到了:
但是,关闭窗口后,出现此错误:
该程序意外完成。该过程被迫结束。
我的项目结构是:
我的代码是:
main.cpp
#include "mainwindow.h"
#include <QApplication>
#include <windows/login.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Login w;
w.show();
return a.exec();
}
Run Code Online (Sandbox Code Playgroud)
util_window.h
#ifndef UTIL_H
#define UTIL_H
#include <QObject>
#include <QMainWindow>
class UtilWindow : QObject
{
public:
// vars
// methods
util();
void setCenterWindow(QMainWindow* w);
};
#endif // UTIL_H
Run Code Online (Sandbox Code Playgroud)
util_window.cpp
#include "util_window.h"
#include <QDesktopWidget>
UtilWindow::util()
{
}
void UtilWindow::setCenterWindow(QMainWindow *w) {
int width = w->frameGeometry().width();
int height = w->frameGeometry().height();
QDesktopWidget wid;
int screenWidth = wid.screen()->width(); …Run Code Online (Sandbox Code Playgroud) 我使用邮递员发送了以下请求:
https://graph.microsoft.com/v1.0/auditLogs/signIns
Run Code Online (Sandbox Code Playgroud)
响应是 1000 条记录。有没有办法克服记录的限制?我试过:
https://graph.microsoft.com/v1.0/auditLogs/signIns?$top=5000
Run Code Online (Sandbox Code Playgroud)
我检索到相同的结果。只有 1000 条记录。有没有办法克服这个限制?提前致谢。
我想阻止<partial>使用 asp.net core 帮助程序的渲染标记。我的代码是:
<pre>
<code class="language-html">
<partial name="~/Breadcrumbs/BreadcrumbTemplate.cshtml" model="breadcrumbs" />
</code>
</pre>
Run Code Online (Sandbox Code Playgroud)
我需要打印完全相同的代码,无需渲染。提前致谢。
c++ ×3
qt ×3
qmainwindow ×2
asp.net-core ×1
assembly ×1
c# ×1
crash ×1
gcc ×1
nasm ×1
qdialog ×1
tag-helpers ×1
windows ×1
x86 ×1
x87 ×1