![qt自定义文件对话框](https://i-blog.csdnimg.cn/blog_migrate/ffd484c2d48534d23bc7b1d1d7dddb8b.png)
qt自定义文件对话框
![00_customized_places_bar](https://i-blog.csdnimg.cn/blog_migrate/3f985290b74cd1144eb0746f2a1880f3.png)
Generally, there are two kinds of Open/Save dialog boxes in Windows. One kind looks like Windows Explorer, with the tree on the left containing Favorites, Libraries, Computer, etc. The other kind contains a vertical toolbar, called the Places Bar.
通常,Windows中有两种“打开/保存”对话框。 一种类似于Windows资源管理器,左侧的树包含“收藏夹”,“库”,“计算机”等。另一种包含垂直的工具栏,称为“位置栏”。
The Windows Explorer-style Open/Save dialog box can be customized by adding your own folders to the Favorites list. You can, then, click the arrows to the left of the main items, except the Favorites, to collapse them, leaving only the list of default and custom Favorites.
通过将自己的文件夹添加到“收藏夹”列表中,可以自定义Windows资源管理器样式的“打开/保存”对话框。 然后,您可以单击除“收藏夹”之外的主要项目左侧的箭头以折叠它们,仅保留默认和自定义“收藏夹”列表。
![01_windows_standard_save_dialog](https://i-blog.csdnimg.cn/blog_migrate/5435b698db8d687b4c6b29e312ba9231.png)
The Places Bar is located along the left side of the File Open/Save dialog box and contains buttons providing access to frequently-used folders. The default buttons on the Places Bar are links to Recent Places, Desktop, Libraries, Computer, and Network. However, you change these links to be links to custom folders of your choice.
位置栏位于“文件打开/保存”对话框的左侧,并且包含用于访问常用文件夹的按钮。 位置栏上的默认按钮是指向“最近的位置”,“桌面”,“图书馆”,“计算机”和“网络”的链接。 但是,您将这些链接更改为指向您选择的自定义文件夹的链接。
![02_places_bar_on_save_dialog](https://i-blog.csdnimg.cn/blog_migrate/38e6df58da6891fdbf5ebcaeec5b2dc9.png)
We will show you how to customize the Places Bar using the registry and using a free tool in case you are not comfortable making changes in the registry.
我们将向您展示如何使用注册表和免费工具来自定义位置栏,以防您不满意在注册表中进行更改。
使用注册表 (Using the Registry)
To open the Registry Editor, open the Start menu and enter “regedit.exe” in the Search box. Click the regedit.exe link in the results or press Enter.
要打开注册表编辑器,请打开“开始”菜单,然后在“搜索”框中输入“ regedit.exe”。 单击结果中的regedit.exe链接或按Enter。
![03_opening_regedit](https://i-blog.csdnimg.cn/blog_migrate/aef17040d1b12f99301688374b7821da.png)
If the User Account Control dialog box displays, click Yes to continue.
如果显示“用户帐户控制”对话框,请单击“是”继续。
NOTE: You may not see this dialog box, depending on your User Account Control settings.
注意:根据您的“用户帐户控制”设置,您可能看不到此对话框。
![04_uac_dialog_for_regedit](https://i-blog.csdnimg.cn/blog_migrate/ffb818975a3208382255aee04035bd15.png)
Navigate to the following key:
导航到以下键:
HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ comdlg32 \ Placesbar
HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ comdlg32 \ Placesbar
The comdlg32 and Placesbar keys may not exist. If not, you need to create them. For example, to create the comdlg32 key, right-click the Policies key and select New | Key.
comdlg32和Placesbar键可能不存在。 如果没有,则需要创建它们。 例如,要创建comdlg32键,请右键单击“策略”键,然后选择“新建” |“新建”。 键。
![05_creating_new_key](https://i-blog.csdnimg.cn/blog_migrate/6b3c04a51b7e868ea246d6d6974061c7.png)
A new key is created and the text is highlighted. Rename the new key “comdlg32.”
创建一个新密钥,并突出显示文本。 重命名新的密钥“ comdlg32”。
![06_new_key_text_highlighted](https://i-blog.csdnimg.cn/blog_migrate/67919957222136013485a5cfa9925d79.png)
Add Placesbar as a new key under the comdlg32 key.
在comdlg32键下将Placesbar添加为新键。
![07_both_keys_created](https://i-blog.csdnimg.cn/blog_migrate/d9a5e39842667ff016806cd7530fd3c9.png)
Select the Placesbar key and right-click in the right pane. Select New | String Value from the popup menu.
选择Placesbar键,然后在右窗格中单击鼠标右键。 选择新建| 弹出菜单中的字符串值。
![08_creating_new_value](https://i-blog.csdnimg.cn/blog_migrate/323188169b518370143be67ff0c1ac27.png)
Rename the new value Place0. You can create up to 5 entries: Place0, Place1, Place2, Place3, Place4. You don’t have to define all five places, but they must be defined in numerical order.
重命名新值Place0。 您最多可以创建5个条目:Place0,Place1,Place2,Place3,Place4。 您不必定义所有五个位置,但是必须按数字顺序定义它们。
To define the target folder for a PlaceX value, double-click on the value name.
要为PlaceX值定义目标文件夹,请双击值名称。
![09_double_clicking_on_place0](https://i-blog.csdnimg.cn/blog_migrate/f0f9d0c8acecad06e5bea76778f2527b.png)
In the Value data edit box on the Edit String dialog box, enter the full path for the location you want to add to the Places Bar and click OK.
在“编辑字符串”对话框的“数值数据”编辑框中,输入要添加到位置栏的位置的完整路径,然后单击“确定”。
![10_edit_string_dialog](https://i-blog.csdnimg.cn/blog_migrate/3f9d45d69a7278028c8c8eca99bf2544.png)
You can also define a target folder using a numerical value for system folders. There is a table below listing the numerical values for the different system folders. To define a target folder using a numerical value, create a new DWORD (32-bit) Value the same way you created the String Value.
您也可以使用系统文件夹的数值来定义目标文件夹。 下表列出了不同系统文件夹的数值。 若要使用数字值定义目标文件夹,请使用与创建字符串值相同的方式创建一个新的DWORD(32位)值。
![11_creating_a_dword_value](https://i-blog.csdnimg.cn/blog_migrate/079ad77f436b9b5cda14b438f7ccb2d8.png)
Double-click on the new DWORD value.
双击新的DWORD值。
![12_double_clicking_on_dword_value](https://i-blog.csdnimg.cn/blog_migrate/a3e67742776460ac3c2acaf3023dd0fd.png)
Enter a numerical value in the Value data edit box. Use the values from the table below the image.
在数值数据编辑框中输入一个数值。 使用图片下方表格中的值。
![13_edit_dword_value_dialog](https://i-blog.csdnimg.cn/blog_migrate/42b7b660cf55aa26bbcafcec782e374f.png)
The following “DWORD” values can be used to add standard folders to the Places Bar.
以下“ DWORD”值可用于将标准文件夹添加到位置栏。
00 – Desktop 01 – Internet Explorer 02 – Start Menu\Programs 03 – My Computer\Control Panel 04 – My Computer\Printers 05 – My Documents 06 – Favorites 07 – Start Menu\Programs\Startup 08 – \Recent 09 – \SendTo 0a – \Recycle Bin 0b – \Start Menu 0c – – logical “My Documents” desktop icon 0d – My Music 0e – My Videos 10 – \Desktop 11 – My Computer 12 – My Network Places 13 – \NetHood 14 – WINDOWS\Fonts 15 – Templates 16 – All Users\Start Menu 17 – All Users\Programs 18 – All Users\Start Menu 19 – All Users\Desktop 1a – \Application Data 1b – \PrintHood 1c – \Local Settings\Application Data | 1d – – Nonlocalized startup 1e – – Nonlocalized common startup 1f – Favorites 20 – Temporary Internet Files 21 – Cookies 22 – History 23 – All Users\Application Data 24 – WINDOWS directory 25 – System32 directory 26 – Program files 27 – My Pictures 28 – USERPROFILE 29 – – x86 system directory on RISC 2a – – x86 C:\Program Files on RISC 2b – C:\Program Files\Common 2c – – x86 Program Files\Common on RISC 2d – All Users\Templates 2e – All Users\Documents 2f – All Users\Start Menu\Programs\Administrative Tools 30 – – \Start Menu\Programs\Administrative Tools 31 – Network and Dial-up Connections 35 – All Users\My Music 36 – All Users\My Pictures 37 – All Users\My Video 38 – Resource Directory 39 – Localized Resource Directory 3a – Links to All Users OEM specific apps 3b – USERPROFILE\Local Settings\Application Data\Microsoft\CD Burning |
00 –桌面 01 – Internet Explorer 02 –开始菜单\程序 03 –我的电脑\控制面板 04 –我的电脑\打印机 05 –我的文件 06 –收藏 07 –开始菜单\程序\启动 08 – \ Recent 09 – \ SendTo 0a – \回收站 0b – \开始菜单 0c – –逻辑“我的文档”桌面图标 0d –我的音乐 0e –我的视频 10 – \桌面 11 –我的电脑 12 –我的网上邻居 13 – \ NetHood 14 – WINDOWS \ Fonts 15 –模板 16 –所有用户\开始菜单 17 –所有用户\程序 18 –所有用户\开始菜单 19 –所有用户\桌面 1a – \应用程序数据 1b – \ PrintHood 1c – \本地设置\应用程序数据 | 1d – –非本地化启动 1e – –非本地化通用启动 1f –收藏 20 – Internet临时文件 21 –饼干 22 –历史 23 –所有用户\应用程序数据 24 – WINDOWS目录 25 – System32目录 26 –程序文件 27 –我的图片 28 –用户个人资料 29 – – RISC上的x86系统目录 2a – – RISC上的x86 C:\ Program文件 2b – C:\ Program Files \ Common 2c – – RISC上的x86程序文件\通用 2d –所有用户\模板 2e –所有用户\文档 2f –所有用户\开始菜单\程序\管理工具 30 – – \“开始”菜单\“程序” \“管理工具” 31 –网络和拨号连接 35 –所有用户\我的音乐 36 –所有用户\我的图片 37 –所有用户\我的视频 38 –资源目录 39 –本地化资源目录 3a –链接到所有用户OEM特定应用程序 3b – USERPROFILE \本地设置\应用程序数据\ Microsoft \ CD刻录 |
Select Exit from the File menu to close the Registry Editor.
从文件菜单中选择退出以关闭注册表编辑器。
![15_closing_registry_editor](https://i-blog.csdnimg.cn/blog_migrate/0c430ba6cb51f90032b794bf38d12672.png)
The Places Bar on the Save dialog box displays the custom folders and chosen system folders.
保存对话框上的位置栏显示自定义文件夹和选定的系统文件夹。
![16_customized_places_bar](https://i-blog.csdnimg.cn/blog_migrate/cfbb5858efabf8f88d8c1a5837daac44.png)
使用PlacesBar编辑器 (Using PlacesBar Editor)
For those of you who don’t feel comfortable making changes to the registry or who just want an easier way to customize the Places Bar, there is a free tool available called PlacesBar Editor. Download the tool using the link at the end of this article and follow the instructions to install it. If the User Account Control dialog box displays during installation, click Yes to continue.
对于那些不满意更改注册表或只想以更简单的方式自定义位置栏的人,有一个免费的工具称为PlacesBar编辑器。 使用本文末尾的链接下载该工具,然后按照说明进行安装。 如果在安装过程中显示“用户帐户控制”对话框,请单击“是”继续。
NOTE: You may not see the User Account Control dialog box, depending on your User Account Control settings.
注意:您可能看不到“用户帐户控制”对话框,具体取决于您的“用户帐户控制”设置。
Use the shortcut created on the desktop to run PlacesBar Editor. You may see the User Account Control dialog box again.
使用在桌面上创建的快捷方式运行PlacesBar编辑器。 您可能会再次看到“用户帐户控制”对话框。
![17_uac_dialog_for_running_places_bar_editor](https://i-blog.csdnimg.cn/blog_migrate/11a6030de37559d691c1ec490b0890c1.png)
The first time you run PlacesBar Editor, the following dialog box displays, encouraging you to donate. Your default web browser also opens to a PayPal page, suggesting a donation.
首次运行PlacesBar编辑器时,将显示以下对话框,鼓励您捐赠。 您的默认Web浏览器还会打开一个PayPal页面,提示您捐赠。
![18_please_consider_donating_dialog](https://i-blog.csdnimg.cn/blog_migrate/be9a8bb78307e82fb1efc66168656c7d.png)
The main interface displays showing a toolbar and two tabs. The Windows tab allows you to make changes to File Open and File Save dialog boxes containing the Places Bar. To define a custom target folder for one of the places, select the Custom check box for that place. Click the folder button to the right of the User Folders edit box to select a folder, or type in the full path to a folder. To select a system folder for a place, select a folder from the drop-down list under System Folders for that place.
显示的主界面显示一个工具栏和两个选项卡。 Windows选项卡允许您更改包含位置栏的“文件打开”和“文件保存”对话框。 要为其中一个位置定义一个自定义目标文件夹,请选中该位置的“自定义”复选框。 单击“用户文件夹”编辑框右侧的文件夹按钮以选择一个文件夹,或键入文件夹的完整路径。 要为某个位置选择系统文件夹,请从该位置的“系统文件夹”下的下拉列表中选择一个文件夹。
![19_places_bar_editor_windows_tab](https://i-blog.csdnimg.cn/blog_migrate/026eed5624301043540bbf02cb20dc84.png)
As mentioned at the beginning of this article, some programs use the Windows Explorer-like File Open and File Save dialog box. Microsoft Office programs (and some other Microsoft programs, like Notepad and Paint) use this style of dialog box.
如本文开头所述,某些程序使用类似于Windows资源管理器的“文件打开”和“文件保存”对话框。 Microsoft Office程序(以及某些其他Microsoft程序,例如Notepad和Paint)使用此对话框样式。
You can use PlacesBar Editor to customize the Microsoft Office dialog boxes as well. Click the Office tab. For each custom folder you want to add, enter a name for the folder in the edit box under Folder Name. Use the folder button to select the desired folder or enter the full path to the desired folder in the edit box under User Folders. You can add up to five additional custom folders. These folders are added to the Favorites, and also display as Favorites in Windows Explorer.
您也可以使用PlacesBar编辑器来自定义Microsoft Office对话框。 单击办公室选项卡。 对于要添加的每个自定义文件夹,在文件夹名称下的编辑框中输入该文件夹的名称。 使用文件夹按钮选择所需的文件夹,或在“用户文件夹”下的编辑框中输入所需文件夹的完整路径。 您最多可以添加五个其他自定义文件夹。 这些文件夹将添加到“收藏夹”中,并在Windows资源管理器中显示为“收藏夹”。
![20_adding_folders_to_office_open_save_dialog](https://i-blog.csdnimg.cn/blog_migrate/c120e1d47df4081c5f0b5ebaa197a044.png)
To apply changes for each tab, you must click Save when that tab is active. To apply changes for Office programs, make sure the Office tab is active and click Save. To save changes you made on the Windows tab, you must click the Windows tab and click Save again.
要对每个选项卡应用更改,必须在该选项卡处于活动状态时单击“保存”。 要对Office程序应用更改,请确保“ Office”选项卡处于活动状态,然后单击“保存”。 要保存在Windows选项卡上所做的更改,必须单击Windows选项卡,然后再次单击保存。
![21_clicking_save](https://i-blog.csdnimg.cn/blog_migrate/fcfe9afaea691b36e6a4fe69ce081d67.png)
A dialog box displays telling you that the changes were made successfully.
将显示一个对话框,告诉您更改已成功完成。
![22_changes_made_successfully](https://i-blog.csdnimg.cn/blog_migrate/35c897477d3393e5407f222f60ad9a26.png)
Once you apply, or save, your changes, on a tab, you can test those changes by clicking the Test button.
一旦应用或保存更改,就可以在选项卡上单击“测试”按钮来测试这些更改。
![23_testing_settings](https://i-blog.csdnimg.cn/blog_migrate/6f7796a3cbb1e7592b4a87cb6d2fa8f7.png)
The appropriate dialog box for the currently selected tab displays. If the Office tab is active, an Office program like Word or Excel opens and the Open dialog box displays. Click Cancel on the Open dialog box to close the dialog box and the program.
显示当前所选选项卡的相应对话框。 如果“ Office”选项卡处于活动状态,则会打开Office程序(如Word或Excel),并显示“打开”对话框。 单击“打开”对话框上的“取消”以关闭对话框和程序。
![24_custom_folder_added_to_favorites](https://i-blog.csdnimg.cn/blog_migrate/d608d3328bacf1594a9a8c9ca17cdb90.png)
You can revert back to the default settings for both types of File Open and File Save dialog boxes by clicking the Defaults button. You must click the Defaults button for each tab separately.
单击“默认值”按钮,可以将两种类型的“文件打开”和“文件保存”对话框恢复为默认设置。 您必须分别单击每个选项卡的“默认值”按钮。
![25_return_to_default_settings](https://i-blog.csdnimg.cn/blog_migrate/db04c899c2bc680748a61b8926487555.png)
A Confirm dialog box displays. Click Yes if you’re sure you want to revert to the defaults.
显示确认对话框。 如果确定要恢复为默认值,请单击“是”。
![26_are_you_sure_return_to_defaults](https://i-blog.csdnimg.cn/blog_migrate/4686d6e162478552823ad1fe6ec2a304.png)
To close PlacesBar Editor, click Exit.
要关闭PlacesBar编辑器,请单击“退出”。
![27_closing_placesbar_editor](https://i-blog.csdnimg.cn/blog_migrate/d1036e6816b8d46f2cbdeb1171373aa0.png)
Customizing the File Open and File Save dialog boxes with custom folders can improve your productivity, especially if the folders you use most often are several layers deep in your folder structure.
使用自定义文件夹自定义“文件打开”和“文件保存”对话框可以提高工作效率,尤其是如果您最常使用的文件夹在文件夹结构中位于几层深处。
Download PlacesBar Editor from http://melloware.com/download/.
从http://melloware.com/download/下载PlacesBar编辑器。
翻译自: https://www.howtogeek.com/97824/how-to-customize-the-file-opensave-dialog-box-in-windows/
qt自定义文件对话框