// Set focus policy to TabFocus QWidget *widget = new QWidget(); widget->setFocusPolicy(Qt::TabFocus); // Set focus policy to ClickFocus QPushButton *button = new QPushButton("Click me"); button->setFocusPolicy(Qt::ClickFocus);In the first example, a QWidget is created and its focus policy is set to TabFocus. This means that the widget can receive focus when the user presses the Tab key. In the second example, a QPushButton is created and its focus policy is set to ClickFocus. This means that the button can receive focus when the user clicks on it. These examples use the Qt library.