gpt4 book ai didi

Qt4:调整哪个小部件专注于开始

转载 作者:行者123 更新时间:2023-12-04 04:53:42 25 4
gpt4 key购买 nike

如果我不重新实现QMainWindow::showEvent()(它将包含该小部件的setFocus()方法),是否有任何方法可以在加载窗口时让某些小部件首先聚焦?我使用Qt4的表单编辑器,但找不到用于对其进行配置的地方。

最佳答案

您可以在Qt Designer中设置Tab Order或在Qt Creator中设置Designer组件。制表顺序中的第一个小部件应焦点放在加载上。

tab order

Many users expect to be able to navigate between widgets and controlsusing only the keyboard. Qt lets the user navigate between inputwidgets with the Tab and Shift+Tab keyboard shortcuts. The default taborder is based on the order in which widgets are constructed. Althoughthis order may be sufficient for many users, it is often better toexplicitly specify the tab order to make your application easier touse.

Setting the Tab Order

To enter tab order editing mode, open the Edit menu and select EditTab Order. In this mode, each input widget in the form is shown with anumber indicating its position in the tab order. So, if the user givesthe first input widget the input focus and then presses the tab key,the focus will move to the second input widget, and so on.

The tab order is defined by clicking on each of the numbers in thecorrect order. The first number you click will change to red,indicating the currently edited position in the tab order chain. Thewidget associated with the number will become the first one in the taborder chain. Clicking on another widget will make it the second in thetab order, and so on.

Repeat this process until you are satisfied with the tab order in theform -- you do not need to click every input widget if you see thatthe remaining widgets are already in the correct order. Numbers, forwhich you already set the order, change to green, while those whichare not clicked yet, remain blue.

If you make a mistake, simply double click outside of any number orchoose Restart from the form's context menu to start again. If youhave many widgets on your form and would like to change the tab orderin the middle or at the end of the tab order chain, you can edit it atany position. Press Ctrl and click the number from which you want tostart. Alternatively, choose Start from Here in the context menu.

关于Qt4:调整哪个小部件专注于开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11120428/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com