简体   繁体   English

如何在Qt中创建类似Textmate的侧面板

[英]How to create a Textmate like side panel in Qt

How can I create a side panel like the file explorer in Textmate using C++/Qt? 如何使用C ++ / Qt在Textmate中创建类似于文件资源管理器的侧面板? To be more precise like the left side panel in the image below: 更精确地说,如下图的左侧面板:

文本伴侣侧面板
(source: garzaincredible.com ) (来源: garzaincredible.com

The closest thing to my need seems to be QDockWidget , but I still didn't figure out how to use it. 我需要的最接近的东西似乎是QDockWidget ,但是我仍然不知道如何使用它。

That's called a "Drawer". 这就是所谓的“抽屉”。 In Qt, there's a special Qt::WindowFlags flag for this: Qt::Drawer . 在Qt中,有一个特殊的Qt::WindowFlags标志: Qt::Drawer The intention is to use this flag on a QDockWidget: 目的是在QDockWidget上使用此标志:

QDockWidget* dock = new QDockWidget(parent, Qt::Drawer);

This will create a Cocoa drawer for the dock widget. 这将为停靠小部件创建一个Cocoa抽屉。 You don't need to make sure that Qt::Drawer is only used on OS X; 您无需确保Qt::Drawer仅在OS X上使用;您可以确保Qt::Drawer仅在OS X上使用。 that flag is simply ignored on other platforms, so you can specify it unconditionally. 该标志在其他平台上只是被忽略,因此您可以无条件指定它。

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

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