Should the name of my classes begin with 'Q' in Qt?

When I first started working with Qt, it was extremely annoying that every class has a name beginning with 'Q', but now I've got used to it. I'm using Qt Creator, and it highlights code quite well. However, it only highlights class names beginning with 'Q'. And it highlights everything beginning with 'Q' even if there is no such type. It doesn't highligh

Qt中我的课程名称应该以'Q'开头吗?

当我第一次开始使用Qt时,每个班级都有一个以'Q'开头的名字,但现在我已经习惯了。 我使用的是Qt Creator,它很好地突出了代码。 但是,它只会突出显示以“Q”开头的类名。 它突出了以'Q'开头的所有内容,即使没有这种类型。 它不会突出显示自定义类名称。 这让我想知道,我是否也应该用'Q'开始我所有的班级名称? 或者至少可重用的? (我的意思是,我把它放在一个类库中,或在另一个应用程

How to show a QMainWindow inside a QDialog

I am trying to show a QMainWindow inside a QDialog but the former does not appear. I have subclassed QDialog, let's call it myDialog A small example: myDialog(QWidget *p_parent) : QDialog(p_parent) { QGridLayout *p_dialogLayout = new QGridLayout(this); QMainWindow *p_MainWindow = new QMainWindow(this); QLabel *p_label = new QLabel(this); p_MainWindow->setCentralWidget

如何在QDialog中显示QMainWindow

我试图在QDialog中显示QMainWindow,但前者不显示。 我已经子类QDialog,我们称之为myDialog 一个小例子: myDialog(QWidget *p_parent) : QDialog(p_parent) { QGridLayout *p_dialogLayout = new QGridLayout(this); QMainWindow *p_MainWindow = new QMainWindow(this); QLabel *p_label = new QLabel(this); p_MainWindow->setCentralWidget(p_label); QPushButton *p_cancel = new QPushButto

Can't use QMainWindow after opened a QDialog (Qt)

In my program I have the following problem: After I opened a QDialog from QMainWindow , I can't use the QMainWindow , only if I close the QDialog first. Is there a solution for this? Thank you, Mate 如果你不需要exec的事件循环,你可以使用Dialog-> show()。 You problem is that you create your dialog on the stack. That's why you dialog is deleted after on_action_sszes_Mez_rt_k_tr

打开QDialog(Qt)后无法使用QMainWindow,

在我的程序中,我遇到了以下问题:从QMainWindow打开QDialog后,只有先关闭QDialog ,才能使用QMainWindow 。 有没有解决方案? 谢谢, 伴侣 如果你不需要exec的事件循环,你可以使用Dialog-> show()。 你的问题是你在栈上创建对话框。 这就是为什么你的对话在on_action_sszes_Mez_rt_k_triggered()完成后被删除。 您必须在堆上创建对话框: #include <QMainWindow> #include <QScopedPointer> ... n

Call method in QMainWindow from QDialog

I am running this to show a dialog window from main: void SQLWindow::on_action_4_triggered() { HeaderList window; window.show(); window.exec(); } Here I am trying to connect a saveButtonClicked() to the SLOT in the Main Window: HeaderList::HeaderList(QWidget *parent) : QDialog(parent), ui(new Ui::HeaderList) { connect(this, SIGNAL(saveButtonClicked()), SQLWindow, SLOT(hideCol

从QDialog调用QMainWindow中的方法

我正在运行这个从主窗口显示对话窗口: void SQLWindow::on_action_4_triggered() { HeaderList window; window.show(); window.exec(); } 在这里,我试图将一个saveButtonClicked()连接到主窗口中的SLOT: HeaderList::HeaderList(QWidget *parent) : QDialog(parent), ui(new Ui::HeaderList) { connect(this, SIGNAL(saveButtonClicked()), SQLWindow, SLOT(hideColumns())); ui->setupUi(this

Allow Close Button on QMainWindow when QDialog is Open

I have one issue with Qt Close Option when there is QMainWindow is open and on Push button Clicked I am opening one QDialog.Now my requirement is to allow close option is QMainWindow to call closevent of QMainWindow . Now the senario is when I pressed Button on mainwindow, QDialog open and Close button on upper most right is disabled in QmainWindow. So pls let me know how to enable. So, you

QDialog打开时,在QMainWindow上允许关闭按钮

当QMainWindow打开并且按下按钮时,我有一个Qt关闭选项问题我打开了一个QDialog.Now我的要求是允许关闭选项是QMainWindow调用QMainWindow的关闭。 现在senario是当我按下主窗口上的按钮时,QDialog打开,最上面的右边的关闭按钮在QmainWindow中被禁用。 所以,请让我知道如何启用。 所以,你不想在对话框打开的时候阻止你的GUI,对吧? 使用无模式对话框: void EditorWindow::find() { if (!findDialog) { f

Qt: Update widgets that are hidden before they are then shown?

I have two QDialogs stacked on top of each other, with some data is shared between them shown in a QWidget in each dialog's layout (a widget showing a count graphically). In the QDialog currently shown, the user can change that data. This change gets propagated to both widgets, and the correct count is displayed in the current QDialog. However, when the user closes that QDialog, and the o

Qt:更新在被显示之前隐藏的小部件?

我有两个QDialog堆叠在一起,一些数据在QWidget中显示在每个对话框的布局中(一个显示图形计数的小部件)。 在当前显示的QDialog中,用户可以更改该数据。 此更改传播到两个小部件,并且当前QDialog中显示正确的计数。 但是,当用户关闭该QDialog,并且下面的QDialog变为可见时,显示计数的QWidget会在一秒钟之前显示旧值,然后再更新为正确的值。 我知道下面的QWidget在显示另一个QDialog之前有正确的值,但我似乎无法在

Why does QEvent::ShortcutOverride event occur?

I have a QMainWindow with an event filter installed. After I open and close a QDialog the keyboard arrow keys don't respond since QMainWindow receives only ShortcutOverride events instead of KeyPress events. When I changed the QMainWindow's event filter to handle ShortcutOverride events I got a strange behavior since in my program each key press event is preceded by two shortcut overri

为什么会发生QEvent :: ShortcutOverride事件?

我有一个安装了事件过滤器的QMainWindow。 打开并关闭QDialog后,键盘箭头键不响应,因为QMainWindow只接收ShortcutOverride事件而不是KeyPress事件。 当我更改QMainWindow的事件过滤器来处理ShortcutOverride事件时,我得到了一个奇怪的行为,因为在我的程序中,每个按键事件都有两个快捷键覆盖事件(为什么?)。 这不起作用 - 事件处理不止一次: bool eventFilter(QObject *, QEvent *event) { if(type == QEvent::Ke

C++/Win32 dialog generated from resource not behaving normally

I wrote a resource script for a (modeless) dialog that should contain an edit control (used to show a non-edit log report): IDD_LOG DIALOGEX 10, 10, 300, 200, 0 STYLE WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_BORDER | WS_SYSMENU | DS_CENTER CAPTION "Last Log Report" { EDITTEXT 301, 0, 0, 250, 180, WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_READONLY } When I call up the dialog v

从资源生成的C ++ / Win32对话框不正常运行

我为(无模式)对话框编写了一个资源脚本,该对话框应包含一个编辑控件(用于显示非编辑日志报告): IDD_LOG DIALOGEX 10, 10, 300, 200, 0 STYLE WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_BORDER | WS_SYSMENU | DS_CENTER CAPTION "Last Log Report" { EDITTEXT 301, 0, 0, 250, 180, WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_READONLY } 当我通过使用菜单调用对话框时 hwndLogDlg = CreateDialog(

CRichEditCtrl selects all text when it gets focus

I had a dialog with a menu and a CTabCtrl. The CTabCtrl had one tab, which contained a CDialog. In turn, that contained a few static texts and a CRichEditCtrl. There was no particular issue with the window gaining and losing focus. I since added a second identical tab, and now every time the tab is changed, all text in the CRichEditCtrl is apparently selected. It is shown in an inverted col

CRichEditCtrl在获取焦点时选择所有文本

我有一个菜单和一个CTabCtrl对话框。 CTabCtrl有一个选项卡,其中包含一个CDialog。 反过来,它包含一些静态文本和一个CRichEditCtrl。 窗口获得和失去焦点没有特别的问题。 我自从添加了第二个相同的选项卡,现在每次更改选项卡时,CRichEditCtrl中的所有文本显然都被选中。 它显示在一个倒置的配色方案中,并且所有文字都会在您按下某个键时被替换。 标志ECO_NOHIDESEL的描述(强调我的): 取消编辑控件的默认行为

I want to find out where the focus belongs after EN

Now I have build my application like this: it runs in the container of Internet browser(IE, FireFox, Chrome and so on). There is a modeless dialog in my program, the dialog contains one CEdit control. Here is my problem: when user activate the Edit control to type into something, the edit control get the focus. When the edit control loses the focus, I must check whether the input is valid. I

我想知道在EN之后焦点所在的位置

现在我已经构建了我的应用程序:它运行在Internet浏览器(IE,FireFox,Chrome等)的容器中。 在我的程序中有一个无模式对话框,对话框包含一个CEdit控件。 这是我的问题:当用户激活编辑控件键入的东西,编辑控件获得焦点。 当编辑控件失去焦点时,我必须检查输入是否有效。 如果不是,我将显示一个模型对话框 AfxMessageBox的 。 但是现在我无法确定我的编辑控件是否会在我自己的应用程序中失败。 因为编辑控件可能