如何更改 Qt::Drawer 在 Mac 上打开的一侧?
问候!
我有一个 QDialog myDialog;
并希望使用 QWidget myDrawer( &myDialog, Qt::Drawer )
向其附加附加信息。这工作得很好,只是抽屉总是将自己附加到 myDialog 的左侧。我需要它在右侧。我不知道该怎么做。
任何提示和想法将不胜感激! 谢谢,并致以最诚挚的问候, 罗宾
Greetings!
I have a QDialog myDialog;
and want to attach additional information to it using QWidget myDrawer( &myDialog, Qt::Drawer )
. This works fine, except that the drawer always attaches itself to the left side of myDialog. I need it on the right side. And I have no clue how to do that.
Any hints and ideas would be greatly appreciated!
Thanks, and best regards,
Robin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这通常由操作系统完成。尝试将窗口移至靠近屏幕左边缘并打开抽屉 - 它现在应该在右侧打开。
一般来说,尽量避免使用抽屉,因为它们似乎不受欢迎,并且不再是当今预期的“外观和感觉”的一部分。更新:
抱歉 - 正确,它们仍然在人类交互中指南,但大多数开发人员不再使用它们。从几个论坛和 IRC 频道的讨论来看,它们似乎感觉“不自然”,因为它们不是“窗口”的一部分。
回到你的问题;我怀疑你能控制抽屉从 Qt 滑出的一侧。另外,根据您使用的是 Cocoa- 还是 Carbon-Qt,它可能会有所不同。至少我在 Qt 文档中找不到任何相关内容。
This is normally done by the OS. Try moving the window close to the left edge of your screen and open the drawer - it should now open on the right-hand side.
Generally, try to avoid using drawers, as they are seemingly being frowned upon and not part of the expected "look and feel" these days anymore.Update:
Sorry - Correct, they are still in the Human Interace Guidelines, but most developers don't use them anymore. From discussions on several boards and IRC channels it seems that they feel "unnatural" as they are not part of the "window".
To get back to your question; I doubt you can control the side the drawer slides out from Qt. Plus it might make a difference depending on if you are using Cocoa- or Carbon-Qt. At least I couldn't find anything regarding that in the Qt documentation.
在demos\mainwindow项目中,mainwindow.cpp中有几行(第311-314行):我现在无法访问OS X,但是我记得我通过上述项目学会了改变抽屉的侧面。所以你可以在 OS X 中尝试这个项目。
这是可能的:
但是您必须使用 QDockWidget 作为 Qt::Drawer 小部件;
以下代码来自 QMainWindow 类:
要在运行时更改抽屉的一侧:
这些区域可以是 DockWidgetAreas
In the demos\mainwindow project, there are a few lines (lines 311-314) in mainwindow.cpp:I don't have access to OS X right now, but I remember I learnt to change the side of the drawer by the above-mentioned project. So you could playaround with this project in OS X.
this is possible:
but you will have to use QDockWidget as the Qt::Drawer widget;
the following code is from a QMainWindow class:
To change the side of the drawer during runtime:
The areas could be any one of the DockWidgetAreas