简体   繁体   English

Qt QDialog和GNOME 3,如何显示关闭按钮/标题栏并使其可移动?

[英]Qt QDialog and GNOME 3, how to display the close button/title bar and make it movable?

In GNOME 3 when displaying any QDialog it appears that it can't be moved and it has no title bar. 在GNOME 3中,当显示任何QDialog时,它似乎无法移动并且没有标题栏。

Is there a way to re-enable the title bar and make it movable? 有没有办法重新启用标题栏并使其可移动? I attempted to use a QMainWindow as a workaround instead but it appears in the task bar and won't appear as a "modal" dialog. 我尝试使用QMainWindow作为解决方法,但它出现在任务栏中,不会显示为“模态”对话框。

Probably, it might help you: 可能会帮助您:

  1. Install Configuration Editor (dconf-editor) 安装配置编辑器(dconf-editor)
  2. Open it: Alt+F2 , enter dconf-editor , press Enter 打开它: Alt + F2 ,进入dconf-editor ,按Enter键
  3. Go to: /org/gnome/shell/overrides and select attach_modal_dialogs 转至: / org / gnome / shell / overrides并选择attach_modal_dialogs
  4. Change Use default value to OFF 更改使用默认值为 OFF
  5. Change Custom value to False 自定义值更改为False

在此输入图像描述

Type r in Alt+F2 prompt to restart Gnome shell and see the changes (QDialogs should become movable). 在Alt + F2提示符下键入r以重新启动Gnome shell并查看更改(QDialogs应该可以移动)。

When I had this problem with a dialog (at least the no title bar part), I fixed the issue by setting the dialog's parent to be nullptr as opposed to setting a real parent. 当我遇到对话框问题时(至少没有标题栏部分),我通过将对话框的父项设置为nullptr而不是设置真正的父项来解决了该问题。

http://blog.pitonyak.org/node/18 http://blog.pitonyak.org/node/18

Now, that said, setting the configuration option in gnome is probably a better solution if it works (and I did not verify it). 现在,也就是说,在gnome中设置配置选项可能是一个更好的解决方案,如果它工作(我没有验证它)。 My only complaint with the solution is that then it will behave differently on another computer. 我对该解决方案的唯一抱怨是,它在另一台计算机上的行为会有所不同。 Then again, one could argue that the point of having the configuration option is that the owner of that machine can decide. 然后,有人可能会争辩说,拥有配置选项的重点是该机器的所有者可以决定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM